Hello everyone,
I check a couple of post in the Zabbix Forum and others sites to find a solution to download a graph using a curl command.
The function zablogin is
Hello everyone,
I check a couple of post in the Zabbix Forum and others sites to find a solution to download a graph using a curl command.
The function zablogin is
Unfortunately, when I run this, I get an empty graph :

Could you help me to find a solution ?
Thanks,
I check a couple of post in the Zabbix Forum and others sites to find a solution to download a graph using a curl command.
curl -X GET -v -o chart.png --cookie 'zbx_sessionid=#{zablogin}' "http://192.168.0.10/zabbix/chart.php?from=now-1M&to=now&itemids=72351&profileIdx=web.item.graph . filter&width=1733"
The function zablogin is
Hello everyone,
I check a couple of post in the Zabbix Forum and others sites to find a solution to download a graph using a curl command.
Code:
curl -X GET -v -o chart.png --cookie 'zbx_sessionid=#{zablogin}' "[URL="http://10.100.5.46/zabbix/chart.php?from=now-1M&to=now&itemids=72351&profileIdx=web.item.graph.filter&width=1733"]http://192.168.0.10/zabbix/chart.php?from=now-1M&to=now&itemids=72351&profileIdx=web.item.graph.filter&width=1733[/URL]"
The function zablogin is
Code:
def zabpost(payload)
req = Net::HTTP::Post.new("/zabbix/api_jsonrpc.php", initheader = {'Content-Type' =>'application/json'})
req.basic_auth "script", "scr1pt"
req.body = payload
response = Net::HTTP.new("[URL="http://10.100.5.46/zabbix/chart.php?from=now-1M&to=now&itemids=72351&profileIdx=web.item.graph.filter&width=1733"]192.168.0.10[/URL]", "80").start {|http| http.request(req) }
puts "Response #{response.code} #{response.message}: #{response.body}"
return JSON.parse(response.body)
#return JSON.parse(response.body, object_class: OpenStruct)
end
def zablogin
payload = '
{
"jsonrpc":"2.0",
"method": "user.login",
"params": {
"user": "script",
"password":"scr1pt"
},
"id": 0
}'
temp = zabpost(payload)
return temp["result"]
end
Could you help me to find a solution ?
Thanks,