Ad Widget

Collapse

Help with trend.get, timestamp and return value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rafael Trevisan
    Junior Member
    • Aug 2021
    • 12

    #1

    Help with trend.get, timestamp and return value

    Hello, I need to get max and avg values from an interface, I did a script on python to do the request and print, I have some questions regarding the timestamp parameter and the type of unit that the JSON return

    {
    "jsonrpc": "2.0",
    "method": "trend.get",
    "params": {
    "time_from":"1651436285",
    "time_till":"1654114685",
    "output": [
    "itemid",
    "value_min",
    "value_avg",
    "value_max"
    ],
    "itemids": [
    "31082"
    ],
    "limit": "1"
    },
    "auth": "mytoken",
    "id": 1
    }

    regarding timestamp, I am using the first day of the month, and the last day of the month, like the "last month" function in graphs, but if I add a clock parameter, it returns the time stamp of the first day of the month,
    witch I think it's not the day that the interface has reached its max, is this method correct?

    My output:

    My router - 100GE 0/3/0 Max Traffic Last Month: Incoming max: 13072933528 Incoming avg: 10856783970 -> is this BPS? I tried converting to Gbps, and it is far more than the max of the interface, per example.
    My router - 100GE 0/3/0 Max Traffic Last Month: Outgoing max: 14506482176 Outgoing avg: 12118952075
  • Rafael Trevisan
    Junior Member
    • Aug 2021
    • 12

    #2
    By converting the value to Gbps, it returns something similar to "last", compared to the graph data, but I'm using the whole month of may as timestamp, I should be getting the "value_max" didn't?

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4806

      #3


      value_min float Hourly minimum value.
      value_avg float Hourly average value.
      value_max float Hourly maximum value.

      I am not sure you get min/max/avg for month (re)calculated... You get more values (add "num" to query, you will see or remove limit), but you limit it to 1 so you probably just see one value... Adding clock, with limit 1... you will just see min/max/avg values from one "hour", from the beginning of the output, I assume it orders output by clock value (example in docs does the same) ...

      So no, you do not get recalculated values for whole month... you need to do your additional math here...

      Comment

      • Rafael Trevisan
        Junior Member
        • Aug 2021
        • 12

        #4
        Thanks, that cleared things a lot. I tried sorting by "sortorder":"desc" and get the higher value, but it doesn't seem to sort it. and searching I stumbled upon this > https://support.zabbix.com/browse/ZBXNEXT-3974

        sortorder string/array Order of sorting. If an array is passed, each value will be matched to the corresponding property given in the sortfield parameter.

        Possible values are:
        ASC - ascending;
        DESC - descending.

        I will try to sort the result another way, since sorting the request doesn't seem to work.

        Comment

        • Rafael Trevisan
          Junior Member
          • Aug 2021
          • 12

          #5
          Thanks again cyber, i did the sorting by script, and everything works fine.

          Comment

          Working...