Page 1 of 1

Sending and receiving a test trap

Posted: Tue Feb 12, 2013 1:50 pm
by thennessey
How can I send a test trap from a windows machine and verify on Nagios that it was received?

I have run tcpdump and saw when I stopped and started the snmp service on the windows machine that nagios received traps about that. Does that mean everything is working?

How can I simulate something going wrong on the windows server and get nagios to notify me from the trap and not just from nagios doing it's regularly scheduled monitoring? And how do I know it resulted from the trap and not monitoring?

thanks

Re: Sending and receiving a test trap

Posted: Tue Feb 12, 2013 2:02 pm
by sreinhardt
Have you taken a look at Implimenting Snmp Traps in Nagios XI

Re: Sending and receiving a test trap

Posted: Tue Feb 12, 2013 2:19 pm
by thennessey
Yes many times. I changed the "Normal" to "Critical" for all events in the snmptt.conf file, and then stopped snmp on the windows server. All that happened was the traps service for all my devices in Nagios said "pending."

I read some other guide that said if you turn off snmp on the windows server and then wait for the services in nagios to come back with failures, then turn snmp back on....the windows server will send out a trap and you will see that in nagios before the other services return to normal. I didn't see anything like that.

So how do I make the server send out a trap that will be received by nagios and notify me something is wrong? Or at least show me something in the nagios gui?

Re: Sending and receiving a test trap

Posted: Tue Feb 12, 2013 3:34 pm
by lmiltchev
I found this link - I hope it will help you set up traps on the windows machine. On the nagios site - did you run the SNMP Trap Monitoring Wizard against your windows box?

Re: Sending and receiving a test trap

Posted: Tue Feb 12, 2013 5:50 pm
by thennessey
This looks like it might work. I set windows to send a trap whenever a service is started or stopped. I see net-snmp is already installed on Nagios and I can run it. The guide doesn't have much info on what commands I use for snmptrap. Can you help me with this. The help file is pretty hard to understand. Thanks!

Re: Sending and receiving a test trap

Posted: Wed Feb 13, 2013 12:40 pm
by abrist
Microsoft has some documentation on sending traps from a windows system:
http://technet.microsoft.com/en-us/libr ... 06050.aspx

In XI, you configure the traps through the wizard. What part of the guide are you having problems with?

Re: Sending and receiving a test trap

Posted: Wed Feb 13, 2013 1:51 pm
by thennessey
I've configured traps through the wizard. The traps services is running on all my hosts in Nagios. It says "waiting for traps".

Per the previous guide in this thread, I set one of my windows hosts to send a trap whenever a service is started or stopped. However, when I start or stop a service, nothing shows up in Nagios. A trap should be sent to Nagios and I should be able to see it there. Where? Shouldn't I get a note, warning, alert, or something from the nagios trap service?

I tried using the snmptrap or snmptrapd utility in Nagios command line but I can't get it to work. Can you give me an example command to use snmptrap to monitor for incoming traps?

snmptrap -v 1 -c communitystring enterprise-oid? agent? (is this the agent to listen for or can I listen for all?) trap type? specific type uptime? OID-type-value? Can I listen for all incoming OID's?

Thanks

Re: Sending and receiving a test trap

Posted: Wed Feb 13, 2013 4:05 pm
by scottwilkerson
In the Implimenting Snmp Traps in Nagios XI guide page 6 & 7 show how to test the traps.

Also, can you run the following:

Code: Select all

ll /var/log/snmptt/

Re: Sending and receiving a test trap

Posted: Wed Feb 13, 2013 5:43 pm
by thennessey
How do I change the nagios community string if I don't want to use public? I assume it's in snmpd.conf somewhere.

Can I just change "public" to the string I want in this code?

# First, map the community name "public" into a "security name"

# sec.name source community
com2sec notConfigUser default public

Is anything else needed to change the community string besides that, and maybe verifying config and restart?

Re: Sending and receiving a test trap

Posted: Thu Feb 14, 2013 2:43 pm
by scottwilkerson