Page 1 of 1

How can add new script to my server

Posted: Sun Jul 11, 2021 10:02 pm
by baber
I want use this check_uptime for my linux servers in the first step I copy the file in the /usr/local/nagios/libexec/ and change the permission to 755 then on the nagios server add this line

define service{
use local-service
host_name testapp
service_description Uptime
check_command check_nrpe!check_uptime!'-w 1 -c 5'
}

but it does not work . what is the problem ?

I am using this :

https://exchange.nagios.org/directory/P ... e2/details

Re: How can add new script to my server

Posted: Mon Jul 12, 2021 12:19 pm
by dkstuart23
On our system on the host, we have a line in the /etc/nrpe.d/base.cfg file as follows-
command[check_uptime]=/usr/lib64/nagios/plugins/check_uptime -c 5 -w 1

Then within the service config, we have it set to run the check as follows-
define service{
use local-service
host_name testapp
service_description Uptime
check_command check_nrpe!check_uptime
}

This should get you your required results.
HTH

Re: How can add new script to my server

Posted: Mon Jul 12, 2021 1:13 pm
by baber
dkstuart23 wrote:On our system on the host, we have a line in the /etc/nrpe.d/base.cfg file as follows-
command[check_uptime]=/usr/lib64/nagios/plugins/check_uptime -c 5 -w 1

Then within the service config, we have it set to run the check as follows-
define service{
use local-service
host_name testapp
service_description Uptime
check_command check_nrpe!check_uptime
}

This should get you your required results.
HTH

I added this in nrpe.cfg

command[check_uptime]=/usr/local/nagios/libexec/check_uptime1 -w $ARG1$ -c $ARG2$

and add this to server.cfg in nagios :

define service{
use local-service
host_name server
service_description Uptime
check_command check_nrpe!check_uptime!'-w 1 -c 3'
}

but it return Error: missing or illegal option value in nagios
although while run script in server that is ok :

[root@server ~]# /usr/local/nagios/libexec/check_uptime1 -w 1 -c 3
OK - uptime is 666 Days, 3 Hours, 03 Minutes

What is the problem ?

Re: How can add new script to my server

Posted: Tue Jul 13, 2021 9:20 am
by baber
Can anyone help me about it ?

Re: How can add new script to my server

Posted: Tue Jul 13, 2021 10:28 am
by gormank
Try changing the command definition to the following:
command[check_uptime]=/usr/local/nagios/libexec/check_uptime1 $ARG1$

Re: How can add new script to my server

Posted: Tue Jul 13, 2021 1:41 pm
by baber
gormank wrote:Try changing the command definition to the following:
command[check_uptime]=/usr/local/nagios/libexec/check_uptime1 $ARG1$

Thanks. Solved