Ad Widget

Collapse

Zabbix 4.0.3 Changes in API behaviour?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • globe
    Member
    • Apr 2006
    • 40

    #1

    Zabbix 4.0.3 Changes in API behaviour?

    Dears,

    i've upgraded our Zabbix from 3.4 to 4.0.3 and have a wired side effect:
    Our phpWeathermap plugin which uses the API to gather latest data of items and shows instant graphs shows since the upgrade only a 2 hour graph instead of the configured day graph. Did anything in the API change that would explain this behaviour?
    I've checked the changelog and API Doku but wasn't able to find there a issue.

    Any hints/idea welcome.

    Thanks, brgds Simon

  • aigars.kadikis
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2018
    • 208

    #2
    Hi globe,

    Cannot tell instantly. It would be great if you can tell which API method you are using to gather the latest input data? What arguments you are giving to this method?

    Are you generating a graph using a dedicated API method or phpWeathermap module takes care of creating a graph?

    Regards,

    Comment

    • globe
      Member
      • Apr 2006
      • 40

      #3
      hi aigars.kandikis,

      i digged deeper in the meantime and found that it's using the chart2.php which has obiously changes since Zabbix4.0. The parameters needed to generate the graph changed and now a "from" and "to" period is needed.

      this is used at phpweathermap to grap the chart.
      Code:
       $item->overliburl[$k][$index] = $baseUrl.'/chart2.php?width='.$graphWidth.'&height='.
      $graphHeight.'&period='.$graphPeriod.'&stime=now&graphid='.$graphId;
      but chart2.php doesn't have this anymore:
      Code:
      $fields = [
              'graphid' =>            [T_ZBX_INT,                     O_MAND, P_SYS,  DB_ID,          null],
              'from' =>                       [T_ZBX_RANGE_TIME,      O_OPT, P_SYS,   null,           null],
              'to' =>                         [T_ZBX_RANGE_TIME,      O_OPT, P_SYS,   null,           null],
              'profileIdx' =>         [T_ZBX_STR,                     O_OPT, null,    null,           null],
              'profileIdx2' =>        [T_ZBX_STR,                     O_OPT, null,    null,           null],
              'width' =>                      [T_ZBX_INT,                     O_OPT, null,    BETWEEN(CLineGraphDraw::GRAPH_WIDTH_MIN, 65535),        null],
              'height' =>                     [T_ZBX_INT,                     O_OPT, null,    BETWEEN(CLineGraphDraw::GRAPH_HEIGHT_MIN, 65535),       null],
              'outer' =>                      [T_ZBX_INT,                     O_OPT, null,    IN('0,1'),      null],
              'onlyHeight' =>         [T_ZBX_INT,                     O_OPT, null,    IN('0,1'),      null],
              'legend' =>                     [T_ZBX_INT,                     O_OPT, null,    IN('0,1'),      null],
              'widget_view' =>        [T_ZBX_INT,                     O_OPT, null,    IN('0,1'),      null]
      ];

      Comment

      • globe
        Member
        • Apr 2006
        • 40

        #4
        update:
        found a solution - it seems the "profileIdx=web.graphs.filter" and the change from seconds to a period like "now-24h" are required. the working URL generation looks now like:

        Code:
         $item->overliburl[$k][$index] = $baseUrl.'/chart2.php?width='.$graphWidth.'&height='.$graphHeight.'&from=now-'.$graphPeriod.'&to=now&graphid='.$graphId.'&profileIdx=web.graphs.filter';

        Comment

        • mbit
          Junior Member
          • Feb 2020
          • 5

          #5
          that's exactly what I was looking for
          Thank you

          Comment

          Working...