[smokeping-users] Trying to modify the smokeping web interface
Alessandro Palermo
ok.aless at gmail.com
Thu Jan 23 17:30:53 CET 2014
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 <https://mail.google.com/mail/u/0/#>
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 :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/smokeping-users/attachments/20140123/a74e4bde/attachment.html
More information about the smokeping-users
mailing list