[collectd] [PATCH] collectd2html.pl: Cleaned up Eddy's patch.

Sebastian Harl sh at tokkee.org
Mon Nov 12 13:05:54 CET 2007


 * Use Perl's undef to identify invalid values.
 * Renamed the "host-is" command line option to "host".

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 contrib/collectd2html.pl |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/contrib/collectd2html.pl b/contrib/collectd2html.pl
index da143d7..32d6305 100644
--- a/contrib/collectd2html.pl
+++ b/contrib/collectd2html.pl
@@ -16,6 +16,9 @@
 #
 # Copyright 2006 Vincent Stehlé <vincent.stehle at free.fr>
 #
+# Patch to configure the data directory and hostname by Eddy Petrisor
+# <eddy.petrisor at gmail.com>.
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -39,17 +42,17 @@ use File::Basename;
 use Getopt::Long qw(:config no_ignore_case bundling pass_through);
 
 my $DIR  = "/var/lib/collectd";
-my $HOST = "_UNDEFINED_";
+my $HOST = undef;
 
 GetOptions (
-    "host-is=s"  => \$HOST,
+    "host=s"     => \$HOST,
     "data-dir=s" => \$DIR
 );
 
 my @COLORS = (0xff7777, 0x7777ff, 0x55ff55, 0xffcc77, 0xff77ff, 0x77ffff,
 	0xffff77, 0x55aaff);
 my @tmp = `/bin/hostname`; chomp(@tmp);
-$HOST = $tmp[0] if ( $HOST =~ /_UNDEFINED_/ );
+$HOST = $tmp[0] if (! defined $HOST);
 my $IMG_DIR = "${HOST}.dir";
 my $HTML = "${HOST}.html";
 
-- 
1.5.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20071112/f22369e4/attachment.pgp 


More information about the collectd mailing list