Help required to configure SNMP TRAP for Cisco Routers

Steve Dussaux stevox2000 at yahoo.com
Fri Apr 11 14:42:03 CEST 2003


To get Cisco traps you have to look at the MIBs file corresponding to your Cisco routers.
I can't give you traps OIDs because i don't monitor Cisco routers, LMS is doing this stuff:)
In my configuration i gave to you, i have the SNMP traps collector and the Nagios server on the
same box.
This is where you specify SNMP traps collector  : /usr/local/nagios/bin/./send_nsca -H localhost.
To setup traps i've used the following diagram :

Get traps from vendor MIBs (i.e. Cisco) -> add traps definition in snmptrapd.conf -> build the
script that handles traps -> build the script that sends passive checks to Nagios (i.e. traps
result) -> restart snmptrapd

And don't forget to add a passive service for traps :
define service {
host_name			UOF35
service_description             Trap_test
is_volatile                     1
active_checks_enabled           0
passive_checks_enabled          1
max_check_attempts              1
contact_groups                  nagios-admins
notification_interval           120
notification_period             24x7
notification_options            w,u,c,r
check_period			24x7
normal_check_interval		2
retry_check_interval		1
check_command                   check_none
}

with check_none a dummy command that does nothing :

define command {
command_name check_none
command_line echo
}

It's a bit of pain to configure but it works :),
Steve


 --- Atul Shrivastava <atulsh at hclinsys.com> a écrit : > Hello,
> 
> Can you tell me how can I know that what all traps need to be configured for cisco routers. Or
> you can tell me from where I can get the traps info. Also is it possible to have both SNMP
> Collector and nagios on the same box. I think that you are using NCSA for this all. Can you tell
> me the logical diagram for your setup so that I will not do any mistake for my setup. Thanks for
> your mail.
> 
> Regards and have a nice day,
>                            Atul Shrivastava
>                            Info Structure Services
>                            HCL INFOSYSTEMS LTD.
>                            E - 4,5,6 Sector XI,
>                            Noida - 201301
>                            Tel: 91-120-2526910,2443013
> 
> --------------------------------------------------------------------------------
> 
> 
> 
> ----- Original Message ----- 
> From: "Steve Dussaux" <stevox2000 at yahoo.com>
> To: "Atul Shrivastava" <atulsh at hclinsys.com>
> Sent: Friday, April 11, 2003 3:41 PM
> Subject: Re: [Nagios-users] Help required to configure SNMP TRAP for Cisco Routers
> 
> 
> > Here is my config to support LOTUS Notes Traps.
> > To enable your Cisco Traps you have to modify :
> > 
> > - snmptrapd.conf to the appropriates cisco traps
> > - trap handling script to support your hosts and to manage Nagios STATES
> > 
> > snmptrapd.conf :
> > ###NOTES TRAPS
> > traphandle NOTES-MIB::lnServerUpTrap /usr/local/nagios/etc/snmp-traps/traps 11
> > traphandle NOTES-MIB::lnServerDownTrap /usr/local/nagios/etc/snmp-traps/traps 12
> > traphandle NOTES-MIB::lnServerPulseFailedTrap /usr/local/nagios/etc/snmp-traps/traps 13
> > traphandle NOTES-MIB::lnServerPulseRestoredTrap /usr/local/nagios/etc/snmp-traps/traps 14
> > traphandle NOTES-MIB::lnSystemRebootingTrap /usr/local/nagios/etc/snmp-traps/traps 15
> > traphandle NOTES-MIB::lnServerNotRespondingTrap /usr/local/nagios/etc/snmp-traps/traps 16
> > traphandle NOTES-MIB::lnServerNowRespondingTrap /usr/local/nagios/etc/snmp-traps/traps 17
> > ##########################################################################################
> > 
> > my traps handle script (traps) :
> > #!/bin/sh
> > 
> >    # First line passed from snmptrapd is FQDN of host that sent the trap
> >      read hostname
> > 
> >      case $hostname in
> > 
> > "nagios.toto.com")
> >     hostname="UOF35"
> >     ;;
> >      esac
> > 
> >         
> >     # Get severity level (OK, WARNING, UNKNOWN, or CRITICAL) and plugin output based on trape
> type
> >     state=-1
> >     output="No output"
> >     case "$1" in
> > 
> > ############################################
> > #Notes TRAPS
> > 
> > 11)
> >     output="Notes server is up"
> >     state=0
> >     ;;
> > 
> >         12)
> >     output="Notes server is down"
> >     state=2
> >     ;;
> > 
> > 13)
> >     output="Notes server is busy"
> >     state=1
> >     ;;
> > 
> > 14)
> >     output="Notes server is up"
> >     state=0
> >     ;;
> > 
> > 15)
> >     output="Notes server is rebooting"
> >     state=3
> >     ;;
> > 
> > 16)
> >     output="Notes server is not responding"
> >     state=2
> >     ;;
> > 
> > 17)
> >     output="Notes server is up"
> >     state=0
> >     ;;     
> >     esac
> > 
> > 
> >     # Submit passive check result to monitoring host
> >     /usr/local/nagios/libexec/eventhandlers/submit_check_result $hostname "Trap_test" $state
> > "$output"
> > exit 0
> > 
> > 
> > And to finish the script that submit passive checks to nagios (submit_check_result) :
> > #!/bin/sh
> > 
> > # Arguments
> > #       $1 = name of host in service definition
> > #       $2 = name/description of service in service definition
> > #       $3 = return code
> > #       $4 = output
> > 
> > /bin/echo -e "$1\t$2\t$3\t$4\n" |  -c
> > /usr/local/nagios/etc/send_nsca.cfg
> > 
> > 
> > Hope this help,
> > Steve
> > 
> >  --- Atul Shrivastava <atulsh at hclinsys.com> a écrit : > Hello,
> > > 
> > > I have configured my cisco routers to send SNMP TRAPs to my nagios box. But I am unable to
> > > collect and process these Traps. I have gone through all the documentation of nagios but I
> am
> > > not be able to get through. Can anyone send me a document to configure this. My requirement
> is
> > > that I want both the SNMP TRAP collector and the nagios dameon on the same box. Thanks in
> > > advance.
> > > 
> > > Regards and have a nice day,
> > >                            Atul Shrivastava
> > >                            Info Structure Services
> > >                            HCL INFOSYSTEMS LTD.
> > >                            E - 4,5,6 Sector XI,
> > >                            Noida - 201301
> > >                            Tel: 91-120-2526910,2443013
> > > 
> > >  
> > 
> > ___________________________________________________________
> > Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> > Yahoo! Mail : http://fr.mail.yahoo.com 

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list