NSCA only works once and only after a NSCA daemon restart


#1

I have no doubt that I’m missing something obvious but I can’t see it. Here’s what’s happening:
I’m trying to get NSCA working. I installed it and am running it as a daemon. That seems to be working. Then, as a test, I setup some “dummy” services with passive checks turned on. This also seems to work because I was able to test by echoing commands directly into the nagios command file.

Then, as a test, I tried using send_nsca to change the status of the passive service. For the record, I did this on the same host as the NSCA daemon; I’m just testing at this point and didn’t have a remote server readily available. Anyway, I was able to successfully update the status of my passive service via send_nsca.

However, it only worked once. The only way I’ve been able to successfuly use send_nsca it to restart the nsca daemon. Then, send_nsca works once. Any subsequent attempts times out (Error: Timeout after 10 seconds).

OK, guys, what am I missing? My gut tells me it’s something stupidly obvious… but I just can’t find it. So far, nothing in the logs reveals anything to me (I have debug set to 1).

Any ideas?


#2

How about turning off your firewall. I have no other clue.


#3

Hmmm…
I had already turned off the firewall.

I’ve tried changing flap detection and that didn’t seem to work.
Ive also tried changing “is_volatile” and that didn’t work.
(I’m starting to grasp for straws)

I’m going to let this one rattle around in my head for a while.


#4

Ahh, did you add your IP to the /etc/xinetd.d/nsca file?
I would add both localhost and xx.xx.xx.xx or whatever your ip is.

only_from = localhost xx.xx.xx.xx


#5

I didn’t, but should I if I’m running it (nsca) as a daemon?


#6

What’s stumping me is the fact that it actually works once, but only after I restart the nsca daemon.


#7

Per the readme:
NOTE: If you run nsca under inetd or xinetd, the server_port
and allowed_hosts variables in the nrpe configuration file are
ignored.
So, if you aren’t using either, then add the entries to the config file.


#8

I’ll try running it under xinetd and see if that makes a difference. Otherwise, I may start digging into the source.


#9

I run nsca on about 10 other machines, Solaris and CentOS mostly. Have not had any trouble. But then, I’m not trying to connect to the daemon from the same machine either.


#10

…here’s a different approach that may help you troubleshoot it:

if you can, try running the nsca server interactively (i.e. not as a daemon) and include 2>&1 at the end of the command line to see both stdout and stderr, then try your test again and see if it gives you any other clue

if it stops after completing the first service check, maybe it is crashing (segfault w/coredump) for some reason; testing it this way may help you determine why


#11

sambahat!
did you find any solution to your problem?
i’m having exact the same problem, but i’m not that god at programming that i can dig into the source…
what distrubution are you running your nsca client under?
thanks


#12

Hey dalnyn,
I haven’t had too much time to work on it, but will probably be able to do something with it by the end of this week. I have made better progress, however, by running nsca under xinted instead of as a daemon. Once I figure it out, I’ll be sure to post my findings.


#13

I don’t exactly know if it’s possible, but if the command_line option in the file containing the check commands is used, would it be possible to simply add “init.d/nsca-2.6 restart” there.

When I tried it noting happend, I think it was because the command_line never gets used when nagios only recieves passive checks. Am I right?

Is there any other place the restart command could be added to make nsca restart every time something is sent to it? If it is, it would be a simple way to solve the problem.


#14

My apologies for taking so long to reply. It looks like the only way to get this to work is to run it under inetd/xinetd. It appears that running it as a daemon is really running it as debug mode.
It works perfectly under inetd/xinetd.