How to make nagios restart nsca?


#1

I’m currently running nsca under inetd and everything works just fine, but only once. when nsca has recieved it’s first service result, it stops checking for more.

when trying nsca I have sent results fron the localhost with the command:

echo “nagios:testmessage:0:test” | /app/nsca/2.6/sbin/send_nsca -H localhost -d : -c /app/nsca/2.6/etc/send_nsca.cfg

This works and the result is passed to nagios where it shows up.
The next time i send the command i get:

Error: Timeout after 10 seconds

Because it works the first time I don’t think it’s a permisson issue.

I don’t know why this happends, but because I’m not able to fix it and nobody seems to have a solution I’m going to try to work around the problem.

How about a solution where nagios restarts nsca every time i recieves a service result.
I don’t know if it’s possible to do it the way I’m trying to in the example below. Maybe the command is’nt used when nagios only uses passive checks.
Anyone who got any ideas how to make this work or maybe another solution for my problem?

#########################
#services.cfg #
#########################
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
register 0
}

define service{
use generic-service
name passive_service
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
register 0
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
check_freshness 0
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
stalking_options w,c,u
}

define service{
use passive_service
service_description testmessage
host_name nagios,windows
check_command restart_nsca
contact_groups test-admins
}

#########################
#checkcommands.cfg #
#########################

define command{
command_name restart_nsca
command_line /app/init.d/nsca-2.6 restart
}


#2

Good luck, but fixing it like this is NOT fixing it.
I’d try to install it to run under xinetd, before I would let 2000 passive service checks, restart my nsca daemon every 5 minutes. That’s not even a fix, it’s more like a …dunno, but it isn’t something you should bother with.