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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<p>The document has moved <a href="/zabbix/openid?graphid=1552&modauthopenid.referrer=https%3A%2F%2Fexample.com%2Fzabbix%2Fchart2.php%3Fgraphid%3D1552">here</a>.</p>
<address>Apache/2.2.3 (Red Hat) Server at example.com Port 80</address>
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' 'http://example.com/zabbix/index.php?login=1'
2. wget -4 --load-cookies=z.coo -O result.png 'http://example.com/zabbix/chart2.php?graphid=410&width=1778&period=102105&stime=20121129005934'
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: https://support.zabbix.com/browse/ZBXNEXT-562 is the one to vote (or start working on it)