Page 1 of 2
How install a new plugin
Posted: Tue Oct 22, 2019 4:54 am
by afigles
Hello,
I am a new admin nagios, I have download this check
https://exchange.nagios.org/directory/P ... em/details Its a .sh file but my problem is, How install/load the .sh file? I have copied the .sf file in /usr/local/nagios/libexec/, what will be the next steps??
In commands.cfg should write the following no??
# 'check_all_fs' command definition
define command{
command_name check_all_fs
command_line $USER1$/check_all_fs -w $ARG1$ -c $ARG2$
}
Re: How install a new plugin
Posted: Tue Oct 22, 2019 6:25 am
by scottwilkerson
First mark the file executable
Code: Select all
chmod +x /usr/local/nagios/libexec/check_all_fs.sh
then change your command to
Code: Select all
# 'check_all_fs' command definition
define command{
command_name check_all_fs
command_line $USER1$/check_all_fs.sh -w $ARG1$ -c $ARG2$
}
Re: How install a new plugin
Posted: Tue Oct 22, 2019 9:36 am
by afigles
I got this error in the console:
stderr: execvp(/usr/local/nagios/libexec/check_all_fs.sh, ...) failed. errno is 2: No such file or directory
The config:
In commands.cfg
Code: Select all
# 'check_all_fs' command definition
define command{
command_name check_all_fs
command_line $USER1$/check_all_fs.sh -w $ARG1$ -c $ARG2$
}
In linux.cfg
Code: Select all
define service{
use local-service ; Name of service template to use
host_name localhost
hostgroup_name linux-servers
service_description FS
check_command check_all_fs!90!95
notifications_enabled 0
}
Re: How install a new plugin
Posted: Tue Oct 22, 2019 9:49 am
by scottwilkerson
Where is the file check_all_fs.sh located?
Re: How install a new plugin
Posted: Tue Oct 22, 2019 9:54 am
by afigles
Code: Select all
root@rdxnagios:/usr/local/nagios/libexec# ls -l
total 10324
-rwxr-xr-x 1 root nagios 4353 Oct 22 11:17 check_all_fs.sh
In /usr/local/nagios/libexec
Re: How install a new plugin
Posted: Tue Oct 22, 2019 9:55 am
by scottwilkerson
Where does $USER1$ point to in the resources.cfg in your installation?
Re: How install a new plugin
Posted: Tue Oct 22, 2019 9:59 am
by afigles
Re: How install a new plugin
Posted: Tue Oct 22, 2019 10:02 am
by scottwilkerson
That's strange, and you were able to run this from the command line successfully to test it?
Code: Select all
su nagios
/usr/local/nagios/libexec/check_all_fs.sh -w 90 -c 95
Can you also show the results of the following
Re: How install a new plugin
Posted: Tue Oct 22, 2019 10:10 am
by afigles
Code: Select all
root@rdxnagios:/usr/local/nagios/etc# su nagios
$ /usr/local/nagios/libexec/check_all_fs.sh -w 90 -c 95
sh: 1: /usr/local/nagios/libexec/check_all_fs.sh: not found
$ /usr/local/nagios/libexec/check_all_fs.sh -w 90 -c 95
sh: 2: /usr/local/nagios/libexec/check_all_fs.sh: not found
$ exit
root@rdxnagios:/usr/local/nagios/etc# /usr/local/nagios/libexec/check_all_fs.sh -w 90 -c 95
bash: /usr/local/nagios/libexec/check_all_fs.sh: /bin/sh^M: bad interpreter: No such file or directory
root@rdxnagios:/usr/local/nagios/etc# ps -ef|grep nagios.cfg
nagios 12412 1 0 16:33 ? 00:00:02 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 12417 12412 0 16:33 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root 17579 34599 0 17:10 pts/0 00:00:00 grep nagios.cfg
root@rdxnagios:/usr/local/nagios/etc#
Re: How install a new plugin
Posted: Tue Oct 22, 2019 10:24 am
by scottwilkerson
I believe you have Windows line endings in the plugin
Lets run the following
Code: Select all
sed -i 's/\r//g' /usr/local/nagios/libexec/check_all_fs.sh
then try running the plugin again