ZABBIX Forums  
  #1  
Old 09-03-2010, 13:59
dephil dephil is offline
Junior Member
 
Join Date: Mar 2010
Posts: 4
Default How to export graphs as pictures?

Hi guys.

First of all I need to give you an short introduction of what I'm planning to do. I'd like to send daily emails to all admins in my company including the status of our most important switches and firewals etc. These emails should contain information about the uptime etc of these switches and I'd like to include some images of important graphs in these emails as an attachment. It should be something like a 'automated daily reporting system'. If Zabbix already has such a function that will be perfect. If not, how can I cause Zabbix to export specific graphs as pictures at a defined time?


I had a closer look on config.inc.php at the function called "function ImageOut(...)". This function uses the PHP function ImagePNG($image); to print an image (the image of the graph) in the webbrowser. By changing the function

"ImagePNG($image);"

to

"ImagePNG($image,"/var/www/zabbix_pics/pic1.png");"

I got Zabbix to save all graphs as a picture on my harddrive instead of showing them in the browser. So, it's not impossible to save graphs as pictures but this solution is just for testing purpose. I need to expand this (or more) php files, but before I do so, I'd like to know if there's anybody, who has a better idea how to get my 'problem' solved.

I'm still using Zabbix 1.6.7 (an upgrade to 1.8 is comming soon). Is version 1.8 able to export graphs as pictures?

I would be grateful for any help
Reply With Quote
  #2  
Old 09-03-2010, 18:10
richlv richlv is offline
Administrator
Zabbix certified trainerZabbix certified professionalZabbix certified specialist
 
Join Date: Oct 2005
Posts: 3,103
Default

personally, i'd suggest for now to simply wget the graphs and then use them in the emails.

you can do this either by allowing guest user access to them, or configuring zabbix with http auth and then authenticating that way
Reply With Quote
  #3  
Old 10-03-2010, 12:09
dephil dephil is offline
Junior Member
 
Join Date: Mar 2010
Posts: 4
Default

Oh, that was easy Thanks a lot!!!

Enabling the guest account and changing user rights for guest to view the graphs solved my problem. Now I'm able to wget these graphs by executing this command:

wget "http://1.2.3.4/zabbix/chart2.php?graphid=XXXX&period=3600&width=800"

where XXXX is the graph's ID.

Thanks richlv!
Reply With Quote
  #4  
Old 10-03-2010, 16:37
danrog danrog is offline
Senior Member
 
Join Date: Sep 2009
Location: Boston, MA USA
Posts: 161
Default

Check out this thread/script.

Zerg has created a nice little perl script that will send via email a list of screens and the graphs associated with them. It works great.
Reply With Quote
  #5  
Old 25-04-2010, 14:50
Jun.Liu Jun.Liu is offline
Member
 
Join Date: Apr 2007
Location: Guangzhou, China
Posts: 78
Default

Quote:
Originally Posted by dephil View Post
Oh, that was easy Thanks a lot!!!

Enabling the guest account and changing user rights for guest to view the graphs solved my problem. Now I'm able to wget these graphs by executing this command:

wget "http://1.2.3.4/zabbix/chart2.php?graphid=XXXX&period=3600&width=800"

where XXXX is the graph's ID.

Thanks richlv!
that's a very convenience method! but how can I know the graph's ID? it seems it need be searched in database?
Reply With Quote
  #6  
Old 26-04-2010, 06:47
richlv richlv is offline
Administrator
Zabbix certified trainerZabbix certified professionalZabbix certified specialist
 
Join Date: Oct 2005
Posts: 3,103
Default

Quote:
Originally Posted by Jun.Liu View Post
that's a very convenience method! but how can I know the graph's ID? it seems it need be searched in database?
in frontend, edit the graph and look at the url - graphid should be included there
Reply With Quote
  #7  
Old 06-05-2010, 14:52
dephil dephil is offline
Junior Member
 
Join Date: Mar 2010
Posts: 4
Default

Thanks danrog! It works really great. Solved my problem Damn, that's nice!

Quote:
Originally Posted by danrog View Post
Check out this thread/script.

Zerg has created a nice little perl script that will send via email a list of screens and the graphs associated with them. It works great.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:21.