mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
add autoconf capability
This commit is contained in:
parent
e5ffe76311
commit
70a119e8e5
1 changed files with 14 additions and 5 deletions
|
@ -37,11 +37,7 @@ The location of the offset file (Default:
|
||||||
=head1 MAGIC MARKERS
|
=head1 MAGIC MARKERS
|
||||||
|
|
||||||
#%# family=contrib
|
#%# family=contrib
|
||||||
#%# capabilities=
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
We should autoconf (check for config file and logfile).
|
|
||||||
|
|
||||||
See http://munin-monitoring.org/wiki/ConcisePlugins
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
@ -93,6 +89,19 @@ if ($cmd eq 'config') {
|
||||||
}
|
}
|
||||||
exit(0);
|
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:
|
# 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%
|
# Mar 8 23:05:28 rtr0 relayd[81814]: host 209.44.112.101, check http code (2000ms), state up -> down, availability 97.83%
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue