Page 1 of 2

NRPE give error on web interface but CLI will return result

Posted: Tue Nov 17, 2015 9:52 am
by wleming
Hello everyone and thank you for your time.

My nagios core 4.1.1 server is running on Ubuntu 14.04 and was compiled from source.

Client I am trying to monitor is running Ubuntu 14.04 and the NRPE package was used.

I created a command to check the state of the chrome web browser in /etc/nagios/nrpe.cfg command

Code: Select all

[check_chrome]=/usr/lib/nagios/plugins/check_procs -C chrome
On the nagios server I can run

Code: Select all

 ./check_nrpe -H 10.0.4.44 -c check_ chrome 
and I get the return

Code: Select all

PROCS OK: 4 processes with command name 'chrome' | procs=4;;;0;
Which is exactly what I want-BUT on the web interface I get

Code: Select all

(Return code of 255 is out of bounds)
On the nagios server I have the service in the configuration files as

Code: Select all

 
define host {
        use                             linux-server
        host_name                       <NOT REAL NAME>
        alias                            Room 102
        address                         10.0.4.44
        hostgroups                      XXX
        max_check_attempts              5
        check_period                    24x7
        notification_interval           30
        notification_period             24x7
}



        define service{
        use                             local-service
        host_name                       <NOT REAL NAME>
        service_description             Check Chrome 
        check_command                   check_nrpe!check_chrome
        check_interval                  1
        }
So I am confused as to why I can use the check_nrpe on the CLI, but when I try via the web interface I get an error. Can someone please point me in the correct direction? Thank you again for your time.

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 10:02 am
by tgriep
Could you post how your check_nrpe command is defined in your commands.cfg file on your Nagios server?

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 10:57 am
by wleming
Yes, sorry for not including that.

Code: Select all

######### 'check_nrpe' command definition
define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTNAME$ -c $ARG1$
Thank you very much.

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 2:10 pm
by hsmith
Can you try to run the same command from the command line as the 'nagios' user? I am assuming you ran the first check as root?

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 5:06 pm
by wleming
I will investigate this. For now I have been running as an admin user that has root settings.

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 5:07 pm
by hsmith
Let us know what you come up with.

Thanks!

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 5:21 pm
by wleming
I don't have a set "nagios" user. I just compiled from source and made the "nagiosadmin" as in the instructions. Should I add this to the users of the system as well? Would this not create a possible security issue of having a user with "admin" rights?

Re: NRPE give error on web interface but CLI will return res

Posted: Tue Nov 17, 2015 5:22 pm
by hsmith
Can I see what instructions you used?

Re: NRPE give error on web interface but CLI will return res

Posted: Wed Nov 18, 2015 11:38 am
by wleming
These were the instructions that my co-worker used:

https://www.digitalocean.com/community/ ... untu-14-04

Re: NRPE give error on web interface but CLI will return res

Posted: Wed Nov 18, 2015 11:55 am
by hsmith
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-ubuntu-14-04 wrote: sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
What is the out put of a grep nag /etc/passwd command?