Page 1 of 1

problem with service template

Posted: Tue Sep 03, 2013 7:55 am
by kingston
Hi

I am a newbie to NAGIOS and completed the installation successfully on my linux boxes. But i couldnt monitor the remote host with the way i want. Facing some issues with the service templates it seems.
Here are the technical details.

OS Detail: RHEL 5.3 (Monitoring host and remote host)
Nagios Version: 3.5.0
Nagios Plugin: 1.4.16
NRPE: 2.14

I have created a separate cfg file under /usr/local/nagios/etc/objects with the following contents.

define host{
use generic-host
host_name honda
alias honda
address 10.18.36.33
max_check_attempts 3
}
define service{
use local-service
host_name honda
service_description SSH
check_command check_nrpe!check_ssh
}
If i change the "Use" directive in service definition to "generic-host" or "linux-server" or "my own template", Nagios is not able to monitor the remote host.

Nagios logs throws the following when i use different templates other than the local-service
[1378208382] Warning: Host 'honda' has no default contacts or contactgroups defined!
[1378208382] Warning: Host 'localhost' has no default contacts or contactgroups defined!
[1378208382] Finished daemonizing... (New PID=10536)
[1378208419] Warning: The check of service 'Current Load' on host 'localhost' looks like it was orphaned (results never came back). I'm scheduling an immediate check of the service...
[1378208449] Warning: Check result queue contained results for service 'SSH' on host 'honda', but the service could not be found! Perhaps you forgot to define the service in your config files?
Please help me.

Note: i turned off selinux, iptables and ip6tables on both the hosts and NRPE is running under XINETD

Regards

Kingston

Re: problem with service template

Posted: Tue Sep 03, 2013 10:54 am
by abrist
A few things.

1. Does your "generic-host" template include a contact?
2. Have you included your new config file in the nagios.cfg file?
3. Have you restarted nagios since making the config changes?

Re: problem with service template

Posted: Tue Sep 03, 2013 9:30 pm
by kingston
Hi

Thanks for your reply. First of all, as this is my first step to start configuring to monitor a remote host i didnt define any contact groups.
Next, yes i have included the config file of remote host in the nagios.cfg file and restarted the services nagios and xinetd. But problem persists.

Regards

Kingston

Re: problem with service template

Posted: Wed Sep 04, 2013 6:29 am
by kingston
Hi

Please find my answers
1. generic-host and generic-service templates are available in the template.cfg file
2. There is a separate cfg file added in the nagios.cfg file
3. Whenever i made a change, i always restart nagios as well xinetd services. Applicable here also.

I dont understand why nagios.log is throwing service not found error for my remote host. Strange.

Regards

Kingston S

Re: problem with service template

Posted: Wed Sep 04, 2013 10:45 am
by slansing
What exactly do you mean by you are not able to monitor the host in any way you want? What errors are you receiving on the service's details page in Nagios?

Also, can you show us your command definition of "check_nrpe" in commands.cfg? passing check_ssh through check_nrpe may not have the results you expect, especially if the handler is not set up on the remote host, or if you have no further arguments specified.

Re: problem with service template

Posted: Fri Sep 06, 2013 4:09 am
by kingston
Hi

I meant i couldn't use generic-service template and the linux-service template (what i created as i wish). Here are the details which could help you to help me. Please have a look

Check_nrpe command definition in /usr/local/nagios/etc/objects/commands.cfg file
# 'check_nrpe' command definition

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
Corresponding entry in client side nrpe.cfg file
command[check_ssh]=/usr/local/nagios/libexec/check_ssh -p 22 toyota
In addition, these commands are working fine when tested manually. Please see the results

From Monitoring host:
[root@toyota libexec]# ./check_nrpe -H honda -c check_ssh
SSH OK - OpenSSH_4.3 (protocol 2.0) | time=0.005848s;;;0.000000;10.000000
From, to be monitored client:
[root@honda etc]# /usr/local/nagios/libexec/check_ssh -p 22 toyota
SSH OK - OpenSSH_4.3 (protocol 2.0) | time=0.005860s;;;0.000000;10.000000
It was clear that either the services defined in the cfg file is not being recognized or template.cfg file is not getting read. But i am not sure.
Hope it helps

Regards

Kingston

Re: problem with service template

Posted: Fri Sep 06, 2013 10:24 am
by sreinhardt
Just to clarify, you are using nagios(toyota) to run a command via nrpe(honda) that checks ssh on the nagios server(toyota)? This is perfectly fine to do, I just want to be sure my understanding is correct. Also while your command definitions look great, and it is working correctly manually, I do not see any definitions in your services to run those commands. Are they in your template and if so could you post the templates as well please?

Re: problem with service template

Posted: Mon Sep 16, 2013 2:18 am
by kingston
Hi All

Apologies for this delayed update. My nagios started working after i comment the localhost.cfg line in the nagios.cfg file.
Now i started configuring the hostgroups and service groups. So far everything is going smooth.

Thank you all for your valuable time and support.

Regards

Kingston S