Page 2 of 2

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 4:16 pm
by SledWrecker
Excellent! I knew it was likely something trivial and easy to overlook. I'll make my changes now and report back. Thank you :D

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 4:19 pm
by slansing
Great! Let us know. :)

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 4:44 pm
by SledWrecker
Ok I made the changes outlined and removed the "local" from the remote host services.cfg.

When I attempted to restart the nagios service it failed stating it couldn't find all the check_xxxx commands for each of the defined remote machines.

I then went into commands.cfg and added these below as they were all defined as check_local_xxxx only. I left the check_local varients intact at the top of the file.

Code: Select all

################################################################################
#
# Remote Service Commands
#
################################################################################

# 'check_disk' command definition
define command{
        command_name    check_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }


# 'check_load' command definition
define command{
        command_name    check_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }


# 'check_procs' command definition
define command{
        command_name    check_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }


# 'check_users' command definition
define command{
        command_name    check_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }

Then I was able to successfully stop and restart the nagios service without errors.

Unfortunetly, it still looks like I am getting metrics from localhost only. Now I'm stumped.

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 4:54 pm
by abrist
Well, I failed to mention another piece to this puzzle - agents. You need to use an agent to check the remote systems - nrpe for linux and nsclient for windows are the norm. You will need to install nrpe and the plugins (linux/unix) onto the remote host and then configure a new command for check_nrpe. You then need to edit the remote host's nrpe.cfg to include the necessary command definitions.
Here is a LARGE doc on nrpe:
http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
And the online docs for nsclient:
http://www.nsclient.org/nscp/wiki/doc/usage/nagios

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 4:58 pm
by SledWrecker
Yup, I've done all that and I can run a check_user command manually and pull a value over with NRPE. That mechanism is in place on just a couple remote machines at the moment, I wanted to get one or two working before doing a full site wide deployment.

So with that said I edited my nagios.cfg and commented out localhost.cfg. Now it's pulling the right metrics. So for some reason when localhost.cfg is enabled to be included it is competing with the values defined in my hosts.cfg. I haven't been able to locate where the connection is, I'm parsing all the files now.

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 5:34 pm
by abrist
I would presume that the localhost.cfg includes duplicate command definitions for check_disk, etc. Comment out those duplicates. You are welcome to post the 2 config files and I will take a look.

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 5:36 pm
by SledWrecker
Progress. After reading through the doc some more and finding another example online I found that for my service definitions if I add check_nrpe! as a prefix to check_xxxx it is now pulling the correct values. Now I just need to find the NRPE command for check_procs as that is failing.

Re: Nagios reporting same results for all hosts

Posted: Tue Feb 04, 2014 5:41 pm
by abrist
What error is it failing with? You may not have that command defined in nrpe.cfg on your remote hosts.