[smokeping-users] Display of master display_name in graphs.

G.W. Haywood ged at jubileegroup.co.uk
Wed May 21 10:06:22 CEST 2008

Hi there,

On Tue, 20 May 2008, Jonas Genannt wrote:

> > Is there a way to have graphs from the master display with it's
> > "display_name"?  As in "Last 3 Hours from masterdisplay_name" , "Last
> > 30 Hours from masterdisplay_name", etc.
> I'm also interested to display the display_name in all graphs if you
> have defined an slave for this probe.

Unfortunately the structure of the code doesn't lend itself well to
the kind of change you're looking for, but if you're prepared to do a
little work yourself then you could do something like this:

In sub get_detail() in Smokeping.pm:

change the line at approximately at line 1298 in Smokeping.pm from

   my $from = $s ? " from $cfg->{Slaves}{$slave}{display_name}": "";


   my $from = $s ? " from $cfg->{Slaves}{$slave}{display_name}": $cfg->{General}{display_name};

There are several places in the code where there is a test of the
current parameters to see if we're dealing with a slave or not, you
need to look through the code to find the ones you need to change.
The best thing to look for is $cfg->{Slaves}{$slave}{display_name}
which may be in an alternation construct - that is something like

 $something = $test_variable ? $result_if_true : $result_if_false;

More generally you can load a module, something like

    use Sys::Hostname;
    my $host = hostname();

and use the name wherever you like.

If you haven't read the Camel Book, now might be a good time to start.
Don't expect to be anything other than confused for the first couple
of times through it. :)



More information about the smokeping-users mailing list