aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-nodes
diff options
context:
space:
mode:
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-xsitesummary-nodes50
1 files changed, 50 insertions, 0 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes
new file mode 100755
index 0000000..1c3b0df
--- /dev/null
+++ b/sitesummary-nodes
@@ -0,0 +1,50 @@
+#!/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;
+use Getopt::Std;
+
+my %opts;
+getopts("m", \%opts);
+
+my %hostnames;
+
+for_all_hosts(\&handle_host);
+
+if ($opts{'m'}) {
+ print_munin_list();
+} else {
+ print_list();
+}
+
+sub handle_host {
+ my $hostid = shift;
+ my $hostname = get_hostname($hostid);
+ $hostnames{$hostname} = 1;
+}
+
+sub print_list {
+ for my $hostname (sort keys %hostnames) {
+ print "$hostname\n";
+ }
+}
+
+sub print_munin_list {
+ for my $hostname (sort keys %hostnames) {
+
+ # Using hostname as address, to avoid hardcoding IP addresses in
+ # the file. Might be an idea to fetch the IP address from
+ # system/ifconfig-a
+ print <<EOF;
+[$hostname]
+ address $hostname
+ use_node_name yes
+
+EOF
+ }
+}