Révision 70a119e8
| ID | 70a119e8e5807345be2859b2fa9cff4651fc1c23 |
add autoconf capability
| plugins/relayd/relayd | ||
|---|---|---|
| 37 | 37 |
=head1 MAGIC MARKERS |
| 38 | 38 |
|
| 39 | 39 |
#%# family=contrib |
| 40 |
#%# capabilities= |
|
| 41 |
|
|
| 42 |
We should autoconf (check for config file and logfile). |
|
| 43 |
|
|
| 44 |
See http://munin-monitoring.org/wiki/ConcisePlugins |
|
| 40 |
#%# capabilities=autoconf |
|
| 45 | 41 |
|
| 46 | 42 |
=cut |
| 47 | 43 |
|
| ... | ... | |
| 93 | 89 |
} |
| 94 | 90 |
exit(0); |
| 95 | 91 |
} |
| 92 |
elsif ($cmd eq 'autoconf') {
|
|
| 93 |
sub fail($) {
|
|
| 94 |
my $msg=shift; |
|
| 95 |
print "no ($msg)\n"; |
|
| 96 |
exit(1); |
|
| 97 |
} |
|
| 98 |
fail("$logfile unreadable)") unless -r $logfile;
|
|
| 99 |
fail("$configfile unreadable") unless -r $configfile;
|
|
| 100 |
open(my $status, "relayctl show summary|") or fail("cannot run relayctl: $!");
|
|
| 101 |
close($status) or fail("cannot run relayctl: $!");
|
|
| 102 |
print "yes"; |
|
| 103 |
exit(0); |
|
| 104 |
} |
|
| 96 | 105 |
|
| 97 | 106 |
# sample lines: |
| 98 | 107 |
# Mar 8 23:05:28 rtr0 relayd[81814]: host 209.44.112.101, check http code (2000ms), state up -> down, availability 97.83% |
Formats disponibles : Unified diff