It looks like mytitle in the configuration file is not being put into 
$phys_tree->{mytitle}
I have not checked the code, but this is probably because mytitle is not 
considered a valid variable name in the configuration file.  I recall that the 
author is using a perl module to read the configuration file, that module 
probably has a constructor that states what the valid variable names are so you 
would need to track that down and add mytitle there, too.

Alternatively, you could further modify Smokeping.pm to create mytitle there by 
parsing title with a regular expression (and forget about adding mytitle to the 
configuration file):

##########
my $mytitle = $phys_tree->{title};
if ($phys_tree->{title} =~ /(.*)<.*ip=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})//) {
  $mytitle = "$1 $2";
}
my ($graphret,$xs,$ys) = RRDs::graph(
    $cfg->{General}{imgcache}.$dir."/${prop}_mini.png", 
    # '--lazy', 
    '--start','-'.exp2seconds($cfg->{Presentation}{overview}{range}), 
    '--title',$mytitle, 
    '--height',$cfg->{Presentation}{overview}{height}, 
    '--width',$cfg->{Presentation}{overview}{width}, 
    '--vertical-label', $ProbeUnit, 
    '--imgformat','PNG', 
    '--alt-autoscale-max', 
    '--alt-y-grid', 
    '--rigid', 
    '--lower-limit','0', 
    @G, 
    "COMMENT:$date\\r"); 
##########

This would require your title to have a certain format to detect the IPv4 (IPv6 
would fail) in the URL so it could create problems later, though.


-Russell Dwarshuis

----- Original Message -----
From: "Alessandro Palermo" <[email protected]>
To: "smokeping-users" <[email protected]>
Sent: Thursday, January 23, 2014 11:30:53 AM
Subject: [smokeping-users] Trying to modify the smokeping web interface

Hi list. 

I was working on a bash script to save the change of routes on smokeping Target 
devices. 
The script is quite simple, It's read the Target file and get the IP address 
and the check if the device is reachable, if so, then it's make and mtr and 
store the route in a database (mysql) 
This script runs on cron each 5 minutes. 
Also I wrote a php web that recives an IP address as a parameter and show the 
changes of routes for these IP. 
I want to add this php web as a link in the title of the detailed graphs. So I 
edited the Target file and add in the title variable something like this: 

menu = Some place 
title= Some place <a href=/ruteo/search.php?ip=192.168.2.234>192.168.2.234</a> 
host= 192.168.2.234 

This works so so, because the links appear ok in the detailed graphs as a title 
(html title) but in the main view of the smokeping the graphs generated by 
rrdtool show as a title this: 

Some place <a href=/ruteo/search.php?ip=192.168.2.234>192.168.2.234</a> 

And so the graph It's look no good. 

Then I edit the Smokeping.pm and this block of code 
------------------------------------------------ 
my ($graphret,$xs,$ys) = RRDs::graph 
($cfg->{General}{imgcache}.$dir."/${prop}_mini.png", 
# '--lazy', 
'--start','-'.exp2seconds($cfg->{Presentation}{overview}{range}), 
'--title',$phys_tree->{title}, 
'--height',$cfg->{Presentation}{overview}{height}, 
'--width',$cfg->{Presentation}{overview}{width}, 
'--vertical-label', $ProbeUnit, 
'--imgformat','PNG', 
'--alt-autoscale-max', 
'--alt-y-grid', 
'--rigid', 
'--lower-limit','0', 
@G, 
"COMMENT:$date\\r"); 
my $ERROR = RRDs::error(); 
$page .= "<div>"; 

------------------------------------------------ 

I've changed the line '--title',$phys_tree->{title}, 
for this line '--title',$phys_tree->{mytitle}, 

With this change It's work so so, because in the rrdtool main graph It's appear 
no title. 
Trying to solve this, in the file Targets I've add a new variable defined on 
this way 

menu = Some place 
title= Some place <a href=/ruteo/search.php?ip=192.168.2.234>192.168.2.234</a> 
mytitle= Some place 192.168.2.234 
host= 192.168.2.234 

But with this change when I restart smokeping I've an error. Unknown variable 
mytitle. 

Any ideas? 

Thanks in advance and sorry for my english :( 













_______________________________________________
smokeping-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users

_______________________________________________
smokeping-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users

Reply via email to