[c-nsp] kron job to capture outputs from CLI commands, file at ftp with $var on name to be used as timestamp

LM asturluismi at gmail.com
Wed Nov 2 14:14:56 EDT 2011


This is a fantastic info.
Thank you very much.
And yes, you are right, subject is a bit long, I was looking the screen 
for a while to find a way to explain the mail but at the end... anyway, 
yes, it is a bit long. :-)

Thanks again.
Luis

El 02/11/11 18:30, Peter Rathlev escribió:
> On Wed, 2011-11-02 at 15:37 +0100, LM wrote:
>> kron occurrence T10660 in 2:0 recurring
>>    policy-list T10660
>> !
>> kron policy-list T10660
>>    cli show proc mem sort | redirect tftp://10.225.225.1/T10660-$t
>>
>> $t is not a variable as in the 'archive' command so I can have the
>> timestamp in every file generated at the tftp.
>> The kron job would avoid manual operation from a us to capture the info
>> required to detect a memory leak.
>> Does anyone none if $t or similar variable is supported somehow on IOS?
> I've had better experience with using EEM instead of Kron. If you just
> need the filename to semi-unique you could use the uptime:
>
> ! Define an RMON event to react only when the CPU is busy
> rmon event 10 log description "1 minute avg. CPU>  90%"
> rmon event 11 log description "1 minute avg. CPU<  70%"
> rmon alarm 10 lsystem.57.0 5 absolute rising-threshold 90 10 falling-threshold 70 11
> !
> ! If using TACACS+ and command authentication you need to specify a username
> event manager session cli username "<tacacs-needs-a-username>"
> !
> event manager applet EEM-copy-mem-usage
>   event timer cron cron-entry "0 */2 * * *"
>   action 1.0 info type routername
>   action 1.1 info type snmp oid 1.3.6.1.2.1.1.3.0 get-type exact
>   action 2.0 cli command "enable"
>   action 2.1 cli command "show processes memory sorted | redirect tftp://192.0.2.10/$_info_routername-$_info_snmp_value-mem-usage.txt"
>   action 3.0 syslog msg "Memory usage copied to tftp://192.0.2.10/$_info_routername-$_info_snmp_value-mem-usage.txt"
> !
>
> (By the way: Your subject is waaay too long for comfort. Subjects should
> not contain information in themselves. :-))
>


More information about the cisco-nsp mailing list