diff --git a/plugins/relayd/relayd b/plugins/relayd/relayd index e2cbe063..7b199fb6 100755 --- a/plugins/relayd/relayd +++ b/plugins/relayd/relayd @@ -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%