[collectd] Bug#438499: collectd: [PATCH] unable to generate the graphs remotely or from another dir

Eddy Petrișor eddy.petrisor at gmail.com
Fri Aug 17 17:59:25 CEST 2007


Sebastian Harl wrote:
> forwarded 438499 collectd at verplant.org
> thanks
> 
> Hi Eddy,
> 
> On Fri, Aug 17, 2007 at 03:55:31PM +0300, Eddy Petri??or wrote:
>> In the contribs area of the package there is a nice collectd2html.pl
>> script which assumes that the data is present in /var/lib/collectd and
>> infers the hostname. All fine and dandy, but there is no way to
>> override this. This is useful if one generates the data on a machine,
>> but generates the graphs on another one.
>>
>> With the attached patch now is possible to specify a different host
>> and/or a different directory for the data.
>>
>> The added options are '--host-is' and '--data-dir'.
>>
>> An invocation for a remote host whose rrd files have been placed in
>> /var/tmp/collectd-remoteh looks like:
>>
>> collectd2html.pl --host-is=remoteh --data-dir=/var/tmp/collectd-remoteh
> 
> Thanks for your patch.

Thanks to upstream and to you for this nice app.

>> Please send upstream and apply the patch in the next release of
>> collectd.
> 
> I will wait for upstream to include it.

Ok, cool.


>>  use File::Basename;
>> +use Getopt::Long qw(:config no_ignore_case bundling pass_through);
>> +
>> +my $DIR  = "/var/lib/collectd";
>> +my $HOST = "_UNDEFINED_";
> 
> I'd change this to "my $HOST = undef;".

"hack" is written all over this patch :-)

>> +
>> +GetOptions (
>> +    "host-is=s"  => \$HOST,
> 
> Imho "host=s" sounds a lot nicer :-)

I agree.

>> +    "data-dir=s" => \$DIR
>> +);
>>  
>> -my $DIR = "/var/lib/collectd";
>>  my @COLORS = (0xff7777, 0x7777ff, 0x55ff55, 0xffcc77, 0xff77ff, 0x77ffff,
>>  	0xffff77, 0x55aaff);
>>  my @tmp = `/bin/hostname`; chomp(@tmp);
>> -my $HOST = $tmp[0];
>> +$HOST = $tmp[0] if ( $HOST =~ /_UNDEFINED_/ );
> 
> This would have to be "$HOST = $tmp[0] if (! defined $HOST);".
> 
>>  my $IMG_DIR = "${HOST}.dir";
>>  my $HTML = "${HOST}.html";

IMHO, your suggestions should be implemented in my patch :-)

-- 
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070817/45907890/attachment.pgp 


More information about the collectd mailing list