Mad-D Mad-D - 4 years ago 839
Linux Question

Zabbix to export graph (.PNG) files

My Goal:

I would like to extract graphs associated with hosts in .png format. My GOOGLE research say's we don't have Zabbix API designed to do this task. So few blogs advised to user Chart2.php & CURL. Can someone explain me how to go about it ( detailed steps )?

Note: Sorry never worked on php nor on curl

When i tried


Got this, but link doesn't work

<title>302 Found</title>
<p>The document has moved <a href="/zabbix/openid?graphid=1552&amp;">here</a>.</p>
<address>Apache/2.2.3 (Red Hat) Server at Port 80</address>

Also how can i incorporate this with my zabbix api (JAVA ) call ?

Answer Source

This works with the normal password authentication, you need to adapt it to openid which I don't use and most certainly you will have to change options for this to work with curl.

1. wget --save-cookies=z.coo -4 --keep-session-cookies -O - -S --post-data='name=(a zabbix username)&password=(password)&enter=Enter' ''

2. wget -4 --load-cookies=z.coo -O result.png ''

the first one posts authentication and saves the cookie. the second loads the same cookie file and retrieves the png.

You must certainly want to implement it without using shell but in a language of your preference and zabbix's JSON-RPC API of which there are plenty of client libraries already.

Though AFAIK you still will have to login like this to get the graph's image. At least for the time being.

EDIT: is the one to vote (or start working on it)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download