Showing posts with label Network Management. Show all posts
Showing posts with label Network Management. Show all posts
Wednesday, June 29, 2016
Using Spark to monitor device availability
This is another use case I used Spark in my lab, to check the availability of my lab devices. When there is outage, the chatbot will alert me proactively so that I can check and troubleshoot the issue earlier rather than later.
Labels:
API,
Cisco,
Network Management,
Restful API,
scripting,
Spark,
use cases
Thursday, April 24, 2014
Cisco vNAM and ERSPAN config on N7K
NAM is a tool which helps you to collect network information via SPAN, ERSPAN and Netflow. There is a virtual version vNAM which allows you to install it on VM. I have a setup in my NAM using vNAM 6.0(2). This is particular useful after 1040 Sensor announced EoS, and it can provide data to Prime Collaboration Assurance for better reporting capability on voice service quality. I have a Nexus 7000 in my lab, ERSPAN is configured to send traffic to send my vNAM. This is my ERSPAN configuration on 7K and related show command.
monitor erspan origin ip-address 10.1.90.254 global
monitor session 10 type erspan-source
erspan-id 90
vrf default
destination ip 10.1.90.71
source vlan 90-91,93 both
no shut
erspan-id 90
vrf default
destination ip 10.1.90.71
source vlan 90-91,93 both
no shut
N7K# sh monitor session 10
session 10
---------------
type : erspan-source
state : up
erspan-id : 90
vrf-name : default
acl-name : acl-name not specified
ip-ttl : 255
ip-dscp : 0
destination-ip : 10.1.90.71
origin-ip : 10.1.90.254 (global)
source intf :
rx :
tx :
both :
source VLANs :
rx : 90-91,93
tx : 90-91,93
both : 90-91,93
source exception :
filter VLANs : filter not specified
Feature Enabled Value Modules Supported Modules Not-Supported
-----------------------------------------------------------------------------
MTU-Trunc No
rate-limit-rx No
rate-limit-tx No
Sampling No
MCBE No
ERSPAN-ACL - - 1 4 7 8 5 10
ERSPAN-V2 Yes - 1 4 7 8 5 10
RB span No
Legend:
MCBE = Multicast Best Effort
L3-TX = L3 Multicast Egress SPAN
ExSP-X = Exception Span for type X (L3, FP, or misc)
session 10
---------------
type : erspan-source
state : up
erspan-id : 90
vrf-name : default
acl-name : acl-name not specified
ip-ttl : 255
ip-dscp : 0
destination-ip : 10.1.90.71
origin-ip : 10.1.90.254 (global)
source intf :
rx :
tx :
both :
source VLANs :
rx : 90-91,93
tx : 90-91,93
both : 90-91,93
source exception :
filter VLANs : filter not specified
Feature Enabled Value Modules Supported Modules Not-Supported
-----------------------------------------------------------------------------
MTU-Trunc No
rate-limit-rx No
rate-limit-tx No
Sampling No
MCBE No
ERSPAN-ACL - - 1 4 7 8 5 10
ERSPAN-V2 Yes - 1 4 7 8 5 10
RB span No
Legend:
MCBE = Multicast Best Effort
L3-TX = L3 Multicast Egress SPAN
ExSP-X = Exception Span for type X (L3, FP, or misc)
Labels:
Cisco,
Network Management,
Nexus,
Prime Collaboration Assurance,
vNAM
Monday, May 18, 2009
Sneak Preview on the new LMS 3.1 portal
This clip shows how powerful the new portal framework of Ciscoworks LMS can be. How it can help consolidate all of the web-based network application into one single portal.
Labels:
Cisco,
CiscoWorks,
LMS,
Network Management
Saturday, November 15, 2008
How to setup syslog server on Linux to receive log messages from Cisco Devices
1. Setup your Cisco devices to send Cisco log to your syslog server
logging 1.2.3.4 ! where 1.2.3.4 is your Cisco log server
logging trap debug
logging on
2. Make sure rsyslog daemon is installed on your host. I'm using rsyslog-2.0.2-3.fc8.
3. Tell the syslog daemon to listen for messages from remote devices
vi /etc/sysconfig/rsyslog
SYSLOGD_OPTIONS="-m0 -r"
4. Tell the rsyslog daemon to write the messages to cisco.log
vi /etc/rsyslog.conf
local7.debug /var/log/cisco.log
Labels:
Cisco,
Linux,
Network Management,
Open Source,
syslog
Sunday, April 6, 2008
EEM - Server Failure Detection
This example combine IOS IP SLA + EOT + EEM
1. Setup Email Environmental variables. Please refer to the previous EEM examples. On R4, configure an IP SLA ICMP Echo operation that will ping 3.3.3.3 with a frequency of 3 seconds and timeout of 500 msecs.
ip sla 10
icmp-echo 3.3.3.3
timeout 500
frequency 3
ip sla schedule 10 life forever start-time now
2. Verify that the SLA is being met.
R4#sh ip sla stat
Round Trip Time (RTT) for Index 10
Latest RTT: 1 milliseconds
Latest operation start time: *01:32:54.063 UTC Sat Sep 15 2007
Latest operation return code: OK
Number of successes: 4
Number of failures: 0
Operation time to live: Forever
3. Next, track the IP SLA ICMP-ECHO reachability state using Enhance Object Tracking (EOT). State is defined to be “down” if unreachable for more than 10 seconds. State defined to be “up” if reachable for more than 20 seconds.
!
track 10 rtr 10 reachability
delay down 10 up 20
!
4. Verify EOT reachability is in an “Up” state.
R4#sh track 10
Track 10
Response Time Reporter 10 reachability
Reachability is Up
1 change, last change 00:00:10
Delay up 20 secs, down 10 secs
Latest operation return code: OK
Latest RTT (millisecs) 1
5. Configure the following EEM applet named email_server_unreachable:
event manager applet email_server_unreachable
event track 10 state down
action 1.0 syslog msg "Ping has failed, server unreachable!"
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:server_unreachable"
action 1.3 cli command "show clock | append server_unreachable"
action 1.4 cli command "show ip route | append server_unreachable"
action 1.5 cli command "more flash:server_unreachable"
action 1.6 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Server Unreachable: ICMPEchos
Failed" body "$_cli_result"
action 1.7 syslog msg "Server unreachable alert has been sent to email server!"
6. Verify that the EEM applet has been registered and the required environment variables have been set properly:
R4#sh event manager policy registered
No. Class Type Event Type Trap Time Registered Name
# applet system track Off Sat Sep 15 01:50:52 2007 email_server_unreachable
track 10 state down
action 1.0 syslog msg "Ping has failed, server unreachable!"
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:server_unreachable"
action 1.3 cli command "show clock | append server_unreachable"
action 1.4 cli command "show ip route | append server_unreachable"
action 1.5 cli command "more flash:server_unreachable"
action 1.6 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Server Unreachable: ICMP-Echos
Failed" body "$_cli_result"
action 1.7 syslog msg "Server unreachable alert has been sent to email server!"
R4#sh event manager environment
No. Name Value
1 _email_server 50.50.50.1
2 _email_from router-abc@customer.com
3 _email_to attach@cisco.com
7. Shutdown R3’s Loopback0 interface to trigger the EEM applet.
R3#config t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int loop0
R3(config-if)#shut
8. Go to R4 and issue ‘show track 10’ several times to watch the state of the 3.3.3.3 go DOWN which will cause the EEM applet to trigger.
R4#sh track 10
Track 10
Response Time Reporter 10 reachability
Reachability is Up, delayed Down (1 sec remaining)
1 change, last change 00:22:23
Delay up 20 secs, down 10 secs
Latest operation return code: OK
Latest RTT (millisecs) 1
Tracked by:
EEM applet email_server_unreachable
R4#sh track 10
Track 10
Response Time Reporter 10 reachability
Reachability is Down
2 changes, last change 00:00:00
Delay up 20 secs, down 10 secs
Latest operation return code: Timeout
Tracked by:
EEM applet email_server_unreachable
1. Setup Email Environmental variables. Please refer to the previous EEM examples. On R4, configure an IP SLA ICMP Echo operation that will ping 3.3.3.3 with a frequency of 3 seconds and timeout of 500 msecs.
ip sla 10
icmp-echo 3.3.3.3
timeout 500
frequency 3
ip sla schedule 10 life forever start-time now
2. Verify that the SLA is being met.
R4#sh ip sla stat
Round Trip Time (RTT) for Index 10
Latest RTT: 1 milliseconds
Latest operation start time: *01:32:54.063 UTC Sat Sep 15 2007
Latest operation return code: OK
Number of successes: 4
Number of failures: 0
Operation time to live: Forever
3. Next, track the IP SLA ICMP-ECHO reachability state using Enhance Object Tracking (EOT). State is defined to be “down” if unreachable for more than 10 seconds. State defined to be “up” if reachable for more than 20 seconds.
!
track 10 rtr 10 reachability
delay down 10 up 20
!
4. Verify EOT reachability is in an “Up” state.
R4#sh track 10
Track 10
Response Time Reporter 10 reachability
Reachability is Up
1 change, last change 00:00:10
Delay up 20 secs, down 10 secs
Latest operation return code: OK
Latest RTT (millisecs) 1
5. Configure the following EEM applet named email_server_unreachable:
event manager applet email_server_unreachable
event track 10 state down
action 1.0 syslog msg "Ping has failed, server unreachable!"
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:server_unreachable"
action 1.3 cli command "show clock | append server_unreachable"
action 1.4 cli command "show ip route | append server_unreachable"
action 1.5 cli command "more flash:server_unreachable"
action 1.6 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Server Unreachable: ICMPEchos
Failed" body "$_cli_result"
action 1.7 syslog msg "Server unreachable alert has been sent to email server!"
6. Verify that the EEM applet has been registered and the required environment variables have been set properly:
R4#sh event manager policy registered
No. Class Type Event Type Trap Time Registered Name
# applet system track Off Sat Sep 15 01:50:52 2007 email_server_unreachable
track 10 state down
action 1.0 syslog msg "Ping has failed, server unreachable!"
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:server_unreachable"
action 1.3 cli command "show clock | append server_unreachable"
action 1.4 cli command "show ip route | append server_unreachable"
action 1.5 cli command "more flash:server_unreachable"
action 1.6 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Server Unreachable: ICMP-Echos
Failed" body "$_cli_result"
action 1.7 syslog msg "Server unreachable alert has been sent to email server!"
R4#sh event manager environment
No. Name Value
1 _email_server 50.50.50.1
2 _email_from router-abc@customer.com
3 _email_to attach@cisco.com
7. Shutdown R3’s Loopback0 interface to trigger the EEM applet.
R3#config t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int loop0
R3(config-if)#shut
8. Go to R4 and issue ‘show track 10’ several times to watch the state of the 3.3.3.3 go DOWN which will cause the EEM applet to trigger.
R4#sh track 10
Track 10
Response Time Reporter 10 reachability
Reachability is Up, delayed Down (1 sec remaining)
1 change, last change 00:22:23
Delay up 20 secs, down 10 secs
Latest operation return code: OK
Latest RTT (millisecs) 1
Tracked by:
EEM applet email_server_unreachable
R4#sh track 10
Track 10
Response Time Reporter 10 reachability
Reachability is Down
2 changes, last change 00:00:00
Delay up 20 secs, down 10 secs
Latest operation return code: Timeout
Tracked by:
EEM applet email_server_unreachable
Labels:
Cisco,
EEM,
EOT,
IOS,
IP SLA,
Network Management,
Programming,
Routing and Switching
EEM - Layer 3 Path Failure Detection
This example will track the availability of a route using Embedded Object Tracking (EOT) with EEM applet to email an alert as soon as the route is withdrawn from the routing table.
1. Configure your router to tracks 1.1.1.1/32 using the Cisco IOS Embedded Object Tracking (EOT) feature:
track 400 ip route 1.1.1.1/32 reachability
delay down 10 up 10
2. Verify reachability to 1.1.1.1/32 is UP
R4#sh track
Track 400
IP route 1.1.1.1 255.255.255.255 reachability
Reachability is Up (EIGRP)
1 change, last change 00:02:15
Delay up 10 secs, down 10 secs
First-hop interface is FastEthernet0/0
3. Configure the appropriate email environment variables. Refer to other EEM examples.
4. Configured the following environment variable to define the ip prefix wished to be tracked.
R4(config)#event manager environment iproute 1.1.1.1/32
5. On R4, configure the following EEM applet below named “email_track_iproute” so an alarm (in the form of a syslog and email) will be sent when the prefix 1.1.1.1/32 is withdrawn from R4’s routing table:
event manager applet email_track_iproute
event track 400 state down
action 1.0 syslog msg "Prefix to remote site [$iproute] has been withdrawn!"
action 1.1 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Layer 3 Path Failure: Prefix to Remote Site [$iproute] is DOWN" body ""
action 1.2 syslog msg "Layer 3 Path Failure alert has been sent to email server!"
6. Verify that the EEM applet has been registered and the required environment variables have been set properly:
R4#sh event manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 applet system track Off Fri Sep 14 21:16:43 2007 email_track_iproute
track 400 state down
action 1.0 syslog msg "Prefix to remote site [$iproute] has been withdrawn!"
action 1.1 mail server "$mailserver" to "$mailto" from "$mailfrom" subject "Layer 3 Path Failure: Prefix to Remote Site [$iproute] is DOWN"
action 1.2 syslog msg "Layer 3 Path Failure alert has been sent to email server!"
R4#sh event manager environment
No. Name Value
1 _email_server 50.50.50.1
2 _email_from router-abc@customer.com
3 _email_to attach@cisco.com
4 iproute 1.1.1.1/32
7. Shutdown R1’s Loopback0 interface to trigger the EEM applet on R4 .
R1#config t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int loop0
R1(config-if)#shut
8. Go to R4 and issue ‘show track’ several times to watch the state of the 1.1.1.1/32 go DOWN which will cause the EEM applet to trigger.
R4#sh track
Track 400
IP route 1.1.1.1 255.255.255.255 reachability
Reachability is Up (EIGRP), delayed Down (1 sec remaining) (no route)
3 changes, last change 00:00:29
Delay up 10 secs, down 10 secs
First-hop interface is GigabitEthernet0/0 (was unknown)
Tracked by:
EEM applet email_track_iproute
R4#sh track
Track 400
IP route 1.1.1.1 255.255.255.255 reachability
Reachability is Down (no route)
4 changes, last change 00:00:00
Delay up 10 secs, down 10 secs
First-hop interface is unknown
Tracked by:
EEM applet email_track_iproute
1. Configure your router to tracks 1.1.1.1/32 using the Cisco IOS Embedded Object Tracking (EOT) feature:
track 400 ip route 1.1.1.1/32 reachability
delay down 10 up 10
2. Verify reachability to 1.1.1.1/32 is UP
R4#sh track
Track 400
IP route 1.1.1.1 255.255.255.255 reachability
Reachability is Up (EIGRP)
1 change, last change 00:02:15
Delay up 10 secs, down 10 secs
First-hop interface is FastEthernet0/0
3. Configure the appropriate email environment variables. Refer to other EEM examples.
4. Configured the following environment variable to define the ip prefix wished to be tracked.
R4(config)#event manager environment iproute 1.1.1.1/32
5. On R4, configure the following EEM applet below named “email_track_iproute” so an alarm (in the form of a syslog and email) will be sent when the prefix 1.1.1.1/32 is withdrawn from R4’s routing table:
event manager applet email_track_iproute
event track 400 state down
action 1.0 syslog msg "Prefix to remote site [$iproute] has been withdrawn!"
action 1.1 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Layer 3 Path Failure: Prefix to Remote Site [$iproute] is DOWN" body ""
action 1.2 syslog msg "Layer 3 Path Failure alert has been sent to email server!"
6. Verify that the EEM applet has been registered and the required environment variables have been set properly:
R4#sh event manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 applet system track Off Fri Sep 14 21:16:43 2007 email_track_iproute
track 400 state down
action 1.0 syslog msg "Prefix to remote site [$iproute] has been withdrawn!"
action 1.1 mail server "$mailserver" to "$mailto" from "$mailfrom" subject "Layer 3 Path Failure: Prefix to Remote Site [$iproute] is DOWN"
action 1.2 syslog msg "Layer 3 Path Failure alert has been sent to email server!"
R4#sh event manager environment
No. Name Value
1 _email_server 50.50.50.1
2 _email_from router-abc@customer.com
3 _email_to attach@cisco.com
4 iproute 1.1.1.1/32
7. Shutdown R1’s Loopback0 interface to trigger the EEM applet on R4 .
R1#config t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int loop0
R1(config-if)#shut
8. Go to R4 and issue ‘show track’ several times to watch the state of the 1.1.1.1/32 go DOWN which will cause the EEM applet to trigger.
R4#sh track
Track 400
IP route 1.1.1.1 255.255.255.255 reachability
Reachability is Up (EIGRP), delayed Down (1 sec remaining) (no route)
3 changes, last change 00:00:29
Delay up 10 secs, down 10 secs
First-hop interface is GigabitEthernet0/0 (was unknown)
Tracked by:
EEM applet email_track_iproute
R4#sh track
Track 400
IP route 1.1.1.1 255.255.255.255 reachability
Reachability is Down (no route)
4 changes, last change 00:00:00
Delay up 10 secs, down 10 secs
First-hop interface is unknown
Tracked by:
EEM applet email_track_iproute
Labels:
Cisco,
EEM,
EOT,
IOS,
Network Management,
Programming,
Routing and Switching
EEM - Watchdog timer
This EEM example applet will trigger every minute (60 seconds):
EEM Applet:
event manager applet goober
event timer watchdog time 60
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show clock | append flash:show_tech"
action 1.4 cli command "show version | append flash:show_tech"
action 1.5 cli command "show run | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending goober output..."
action 1.8 mail server $_email_server to $_email_to from $_email_from subject "Goober Output" body "$_cli_result"
action 1.9 syslog msg "Goober output sent!"
EEM Applet:
event manager applet goober
event timer watchdog time 60
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show clock | append flash:show_tech"
action 1.4 cli command "show version | append flash:show_tech"
action 1.5 cli command "show run | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending goober output..."
action 1.8 mail server $_email_server to $_email_to from $_email_from subject "Goober Output" body "$_cli_result"
action 1.9 syslog msg "Goober output sent!"
Labels:
Cisco,
EEM,
IOS,
Network Management,
Programming,
Routing and Switching
EEM - Syslog Pattern Matching
The following example EEM applet trigger when the router generates the following configuration change syslog message:
%SYS-5-CONFIG_I: Configured from console by cisco on console
EEM Applet:
event manager applet foobar
event syslog pattern “.*%SYS-5-CONFIG_I.*”
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show ip route | append flash:show_tech"
action 1.4 cli command "show ip interface brief | append flash:show_tech"
action 1.5 cli command "more flash:show_tech"
action 1.6 syslog msg "Sending foobar output..."
action 1.7 mail server $_email_server to $_email_to from $_email_from subject "Foobar Output" body
"$_cli_result"
action 1.8 syslog msg "Foobar output sent!"
Verification:
router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Hit cntl-C to break out
*Sep 13 06:17:13.146: %SYS-5-CONFIG_I: Configured from console by cisco on console
*Sep 13 06:17:14.018: %HA_EM-6-LOG: sendtech: Sending foobar output...
*Sep 13 06:17:15.810: %HA_EM-6-LOG: sendtech: Foobar output sent!
%SYS-5-CONFIG_I: Configured from console by cisco on console
EEM Applet:
event manager applet foobar
event syslog pattern “.*%SYS-5-CONFIG_I.*”
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show ip route | append flash:show_tech"
action 1.4 cli command "show ip interface brief | append flash:show_tech"
action 1.5 cli command "more flash:show_tech"
action 1.6 syslog msg "Sending foobar output..."
action 1.7 mail server $_email_server to $_email_to from $_email_from subject "Foobar Output" body
"$_cli_result"
action 1.8 syslog msg "Foobar output sent!"
Verification:
router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Hit cntl-C to break out
*Sep 13 06:17:13.146: %SYS-5-CONFIG_I: Configured from console by cisco on console
*Sep 13 06:17:14.018: %HA_EM-6-LOG: sendtech: Sending foobar output...
*Sep 13 06:17:15.810: %HA_EM-6-LOG: sendtech: Foobar output sent!
Labels:
Cisco,
EEM,
IOS,
Network Management,
Programming,
Routing and Switching
EEM - Email the CLI output from router
This example shows how to quickly send the logs and configuration to TAC easily with EEM.
1. Configure the following required email related EEM environment variables:
event manager environment _email_server 1.2.3.4
event manager environment _email_from panda@pandaeatsbamboo.com
event manager environment _email_to attach@cisco.com
2. Configure the following EEM Applet named “sendtech”:
event manager applet sendtech
event none
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show tech | append flash:show_tech"
action 1.4 cli command "show ip route | append flash:show_tech"
action 1.5 cli command "show ip interface brief | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending show tech..."
action 1.8 mail server $_email_server to $_email_to from $_email_from subject " Show Tech Output (SR99999) " body "$_cli_result"
action 1.9 syslog msg "Show tech sent!"
Explanation of EEM Applet:
event manager applet sendtech ! registers applet with the name ‘sendtech’
event none ! specifies the event which will trigger this applet – in this case, the applet will be triggered manually
3. Verify that the EEM applet has been registered and that the environment variables have been set correctly:
R3#show event manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 applet user none Off Sat Mar 16 19:39:39 2002 sendtech
policyname {sendtech} sync {yes}
maxrun 20.000
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show tech | append flash:show_tech"
action 1.4 cli command "show ip route | append flash:show_tech"
action 1.5 cli command "show ip interface brief | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending show tech.."
action 1.8 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Show Tech Output (SR12345)" body "$_cli_result"
action 1.9 syslog msg "Show tech sent!"
R3#show event manager env all
No. Name Value
1 _email_server 1.2.3.4
2 _email_from panda@pandaeatsbamboo.com
3 _email_to attach@cisco.com
4. Manually trigger the script by issuing the command “event manager run sendtech”:
R3#event manager run sendtech
*May 19 20:16:46.440: %HA_EM-6-LOG: sendtech: Sending show tech...
*May 19 20:16:46.801: %HA_EM-6-LOG: sendtech: Show tech sent!
1. Configure the following required email related EEM environment variables:
event manager environment _email_server 1.2.3.4
event manager environment _email_from panda@pandaeatsbamboo.com
event manager environment _email_to attach@cisco.com
2. Configure the following EEM Applet named “sendtech”:
event manager applet sendtech
event none
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show tech | append flash:show_tech"
action 1.4 cli command "show ip route | append flash:show_tech"
action 1.5 cli command "show ip interface brief | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending show tech..."
action 1.8 mail server $_email_server to $_email_to from $_email_from subject " Show Tech Output (SR99999) " body "$_cli_result"
action 1.9 syslog msg "Show tech sent!"
Explanation of EEM Applet:
event manager applet sendtech ! registers applet with the name ‘sendtech’
event none ! specifies the event which will trigger this applet – in this case, the applet will be triggered manually
3. Verify that the EEM applet has been registered and that the environment variables have been set correctly:
R3#show event manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 applet user none Off Sat Mar 16 19:39:39 2002 sendtech
policyname {sendtech} sync {yes}
maxrun 20.000
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:show_tech"
action 1.3 cli command "show tech | append flash:show_tech"
action 1.4 cli command "show ip route | append flash:show_tech"
action 1.5 cli command "show ip interface brief | append flash:show_tech"
action 1.6 cli command "more flash:show_tech"
action 1.7 syslog msg "Sending show tech.."
action 1.8 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Show Tech Output (SR12345)" body "$_cli_result"
action 1.9 syslog msg "Show tech sent!"
R3#show event manager env all
No. Name Value
1 _email_server 1.2.3.4
2 _email_from panda@pandaeatsbamboo.com
3 _email_to attach@cisco.com
4. Manually trigger the script by issuing the command “event manager run sendtech”:
R3#event manager run sendtech
*May 19 20:16:46.440: %HA_EM-6-LOG: sendtech: Sending show tech...
*May 19 20:16:46.801: %HA_EM-6-LOG: sendtech: Show tech sent!
Labels:
Cisco,
EEM,
IOS,
Network Management,
Programming,
Routing and Switching
Thursday, February 7, 2008
Generate your MRTG config with ease
I've written a very simple shell script to generate the MRTG config in bulk. Enjoy!
#!/bin/sh
CFGMAKER=/usr/bin/cfgmaker
MRTG=/usr/bin/mrtg
for i in sw01 sw02 sw03 rt01 rt02 rt03
do
DEV=panda-$i
$CFGMAKER --global 'WorkDir: /home/mrtg' --global 'Options[_]: bits,growright' --show-op-down --ifref=descr --ifdesc=descr --output /home/mrtg/$DEV.cfg public@$DEV
$MRTG $DEV.cfg
done
#!/bin/sh
CFGMAKER=/usr/bin/cfgmaker
MRTG=/usr/bin/mrtg
for i in sw01 sw02 sw03 rt01 rt02 rt03
do
DEV=panda-$i
$CFGMAKER --global 'WorkDir: /home/mrtg' --global 'Options[_]: bits,growright' --show-op-down --ifref=descr --ifdesc=descr --output /home/mrtg/$DEV.cfg public@$DEV
$MRTG $DEV.cfg
done
Labels:
Linux,
MRTG,
Network Management,
Open Source,
Programming
Subscribe to:
Posts (Atom)

