Ad Widget

Collapse

Not able to access chart 2.php after updation to 5.2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cindyM
    Junior Member
    • Dec 2021
    • 3

    #1

    Not able to access chart 2.php after updation to 5.2

    Hi
    I have created a function to retrieve zabbix chart data using the AUTH api to retrieve the token. On previous versions I was able to add the token to a request to chart2 and retrieve the graph in png.

    But in version 5.2 Zabbix changed the needed cookies from just using the token to a base64 encoded json with the following fields:
    * sessionid (the same as the token before)
    * serverCheckResult: true
    * serverchecktime: 1613571268
    *sign: a long string

    I have no idea on how to create this json with just the token from the api....

    If anyone has an Idea, thanks!!!
    Thanks
  • sramil
    Junior Member
    • Oct 2023
    • 2

    #2
    HI, I'm having the same issue right now with version 6.0, were you able to resolve this?

    Thanks!

    Comment

    • gcalenko
      Zabbix developer
      • Mar 2017
      • 27

      #3
      To get UI pages response first you have to authenticate with user and password and use returned cookie to make requests to UI pages. For example below is example of three steps to get graph as chart.png file.

      Code:
      # login
      curl --cookie-jar auth.cookie --data "name=Admin&password=zabbix&enter=1" -X POST http://your.monitoring.domain/index.php
      
      # get graph as chart.png
      curl --cookie auth.cookie --output chart.png http://your.monitoring.domain/chart2.php?graphid=925&from=now-1h&to=now&height=201&width=1590&profileIdx=web.charts.filter
      
      # logout to do not keep open session
      curl --cookie auth.cookie http://your.monitoring.domain/index.php?reconnect=1
      ​

      Comment


      • sramil
        sramil commented
        Editing a comment
        Yes, my code has been working with the previous version but with the version 6.0, it is failing and giving me "You are not logged in" error message. I authenticated with a username and password and used the zbx_sessionid in chart2.php to get the graphs.
    • pat@zabbix
      Junior Member
      • Sep 2024
      • 3

      #4
      anyone found a solution for this please? i'm looking for same thing , using c# I tried to send username password and get chart2.php response but it return not logged in error . we are using zabbix 6.4

      Comment

      Working...