I need to get Nagios to process snmp traps that arrive on the same machine that is running Nagios. All the docs, and forum posts discuss performing this operation on multiple machines. I have tried to configure my server with nsca/send_nsca to work within itself. Is that the right way to go? If so, what do I need in submit_check_result. In this config, it seems to be used for 2 purposes. The first to submit trap data to Nagios, and the second to check for the trap data.
So far, I have been able to echo data into send_nsca and that appears in nagios.cmd.
If anyone is running Nagios this way, can you please post what you are using in checkcommands and the service definition?
I now have Nagios configured to submit passive checks w/o nsca since everything is on the same machine. Currently, snmptrapd will execute a specific script per OID.
/var/log/nagios/rw/nagios.cmd contains this after snmptrapd matches the oid:
[1141163054] PROCESS_SERVICE_CHECK_RESULT;fqhost.domain.com;w32_time;1;“W32Time Event”
That said, how do I get Nagios to check the command file? I don’t have any of the check commands mentioned in other posts. Is there a common check command that I should used in the service definition, or are we left to write our own?
Thanks for the info. I went through those and all the other docs that seemed relevant. I’ve got Nagios to notice the passive_check submission.
e.g. /var/log/nagios.log will show this when I submit a result
[1141332818] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;10.1.3.31;2;w32_time;W32Time Event
I can’t get it to send a notice out though. My service definition is as follows:
OK, so now I gather that the check is working, and that it simply is not sending out notifications.
You MUST clik the link and disable/enable notifications for each service check that you want notifications enabled.
The reason is explained here: nagios.sourceforge.net/docs/2_0/ … tion_notes
The output return code is 1, warning, and your notification_options is set to c,r
Therefor, you won’t get notifications for any warnings due to your setting of c,r
Since the first post, I have been sending message through as 2. This is what shows up in nagios.log
[1141402904] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;host.fqdn.com;2;w32_time;W32Time Event
Of course, the host.fqdn.com matches a specific host. Other notifications for that host do get sent. Any other ideas? I think it’s pretty close, and I really need to get this working.
nagios.org/developerinfo/ext … and_id=114
PROCESS_SERVICE_CHECK_RESULT must have the following format:
PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<return_code>;<plugin_output>
Now, lets plug in your values and see if it fits.
PROCESS_SERVICE_CHECK_RESULT;host.fqdn.com;2;w32_time;W32Time Event
So, you have:
<host_name> = host.fqdn.com
<service_description> = 2
<return_code> = w32_time
and so on. Somehow, that just doesn’t look right to me. nagios.org/developerinfo/ext … ndlist.php
In order for a notification, there must be a host named host.domain.com
and a service for that host named;
w32_time
Check the spelling again.
Are you using mysql for nagios?
According to your earlier post, you have a host name of:
servername
and a service description for that host of:
Trap
So I don’t see how you can get a notification until you define the host and service.
That did it. Works great now! The names and descriptions I was giving in previous posts were just examples, but your comment about spelling maybe me realize that hosts.cfg didn’t have the fqdn of the server, just the host name. Another example of focusing on the difficult and obscure instead of the simple and obvious. Thanks a lot for your help.
Great that you got this all working. Have you tried looking at SNMPTT? I use this between snmptrapd and nagios to format the trap for the nagios command file. This bit of snmptt config reacts to linkdown traps that are not caused by being put admin down, and sends to nagios.