Can't get correctly information about service

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
matisse
Posts: 30
Joined: Wed Aug 31, 2016 4:33 pm

Can't get correctly information about service

Post by matisse »

Hello,
I tried get information with help default plugin "check_procs" on local server. But in web interface i can see UNKNOWN Status.
There are my settings:
In server.cfg

Code: Select all

define service{
        use                             local-service         ; Name of service template to use
        notification_interval		0
        hostgroup_name                  Servers
        service_description             Total Processes
	check_command			check_procs
}
In nrpe.cfg

Code: Select all

command[check_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
In command.cfg

Code: Select all

define command{
        command_name    check_procs
        command_line    $USER1$/check_procs -H $HOSTADDRESS$ -w 500 -c 300
        }
What the problem? If i runing command - ./libexec/check_nrpe -H localhost -c check_procs, it work correctly.
Thanks!
Attachments
Capture 2017-05-03 at 15.01.05.png
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Can't get correctly information about service

Post by tgriep »

The check_procs command only runs on the local system and the -H $HOSTADDRESS$ option is not needed in the command definition and that is causing the error.
Edit your check_procs command and change the command_line from

Code: Select all

command_line    $USER1$/check_procs -H $HOSTADDRESS$ -w 500 -c 300
to

Code: Select all

command_line    $USER1$/check_procs -w 500 -c 300
Save the settings and restart nagios and that should fix it for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
matisse
Posts: 30
Joined: Wed Aug 31, 2016 4:33 pm

Re: Can't get correctly information about service

Post by matisse »

Thanks, it is works. But if i need to check other servers with this plugin i must edit nrpe.cfg for it?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Can't get correctly information about service

Post by ssax »

By default it should be in your /usr/local/nagios/etc/nrpe/common.cfg on the remote server:

Code: Select all

command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$
If you do not have that file on the remote server you can just define it in your nrpe.cfg file (if it isn't already).

Then to test, just run this from the XI server:
- Change X.X.X.X to the remote address

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H X.X.X.X -c check_procs -a '-w 500 -c 300'
Thank you
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Can't get correctly information about service

Post by tgriep »

As long as the check_procs command is defined in the nrpe.cfg file like your example below and the plugin is installed on the remote server, you should be alright.

Code: Select all

command[check_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
Now this service definition

Code: Select all

define service{
        use                             local-service         ; Name of service template to use
        notification_interval      0
        hostgroup_name                  Servers
        service_description             Total Processes
   check_command         check_procs
}
With this command

Code: Select all

define command{
        command_name    check_procs
        command_line    $USER1$/check_procs -w 500 -c 300
}
Will only run the check_procs plugin on the local nagios server.

To get it to run on a remote server using NRPE you would define a check_nrpe command like the example below

Code: Select all

define command {
       command_name                             check_nrpe
       command_line                             $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$
}
And the service check would look like this for example

Code: Select all

define service {
        host_name                       192.168.1.1
        service_description             Total Processes   
        use                             generic-service
        check_command                   check_nrpe!check_procs
}
That service check uses the check_nrpe command to run the check_procs command on the remote host 192.168.1.1 returning the number of processes running.
Be sure to check out our Knowledgebase for helpful articles and solutions!
matisse
Posts: 30
Joined: Wed Aug 31, 2016 4:33 pm

Re: Can't get correctly information about service

Post by matisse »

Thanks for help! It's works.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Can't get correctly information about service

Post by tgriep »

Your welcome. If you don't have any other questions, shall I close and lock the post as solved?
Be sure to check out our Knowledgebase for helpful articles and solutions!
matisse
Posts: 30
Joined: Wed Aug 31, 2016 4:33 pm

Re: Can't get correctly information about service

Post by matisse »

Yes :)
Locked