I’m having a weird problem that I’ve spent days trying to debug. I have what seems to be the correct configuration for nagios and the nsca plugin. The active checks all run fine and the nsca plugin can accept passive checks fine also…partially though.
This is where the problem is. I’m running the nsca plugin as a daemon (using /opt/nagios/bin/nsca -c /opt/nagios/etc/nsca.cfg command). The first time I start the daemon I’m able to use send_nsca to properly send a message to the nsca daemon.
I get this in the messages log:
May 15 14:10:56 SERVERNAME nsca: [ID 601491 daemon.notice] Starting up daemon
May 15 14:11:11 SERVERNAME nsca: [ID 691272 daemon.notice] SERVICE CHECK -> Host Name: ‘SERVERNAME’, Service Description: ‘TestMessage’, Return Code: ‘2’, Output: ‘KA-BOOM!’
May 15 14:11:11 SERVERNAME nsca: [ID 862360 daemon.error] End of connection…
The moment I try to send another message using send_nsca it times out. Nothing gets logged in the messages syslog. The only way I’m able to resend a message is by killing the process id of the daemon and restarting it, which once again only allows me to send that one initial message.
Only thing I was able to debug further is that after the initial successful message, using netstat | grep 5700 (port used), I still have a connection open
SERVERNAME.47142 SERVERNAME.5700 65440 0 73620 0 TIME_WAIT
which later changes to CLOSE_WAIT
using netstat -an I also find that it’s still trying to listen on that port
*.5700 *.* 0 0 64240 0 LISTEN
IPADDRESS.47142 IPADDRESS.5700 65440 0 73620 0 TIME_WAIT
This is where I’m stuck. I can’t figure out what the problem is here, there are no errors output.
Any help would be great. Thank you!