blob: 0034e20115b97ecd356b5334f0dd3d9752de8ae5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/usr/bin/perl
#
# Generate list of nodes to load from /etc/munin/munin.conf to check
# all the machines reporting to sitesummary.
use strict;
use warnings;
use SiteSummary;
my %sitelabels;
if (!defined $ARGV[0]) {
for_all_hosts(\&handle_host);
for my $sitelabel (sort keys %sitelabels) {
print "$sitelabel.value ", $sitelabels{$sitelabel}, "\n";
}
} elsif ($ARGV[0] eq "config") {
for_all_hosts(\&handle_host);
print "graph_title SiteSummary History\n";
print "graph_order " . join(" ", sort keys %sitelabels), "\n";
print "graph_vlabel count\n";
print "graph_scale yes\n";
print "graph_height 400\n";
print "graph_category SiteSummary\n";
my $first = 1;
for my $sitelabel (sort keys %sitelabels) {
print "$sitelabel.label $sitelabel\n";
if ($first) {
print "$sitelabel.draw AREA\n"
} else {
print "$sitelabel.draw STACK\n"
}
$first = 0;
}
} elsif ($ARGV[0] eq "autoconf") {
# This module is only available when the sitesummary collector is
# installed too, thus we always answer yes.
print "yes\n";
exit 0;
}
sub handle_host {
my $hostid = shift;
for my $site (get_site($hostid)) {
$site = "NoSite" unless defined $site;
$site =~ s/[^a-zA-Z_]/_/g;
$sitelabels{$site}++;
}
}
exit 0;
|