Is there a "how to" for adding and configuring a plugin to Nagios? (for Ubuntu 14.04 specifically, but any Linux OS would be helpful.)
I've been able to cobble this much so far:
- Place the script in /usr/local/nagios/libexec/. (In my case there was already a script I wanted to use: "check_file_age".)
- Edit /usr/local/nagios/etc/objects/commands.cfg to add the plugin.
define command{
command_name check_file_age
command_line $USER1$/check_file_age -w $ARG1$ -c $ARG2$ -W $ARG3$ -C $ARG4$ -f $ARG5$
}
- Define the plugin in /usr/local/nagios/etc/objects/localhost.cfg.
define service{
use generic-service ; Name of service template to use
host_name localhost
service_description File Age
check_command check_file_age
notifications_enabled 1
}
Now I can see the plugin under "Configuration -> Object Type: Command" and I can see it listed in "Configuration -> Object Type: Services".
The plugin runs successfully from the command line:
user@host:/usr/local/nagios/libexec$ perl ./check_file_age -w 3600 -c 5400 -W -1 -C -1 -f somefile.txt FILE_AGE OK: somefile.txt is 2932 seconds old and 59 bytes | age=2932s;3600;5400 size=59B;-1;-1;0
Then at this point I'm stumped. I can see this error in Services:
File Age CRITICAL 09-09-2015 14:24:21 0d 0h 32m 1s 3/3 (No output on stdout) stderr: Can't locate utils.pm in @INC (you may need to install the utils module) (@INC contains: . /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl) at /usr/local/nagios/libexec/check_file_age line 30. HTTP Notifications for this service have been disabled OK 09-09-2015 14:30:53 0d 4h 3m 30s 1/4
How do I specify what arguments to pass? How do I correct the error? What's next? (Is there a single location that describes how to add a plugin that escaped my Google-fu?)