aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-nodes
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2007-07-03 07:45:51 +0000
committerPetter Reinholdtsen <pere@hungry.com>2007-07-03 07:45:51 +0000
commit51d5921f0c20dbc03ca6e9636a7fcec66dbd3881 (patch)
treeea26da473f409ffabe3f0ae57432eb57099bd77f /sitesummary-nodes
parentca957c44613901fd433ad203b91aa50a21b823b4 (diff)
downloadsitesummary-51d5921f0c20dbc03ca6e9636a7fcec66dbd3881.tar.gz
sitesummary-51d5921f0c20dbc03ca6e9636a7fcec66dbd3881.tar.bz2
sitesummary-51d5921f0c20dbc03ca6e9636a7fcec66dbd3881.tar.xz
Only list clients in sitesummary-nodes with the munin-node package installed when generating munin configuration file.
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