10-30-2012 03:10 PM
Hi,
I have a Cisco Catalyst 4500E Supervisor Engine 7-E and configured an EEM Script to monitor the dual core CPU Utilization through PRTG Network Monitor.
event manager applet dualcore authorization bypass
event timer cron cron-entry "* * * * 0-6"
!
action 100 cli command "en"
action 120 cli command "show process cpu | include five"
!
action 220 regexp "Core 0: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*" $_cli_result result c0cpu5sec c0cpu1min c0cpu5min
action 240 if $_regexp_result eq 1
action 260 end
!
action 320 regexp "Core 1: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*" $_cli_result result c1cpu5sec c1cpu1min c1cpu5min
action 340 if $_regexp_result eq 1
action 360 end
!
action 440 cli command "config t"
action 441 cli command "snmp mib expression owner cisco name c0cpu5sec"
action 442 cli command "expression $c0cpu5sec"
action 443 cli command "snmp mib expression owner cisco name c0cpu1min"
action 444 cli command "expression $c0cpu1min"
action 445 cli command "snmp mib expression owner cisco name c0cpu5min"
action 446 cli command "expression $c0cpu5min"
!
action 550 cli command "config t"
action 551 cli command "snmp mib expression owner cisco name c1cpu5sec"
action 552 cli command "expression $c1cpu5sec"
action 553 cli command "snmp mib expression owner cisco name c1cpu1min"
action 554 cli command "expression $c1cpu1min"
action 555 cli command "snmp mib expression owner cisco name c1cpu5min"
action 556 cli command "expression $c1cpu5min"
!
action 600 cli command "end"
!
end
It works fine but on the logging buffer there are a lot of %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:moncores) messages -one per minute- here an example:
Oct 29 17:54:01: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:dualcore)
Oct 29 17:55:01: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:dualcore)
Oct 29 17:56:01: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:dualcore)
Oct 29 17:57:01: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:dualcore)
I considered to use the logging suppress duplicates command to prevent the consecutive logging of more than one copy of the same system logging (syslog) message but it is only available to the Cisco IOS XR.
Someone could help me to determine if it is possible to avoid this messages through Embedded Syslog Manager, I tried to do that but
I was not successful.
Regards,
~Sergio
Solved! Go to Solution.
11-25-2012 06:00 PM
::cisco::eem::event_register_timer cron cron_entry "* * * * 0-6"
#
# This EEM tcl policy was generated by the EEM applet conversion # utility at http://www.marcuscom.com/convert_applet/
# using the following applet:
#
# event manager applet moncores authorization bypass # event timer cron cron-entry "* * * * 0-6"
# !
# action 200 cli command "en"
# action 220 cli command "show process cpu | include fiv"
# !
# action 320 regexp "Core 0: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*" $_cli_result result c0cpu5sec c0cpu1min c0cpu5min # action 350 if $_regexp_result eq 1 # action 390 end # !
# action 420 regexp "Core 1: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*" $_cli_result result c1cpu5sec c1cpu1min c1cpu5min # action 450 if $_regexp_result eq 1 # action 490 end # !
# action 720 cli command "config t"
# action 731 cli command "snmp mib expression owner cisco name c0cpu5sec"
# action 732 cli command "expression $c0cpu5sec"
# action 733 cli command "snmp mib expression owner cisco name c0cpu1min"
# action 734 cli command "expression $c0cpu1min"
# action 735 cli command "snmp mib expression owner cisco name c0cpu5min"
# action 736 cli command "expression $c0cpu5min"
# !
# action 820 cli command "config t"
# action 831 cli command "snmp mib expression owner cisco name c1cpu5sec"
# action 832 cli command "expression $c1cpu5sec"
# action 833 cli command "snmp mib expression owner cisco name c1cpu1min"
# action 834 cli command "expression $c1cpu1min"
# action 835 cli command "snmp mib expression owner cisco name c1cpu5min"
# action 836 cli command "expression $c1cpu5min"
# !
# action 900 cli command "end"
# !
# end
#
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set arr_einfo [event_reqinfo]
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}
if [catch {cli_exec $cli1(fd) "en"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "show process cpu | include fiv"} _cli_result] {
error $_cli_result $errorInfo
}
set _regexp_result [regexp {Core 0: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*} $_cli_result result c0cpu5sec c0cpu1min c0cpu5min] if {$_regexp_result == 1} { } set _regexp_result [regexp {Core 1: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*} $_cli_result result c1cpu5sec c1cpu1min c1cpu5min] if {$_regexp_result == 1} { } if [catch {cli_exec $cli1(fd) "config t"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "snmp mib expression owner cisco name c0cpu5sec"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "expression $c0cpu5sec"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "snmp mib expression owner cisco name c0cpu1min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "expression $c0cpu1min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "snmp mib expression owner cisco name c0cpu5min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "expression $c0cpu5min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "config t"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "snmp mib expression owner cisco name c1cpu5sec"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "expression $c1cpu5sec"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "snmp mib expression owner cisco name c1cpu1min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "expression $c1cpu1min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "snmp mib expression owner cisco name c1cpu5min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "expression $c1cpu5min"} _cli_result] {
error $_cli_result $errorInfo
}
if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
error $_cli_result $errorInfo
}
# Close open cli before exit.
catch {cli_close $cli1(fd) $cli1(tty_id)} result
11-25-2012 06:04 PM
I need you to post the file as an attachment.
11-25-2012 06:08 PM
Here we go!
11-25-2012 06:09 PM
Nothing was attached.
11-25-2012 06:09 PM
11-25-2012 06:18 PM
11-28-2012 03:28 PM
I tried it but it is getting overloaded the buffer with this messages:
#sh log
Syslog logging: enabled (0 messages dropped, 87 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
No Active Message Discriminator.
No Inactive Message Discriminator.
Console logging: level debugging, 75 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 161 messages logged, xml disabled,
filtering disabled
Exception Logging: size (8192 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled
No active filter modules.
Trap logging: level informational, 165 message lines logged
Logging Source-Interface: VRF Name:
Log Buffer (32768 bytes):
*Nov 29 16:13:12.749: %SYS-5-CONFIG_I: Configured from console by console
*Nov 29 16:14:03.893: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:tm_monitor_cpu.tcl)
*Nov 29 16:15:03.713: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:tm_monitor_cpu.tcl)
*Nov 29 16:16:03.709: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:tm_monitor_cpu.tcl)
*Nov 29 16:17:03.677: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:tm_monitor_cpu.tcl)
*Nov 29 16:18:03.685: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:tm_monitor_cpu.tcl)
*Nov 29 16:19:03.676: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:tm_monitor_cpu.tcl)
#
Could you help me to avoid this or it is not possible to do it...?!
Regards,
11-28-2012 04:18 PM
I tried with the EEM tcl policy OIDs version but I have received this error:
(config)#
(config)#event manager directory user policy "bootflash:/policies"
(config)#event manager policy tm_monitor_cpu.tcl
EEM Register event failed:wrong # args: should be "set varName ?newValue?"
while compiling
"set _regexp_result [regexp {Core 0: CPU utilization for five seconds: ([^%]+)%; one minute: ([^%]+)%; five minutes: ([^%]+)%.*} $_cli_result result c0..."
EEM configuration: failed to retrieve intermediate registration result for policy tm_monitor_cpu.tcl
(config)#
12-01-2012 02:38 PM
12-07-2012 02:33 PM
I tried it but I received this error....
#$10.20.91.3/tm_monitor_cpu.tcl bootflash:/policies/tm_monitor_cpu.tcl
Destination filename [/policies/tm_monitor_cpu.tcl]?
Accessing ftp://*****:*****@10.20.91.3/tm_monitor_cpu.tcl...
Loading tm_monitor_cpu.tcl !
[OK - 10665/4096 bytes]
10665 bytes copied in 5.220 secs (2043 bytes/sec)
#
#conf t
Enter configuration commands, one per line. End with CNTL/Z.
(config)#
(config)#
(config)#event manager directory user policy bootflash:/policies
(config)#event manager policy tm_monitor_cpu.tcl
EEM Register event failed: Error empty reg spec, policy does not start with EEM registration commands.
EEM configuration: failed to retrieve intermediate registration result for policy tm_monitor_cpu.tcl
(config)#end
#
12-08-2012 10:33 AM
12-20-2012 11:05 AM
I received this log:
#
#
#
#conf t
Enter configuration commands, one per line. End with CNTL/Z.
(config)#
(config)#
(config)#
(config)#event manager directory user policy "bootflash:/policies"
(config)#event manager policy tm_monitor_cpu.tcl
(config)#
(config)#end
#
#
#
#
*Dec 21 11:42:02.488: %SYS-5-CONFIG_I: Configured from console by console
#
#
*Dec 21 11:43:00.689: %HA_EM-6-LOG: tm_monitor_cpu.tcl: Wrong # args, usage is "sys_reqinfo_snmp_set oid ? int|uint|counter|gauge|o
ctet|string|ipv4 ? community ? ipaddr ?"
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: while executing
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: "sys_reqinfo_snmp_set oid 1.3.6.1.2.1.90.1.2.1.1.9.5.99.105.115.99.111.9.99.
48.99.112.117.53.115.101.99 set-type int 6 community tester "
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: invoked from within
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: "$slave eval $Contents"
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: (procedure "eval_script" line 7)
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: invoked from within
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: "eval_script slave $scriptname"b
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: invoked from within
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: "if {$security_level == 1} { #untrusted script
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: interp create -safe slave
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: interp share {} stdin slave
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: interp share {} stdout slave
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: ..."
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: (file "tmpsys:/lib/tcl/base.tcl" line 50)
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: Tcl policy execute failed:
*Dec 21 11:43:00.690: %HA_EM-6-LOG: tm_monitor_cpu.tcl: Wrong # args, usage is "sys_reqinfo_snmp_set oid ? int|uint|counter|gauge|o
ctet|string|ipv4 ? community ? ipaddr ?"
12-20-2012 11:11 AM
You found a bug in the converter. Edit your script and remove the "set-type" token. That should not have been in the converted Tcl code.
01-08-2013 06:50 PM
I did it but I received this error:
#
#$10.20.91.3/tm_monitor_cpu.tcl bootflash:/policies/tm_monitor_cpu.tcl
Destination filename [/policies/tm_monitor_cpu.tcl]?
Accessing ftp://*****:*****@10.20.91.3/tm_monitor_cpu.tcl...
Loading tm_monitor_cpu.tcl !
[OK - 10158/4096 bytes]
10158 bytes copied in 5.172 secs (1964 bytes/sec)
#
#
#conf t
Enter configuration commands, one per line. End with CNTL/Z.
(config)#
(config)#
(config)#
(config)#event manager directory user policy "bootflash:/policies"
(config)#event manager policy tm_monitor_cpu.tcl
(config)#end
#
#
#
#
*Jan 9 12:11:59.164: %SYS-5-CONFIG_I: Configured from console by console
*Jan 9 12:12:00.692: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.693: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.693: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.693: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.693: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.694: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.694: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.694: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.694: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
*Jan 9 12:12:00.694: %HA_EM-7-FMFD_SNMP_ERRCODE: fh_fd_snmp_errcode: Error status: 6 NO_ACCESS_ERROR: 1.
01-20-2013 08:33 AM
This is working for me. Are you sure "tester" is a valid SNMP read-write community string?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide