1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

add autoconf capability

This commit is contained in:
Antoine Beaupré 2012-03-09 19:18:39 -05:00
parent e5ffe76311
commit 70a119e8e5

View file

@ -37,11 +37,7 @@ The location of the offset file (Default:
=head1 MAGIC MARKERS
#%# family=contrib
#%# capabilities=
We should autoconf (check for config file and logfile).
See http://munin-monitoring.org/wiki/ConcisePlugins
#%# capabilities=autoconf
=cut
@ -93,6 +89,19 @@ if ($cmd eq 'config') {
}
exit(0);
}
elsif ($cmd eq 'autoconf') {
sub fail($) {
my $msg=shift;
print "no ($msg)\n";
exit(1);
}
fail("$logfile unreadable)") unless -r $logfile;
fail("$configfile unreadable") unless -r $configfile;
open(my $status, "relayctl show summary|") or fail("cannot run relayctl: $!");
close($status) or fail("cannot run relayctl: $!");
print "yes";
exit(0);
}
# sample lines:
# Mar 8 23:05:28 rtr0 relayd[81814]: host 209.44.112.101, check http code (2000ms), state up -> down, availability 97.83%