SVG graphs?
Moderators: Developers, Moderators
SVG graphs?
Anybody have SVG graph format working?
I enabled it under graph template, and try to view the graph page, but all the graphs are not being displayed at all.
I`m using Firefox 2.0.0.12, Cacti 0.8.7b and rrdtool 1.2.23
Thanks,
I enabled it under graph template, and try to view the graph page, but all the graphs are not being displayed at all.
I`m using Firefox 2.0.0.12, Cacti 0.8.7b and rrdtool 1.2.23
Thanks,
At least according to this:
http://www.mozilla.org/projects/svg/
http://www.mozilla.org/projects/svg/
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
I just tried this too (didn't even know the option was there!) and I get missing images. However, if I take the image URL from the HTML source and go to that in my browser, I get:
and if I look at the source of that, then it's a sensible-looking SVG document. If I take that document, paste it into a file, and then open it, I get a blank Cacti graph.
I guess the SVG is bad, but the validator is down, and svg2png (from Cairo) core dumps on the file.
Code: Select all
The image “http://wotsit.thingy.com/cacti/graph_image.php?action=view&local_graph_id=45&rra_id=1” cannot be displayed, because it contains errors.
I guess the SVG is bad, but the validator is down, and svg2png (from Cairo) core dumps on the file.
- Attachments
-
- svg-borked.png (14.55 KiB) Viewed 9920 times
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Seems this would be an issue with RRDTool.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
I doubt it'd make *that* much difference - rrdtool still has to do all the I/O to get the data in the first place.phila wrote:Bump, anybody seen this working?
The interest here is to move the graph rendering CPU load from Cacti server to the client, as I understand this creating an SVG is less CPU intensive then PNG.
(completely untested assumption though - run 1000 graphs off with a shell script and time(1), and see what happens, I guess )
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
It looks like that the MIME Content-type on the SVG images is hard-coded to image/png in graph_image.php, when it should be image/svg-xml. If I change the graph type to SVG and change the MIME type, it works.
Only now there is a matter of Firefox crashing.
Probably not a bad idea to have the MIME type follow the graph type, my PHP skills are not that good, maybe somebody will submit a patch.
Only now there is a matter of Firefox crashing.
Probably not a bad idea to have the MIME type follow the graph type, my PHP skills are not that good, maybe somebody will submit a patch.
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Now, that is a bug, please submit a bug about the Mime type miss match.
http://www.cacti.net/bugs.php
http://www.cacti.net/bugs.php
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Re: SVG graphs?
I hate to necro-post, but this is the first entry in Google when searching for this topic, so I figure this is the best place to post my patch.
It would seem that Cacti 0.8.8 does have this patched, but the patch was committed in 2008 and we still don't have this fixed. Fortunately I'm versed enough in PHP to make my own, simple patch.
This patch will only work in PHP 5.3+, as it uses the FileInfo extension. Rather than simply dumping the graph image data to the screen, the data is stored in a variable, which is then read by the FileInfo extension, and the MIME type gets discovered. The newly discovered MIME type is then sent to the browser instead of the default image/png
The file to edit is graph_image.php.
About 1/3 the way down (line 42), comment out the header line. It should look like:This will stop graph_image.php from acting like all graphs are PNG files.
Then, at the bottom, comment out the print line. It should look like:
Add this below the newly commented out "print" line:
Hopefully this helps someone.
It would seem that Cacti 0.8.8 does have this patched, but the patch was committed in 2008 and we still don't have this fixed. Fortunately I'm versed enough in PHP to make my own, simple patch.
This patch will only work in PHP 5.3+, as it uses the FileInfo extension. Rather than simply dumping the graph image data to the screen, the data is stored in a variable, which is then read by the FileInfo extension, and the MIME type gets discovered. The newly discovered MIME type is then sent to the browser instead of the default image/png
The file to edit is graph_image.php.
About 1/3 the way down (line 42), comment out the header line. It should look like:
Code: Select all
#header("Content-type: image/png");
Then, at the bottom, comment out the print line. It should look like:
Code: Select all
#print @rrdtool_function_graph($_GET["local_graph_id"], (array_key_exists("rra_id", $_GET) ? $_GET["rra_id"] : null), $graph_data_array);
Code: Select all
/* Get the graph data */
$output = @rrdtool_function_graph($_GET["local_graph_id"], (array_key_exists("rra_id", $_GET) ? $_GET["rra_id"] : null), $graph_data_array);
/* Determine the format */
$finfo = new finfo(FILEINFO_MIME);
list($mime,$charset) = explode(';',$finfo->buffer($output));
/* Output the appropriate header */
header('Content-type: '.$mime);
echo $output;
Re: SVG graphs?
pickle:
Please create a bug for this feature request and reference this post. http://www.cacti.net/bugs.php
Please create a bug for this feature request and reference this post. http://www.cacti.net/bugs.php
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Re: SVG graphs?
Thank you for this. Saved me much time trying to figure out why png graphs worked fine but svg graphs puked.pickle wrote:I hate to necro-post, but this is the first entry in Google when searching for this topic, so I figure this is the best place to post my patch.
It would seem that Cacti 0.8.8 does have this patched, but the patch was committed in 2008 and we still don't have this fixed. Fortunately I'm versed enough in PHP to make my own, simple patch. [...]
Hopefully this helps someone.
Re: SVG graphs?
It works on 0.8.8hpickle wrote:I hate to necro-post, but this is the first entry in Google when searching for this topic, so I figure this is the best place to post my patch.
It would seem that Cacti 0.8.8 does have this patched, but the patch was committed in 2008 and we still don't have this fixed. Fortunately I'm versed enough in PHP to make my own, simple patch.
This patch will only work in PHP 5.3+, as it uses the FileInfo extension. Rather than simply dumping the graph image data to the screen, the data is stored in a variable, which is then read by the FileInfo extension, and the MIME type gets discovered. The newly discovered MIME type is then sent to the browser instead of the default image/png
The file to edit is graph_image.php.
About 1/3 the way down (line 42), comment out the header line. It should look like:This will stop graph_image.php from acting like all graphs are PNG files.Code: Select all
#header("Content-type: image/png");
Then, at the bottom, comment out the print line. It should look like:Add this below the newly commented out "print" line:Code: Select all
#print @rrdtool_function_graph($_GET["local_graph_id"], (array_key_exists("rra_id", $_GET) ? $_GET["rra_id"] : null), $graph_data_array);
Hopefully this helps someone.Code: Select all
/* Get the graph data */ $output = @rrdtool_function_graph($_GET["local_graph_id"], (array_key_exists("rra_id", $_GET) ? $_GET["rra_id"] : null), $graph_data_array); /* Determine the format */ $finfo = new finfo(FILEINFO_MIME); list($mime,$charset) = explode(';',$finfo->buffer($output)); /* Output the appropriate header */ header('Content-type: '.$mime); echo $output;
Thank you very much
Who is online
Users browsing this forum: No registered users and 2 guests