aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-nodes
diff options
context:
space:
mode:
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-xsitesummary-nodes16
1 files changed, 13 insertions, 3 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes
index 8fd3478..1ac8fa1 100755
--- a/sitesummary-nodes
+++ b/sitesummary-nodes
@@ -36,13 +36,23 @@ sub print_list {
sub is_munin_client {
my $hostid = shift;
- # Should check debian/dpkg-l for 'ii *munin-node '
- 1; # Assume all nodes are munin nodes for now
+ # Check debian/dpkg-l for 'ii *munin-node '
+ my $path = get_filepath_current($hostid, "/debian/dpkg-l");
+ if (open (my $fh, $path)) {
+ while(<$fh>) {
+ if (m/^ii *munin-node /) {
+ close($fh);
+ return 1
+ }
+ }
+ close($fh);
+ }
+ return undef;
}
sub print_munin_list {
for my $hostname (sort keys %hostnames) {
- return unless (is_munin_client($hostnames{$hostname}));
+ next unless (is_munin_client($hostnames{$hostname}));
# Using hostname as address, to avoid hardcoding IP addresses in
# the file. Might be an idea to fetch the IP address from