How install a new plugin
How install a new plugin
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$
}
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$
}
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How install a new plugin
First mark the file executable
then change your command to
Code: Select all
chmod +x /usr/local/nagios/libexec/check_all_fs.sh
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
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
In linux.cfg
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$
}
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
}
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How install a new plugin
Where is the file check_all_fs.sh located?
Re: How install a new plugin
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How install a new plugin
Where does $USER1$ point to in the resources.cfg in your installation?
Re: How install a new plugin
Code: Select all
$USER1$=/usr/local/nagios/libexec
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How install a new plugin
That's strange, and you were able to run this from the command line successfully to test it?
Can you also show the results of the following
Code: Select all
su nagios
/usr/local/nagios/libexec/check_all_fs.sh -w 90 -c 95
Code: Select all
ps -ef|grep nagios.cfg
Re: How install a new plugin
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#
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How install a new plugin
I believe you have Windows line endings in the plugin
Lets run the following
then try running the plugin again
Lets run the following
Code: Select all
sed -i 's/\r//g' /usr/local/nagios/libexec/check_all_fs.sh