<p dir="ltr"> Thanks Russell I will try on this way.</p>
<p dir="ltr">Regards.</p>
<div class="gmail_quote">El ene 23, 2014 3:35 PM, "Russell Dwarshuis" <<a href="mailto:rjd@merit.edu">rjd@merit.edu</a>> escribió:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It looks like mytitle in the configuration file is not being put into $phys_tree->{mytitle}<br>
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.<br>
<br>
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):<br>
<br>
##########<br>
my $mytitle = $phys_tree->{title};<br>
if ($phys_tree->{title} =~ /(.*)<.*ip=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})//) {<br>
$mytitle = "$1 $2";<br>
}<br>
my ($graphret,$xs,$ys) = RRDs::graph(<br>
$cfg->{General}{imgcache}.$dir."/${prop}_mini.png",<br>
# '--lazy',<br>
'--start','-'.exp2seconds($cfg->{Presentation}{overview}{range}),<br>
'--title',$mytitle,<br>
'--height',$cfg->{Presentation}{overview}{height},<br>
'--width',$cfg->{Presentation}{overview}{width},<br>
'--vertical-label', $ProbeUnit,<br>
'--imgformat','PNG',<br>
'--alt-autoscale-max',<br>
'--alt-y-grid',<br>
'--rigid',<br>
'--lower-limit','0',<br>
@G,<br>
"COMMENT:$date\\r");<br>
##########<br>
<br>
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.<br>
<br>
<br>
-Russell Dwarshuis<br>
<br>
----- Original Message -----<br>
From: "Alessandro Palermo" <<a href="mailto:ok.aless@gmail.com">ok.aless@gmail.com</a>><br>
To: "smokeping-users" <<a href="mailto:smokeping-users@lists.oetiker.ch">smokeping-users@lists.oetiker.ch</a>><br>
Sent: Thursday, January 23, 2014 11:30:53 AM<br>
Subject: [smokeping-users] Trying to modify the smokeping web interface<br>
<br>
Hi list.<br>
<br>
I was working on a bash script to save the change of routes on smokeping Target devices.<br>
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)<br>
This script runs on cron each 5 minutes.<br>
Also I wrote a php web that recives an IP address as a parameter and show the changes of routes for these IP.<br>
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:<br>
<br>
menu = Some place<br>
title= Some place <a href=/ruteo/search.php?ip=192.168.2.234>192.168.2.234</a><br>
host= 192.168.2.234<br>
<br>
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:<br>
<br>
Some place <a href=/ruteo/search.php?ip=192.168.2.234>192.168.2.234</a><br>
<br>
And so the graph It's look no good.<br>
<br>
Then I edit the Smokeping.pm and this block of code<br>
------------------------------------------------<br>
my ($graphret,$xs,$ys) = RRDs::graph<br>
($cfg->{General}{imgcache}.$dir."/${prop}_mini.png",<br>
# '--lazy',<br>
'--start','-'.exp2seconds($cfg->{Presentation}{overview}{range}),<br>
'--title',$phys_tree->{title},<br>
'--height',$cfg->{Presentation}{overview}{height},<br>
'--width',$cfg->{Presentation}{overview}{width},<br>
'--vertical-label', $ProbeUnit,<br>
'--imgformat','PNG',<br>
'--alt-autoscale-max',<br>
'--alt-y-grid',<br>
'--rigid',<br>
'--lower-limit','0',<br>
@G,<br>
"COMMENT:$date\\r");<br>
my $ERROR = RRDs::error();<br>
$page .= "<div>";<br>
<br>
------------------------------------------------<br>
<br>
I've changed the line '--title',$phys_tree->{title},<br>
for this line '--title',$phys_tree->{mytitle},<br>
<br>
With this change It's work so so, because in the rrdtool main graph It's appear no title.<br>
Trying to solve this, in the file Targets I've add a new variable defined on this way<br>
<br>
menu = Some place<br>
title= Some place <a href=/ruteo/search.php?ip=192.168.2.234>192.168.2.234</a><br>
mytitle= Some place 192.168.2.234<br>
host= 192.168.2.234<br>
<br>
But with this change when I restart smokeping I've an error. Unknown variable mytitle.<br>
<br>
Any ideas?<br>
<br>
Thanks in advance and sorry for my english :(<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
smokeping-users mailing list<br>
<a href="mailto:smokeping-users@lists.oetiker.ch">smokeping-users@lists.oetiker.ch</a><br>
<a href="https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users" target="_blank">https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users</a><br>
</blockquote></div>