How can add new script to my server

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
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

How can add new script to my server

Post 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
dkstuart23
Posts: 8
Joined: Thu Feb 18, 2021 2:42 pm

Re: How can add new script to my server

Post 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
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: How can add new script to my server

Post 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 ?
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: How can add new script to my server

Post by baber »

Can anyone help me about it ?
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: How can add new script to my server

Post by gormank »

Try changing the command definition to the following:
command[check_uptime]=/usr/local/nagios/libexec/check_uptime1 $ARG1$
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: How can add new script to my server

Post by baber »

gormank wrote:Try changing the command definition to the following:
command[check_uptime]=/usr/local/nagios/libexec/check_uptime1 $ARG1$

Thanks. Solved
Locked