[c-nsp] Monitoring Nexus 7000 platform
Lee
ler762 at gmail.com
Mon Aug 17 13:15:13 EDT 2009
On 8/16/09, Lincoln Dale <ltd at cisco.com> wrote:
>
> On 15/08/2009, at 7:37 AM, Lee wrote:
>
>> On 8/14/09, Lincoln Dale <ltd at cisco.com> wrote:
>>
>> .. snip lots of really cool examples ..
>>
>>> why one would ever touch SNMP willingly after using the above is
>>> beyond me. :)
>>
>> Is there an XML equivalent to the Net-SNMP package?
>
> i'm not aware of any standard perl modules for NetConf, however we
> (Cisco) and other vendors have sample scripts available which
> demonstrate how to make use of Netconf with the CPAN Expect and
> XML::DOM.
Maybe that'll help push my "learn perl" todo item up a bit higher on
my list :) But that's assuming netconf/xml makes expect scripts a bit
less dependent on the exact formatting of the output. If upgrading
the OS requires updating the xml definition in the script (eg. bump
netconf:base:1.0 to netconf:base:1.1) .. well, seems like not such a
big win.
> most sample scripts turn out to be <50 lines of code, e.g.
<.. snip example ..>
Thanks for the example. I'd done a search on cisco.com for how to use
xml & the best I could find was a recommendation to use an xml editor
& click on the publish button to push the file to the device. At
least your example is something that could be run from a crontab entry
>> For example,
>> finding devices that haven't had their config saved is easy with SNMP:
>>
>> chgTime=`snmpget -OqUtv $DEV ccmHistoryRunningLastChanged.0`
>> savTime=`snmpget -OqUtv $DEV ccmHistoryStartupLastChanged.0`
>> if [ $savTime -lt $chgTime ]; then
>> printf "%-14s config needs to be saved\n" $DEV
>> fi
>>
>> how do you do that with Netconf/XML?
>
> good question. the key to doing something in NetConf is to find a CLI
> command that provides the data you want. e.g. if there was a CLI
> command that provided time/datestamps of startup-config vs running-
> config (or a flag indicating config has changed between them), then
> you'd do that command.
>
> off the top of my head, i can't think of a command that provides that,
The other example that came to mind was finding switch ports that
haven't been used in however many days. CatOS has the "show port
usage" command; I haven't found the IOS equivalent yet but IOS
switches do have the ifLastChange mib variable.
> however one COULD in theory ask the switch to provide a diff between
> the running-config and the startup-config, e.g.
> switch# show diff rollback-patch running-config startup-config
> and if you get any changes then there is a difference.
>
> its a bit heavyweight versus a flag, but assuming your script wanted
> to do something intelligent based on said output, could be useful.
Usually all I want to do is make sure everything's been saved before a
scheduled power outage :)
> NX-OS does support the SNMP trap for ccmCLIRunningConfigChanged so you
> could use that.
>
> another way i can forsee that one could accomplish a simple trigger is
> an EEM event that creates a file on config-change and clears it on
> config-save, e.g.
> event manager applet set_config_changed_flag
> event cli match "config"
> action 1 cli echo config_changed > volatile:config_changed
> action 2 event-default
> event manager applet clear_config_config_changed
> event cli match "copy running-config startup-config"
> action 1 cli delete volatile:config_changed
> action 2 event-default
>
> then your NetConf/XML can do the equivalent of "tail
> volatile:config_changed" and see what result it gets back.
> probably overkill but you get the idea - many ways to achieve what you
> want.
Yes, I see. We recently got a pair of Nx7000s - I'll have to see what
I can do with them.
Thanks for the ideas,
Lee
More information about the cisco-nsp
mailing list