aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--debian/changelog7
-rwxr-xr-xsitesummary-nodes16
2 files changed, 16 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index fa8d21d..cb19ead 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,10 +2,9 @@ sitesummary (0.0.27) UNRELEASED; urgency=low
* Modify the client code to sleep for a random number of seconds
between 0 and 3600 to make sure all clients do not overload the
- server.
- * Add draft function is_munin_client() to sitesummary-nodes. It
- should be used to only list the clients with the munin-node
- package installed in the munin configuration.
+ server, based on code from cron-apt.
+ * Only list clients in sitesummary-nodes with the munin-node package
+ installed when generating munin configuration file.
* Let sitesummary depend on ${misc:Depends} to get the required
debconf dependency.
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