Page 1 of 1

NSCA submit_check not exe

Posted: Wed Jan 23, 2013 10:25 am
by makgab
Hi!

I configured the nagios with nsca, in CentOS 6.3 (x64).
On the slave (nsca-client):

Code: Select all

obsess_over_services=1
ocsp_command=submit_service_check
ocsp_timeout=5 
 
# /etc/nagios/conf.d/commands.cfg
define command {
     command_name    submit_service_check
     command_line    $USER1$/submit_service_check.sh $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATEID$ '$SERVICEOUTPUT$'
     # $USER1$ -> /usr/lib64/nagios/plugins/
}
 
define service{ 
     name                            generic-service2;
     active_checks_enabled           1       ; 
     passive_checks_enabled          1       ; 
     parallelize_check               1       ; 
     obsess_over_service             1       ; 
     check_freshness                 0       ; 
     notifications_enabled           0       ; 
     event_handler_enabled           1       ; 
     flap_detection_enabled          1       ; 
     process_perf_data               1       ; 
     register                0       ;
 }

# Service definition for http
define service{ 
	use				generic-service2;
	host_name			host1;
	service_description 		HTTP;
	is_volatile 			0;
	check_period 			24x7;
	max_check_attempts 		3;
	normal_check_interval 		1;
	retry_check_interval 		5;
	# contact_groups		admins,webmaster;
	notification_options 		w,u,c,r;
	notification_interval 		960;
	# notification_period 		never;
	notification_period 		24x7;
	check_command 			check_http;
}

define host {
     use		linux-server;
     host_name	host1;
     address	10.10.10.90;
} 
 
The /usr/lib64/nagios/plugins/submit_service_check.sh:
#!/bin/bash
/usr/bin/printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$3" "$4" | /usr/lib64/nagios/plugins/send_nsca -H 10.10.10.116  -c /etc/nagios/send_nsca.cfg

If I run the submit_service_check.sh with manually, then it send the data to the master (nsca server, IP: 10.10.10.116). So it is ok.
But the slave nagios doesn't send automatically the check results.
Why? What is missing? What settings need to be set for auto submit check results?


G.

Re: NSCA submit_chek not exe

Posted: Wed Jan 23, 2013 10:28 am
by slansing
The following quote is from:

http://nagios.sourceforge.net/download/ ... _Setup.pdf
Problems
If you are not getting alerts, check the following:
1) Make sure the hostname defined in Nagios EXACTLY matches the hostname defined in your
packet sent INCLUDING upper/lower case.
2) Make sure the service description used in the packet sent EXACTLY matches the Nagios service
description, including case, embedded spaces, etc.
3) Check the NSCA log (syslog?) to make sure that the messages are being received by NSCA.
4) Check the nagios.log file to make sure they are being processed by Nagios. Have you enabled the
external command file?
5) Check the nagios.log file. Are the NSCA messages being ignored because you have the wrong
hostname or service description?
6) Check your filewall settings to allow 5667 (or other port as used)
7) If you have installed under xinetd, make sure you specify the IP address you are listening for, or
remove the “only_from” line in your xinetd’s nsca script.
NOTE: Please go through each of these individually, it is quite a checklist but covers anything that I have personally ran into.

Re: NSCA submit_check not exe

Posted: Wed Jan 23, 2013 2:49 pm
by makgab
It is working! :)
I set the debug level at -1. The nagios couldn't open the send_nsca.cfg, because its permission was incorrect (rw- --- ---). I fixed it.

Thanx!

G.