To monitor Mailman mailing lists, I've added the check_mailman_qfiles plugin to an Icinga host.
With only the hostname as an argument, the plugin works fine when run manually:
user@icinga:~$ /usr/lib/nagios/plugins/check_mailman_qfiles mail.example.com
all normal
However, when run periodically as part of Icinga, the plugin complains that it can't stat "archive", the first file in the qfiles directory:
Notification Type: PROBLEM
Service: Mailman
Host: example.com mail server
Address: 10.1.2.3
State: UNKNOWN
Date/Time: Fri Jun 26 16:09:16 PDT 2015
Additional Info:
**ePN /usr/lib/nagios/plugins/check_mailman_qfiles: Cant stat /usr/local/mailman/qfiles/archive: No such file or directory
Initially I thought this was because I ran the manual command from my shell, while the nagios user has /bin/false as its shell. But I tried using bash for nagios (temporarily), and the command runs fine as the nagios user.
What else would cause the plugin to fail when run automatically?
I've pasted below the mailman command, service, and hostgroup definitions as well as a link to the plugin.
Also, this is for Icinga 1.7.1-7 running on Debian wheezy. Thanks!
Command definition, from /etc/icinga/commands.cfg:
define command{
command_name check_mailman_qfiles
command_line $USER1$/check_mailman_qfiles $ARG1$
}
Service definition, from /etc/icinga/objects/services_icinga.cfg:
define service{
service_description Mailman
use generic-service
hostgroup_name mailman-servers
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups admins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_mailman_qfiles
}
Hostgroup definition, from /etc/icinga/objects/hostgroups_icinga.cfg:
define hostgroup{
hostgroup_name mailman-servers ; The name of the hostgroup
alias Mailman servers ; Long name of the group
members mail.example.com
}
Plugin is at https://exchange.nagios.org/directory/Plugins/Email-and-Groupware/Mailman/check_mailman_qfiles/details