Ad Widget

Collapse

Plot a custom item key with time shifting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Benjamin Auger
    Junior Member
    • Apr 2020
    • 4

    #1

    Plot a custom item key with time shifting

    Hello dear Zabbix members,

    I hope all doing well in this particulary period.
    I facing an issue with a custom item key who is time shifted.

    First of all, I have build a custom script (using Azure AD Outlook API graph report) that's return me the mail stats of my company, for the previous day (current day -1d).
    Everything works well (nothing real difficult) but I don't know, even after multiple searches, how to tell to Zabbix to save the data with the past day timestamp instead of the current day ts.

    For instance, I get the stats of the previous day (so current day -1day) and I want Zabbix to save my data with a shift of "-1d".
    My item custom update interval is scheduled every day at 06PM.

    Do you know if this can be achieve with Zabbix ?

    Thanks for your help,
    Benjamin.

    Click image for larger version  Name:	dfhfgdfhdh.PNG Views:	4 Size:	35.8 KB ID:	400229
    Last edited by Benjamin Auger; 28-04-2020, 10:58.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    It seems like what you're actually trying to accomplish is time-shift the data as it's recorded (stored in the Zabbix database), rather than when it's graphed or displayed.

    There might be a better way to accomplish this that I'm not aware of, but the only way I know how do this would be to configure the item as a Zabbix trapper (not SNMP trap) item, and then use the "zabbix_sender" command with the "--with-timestamps" argument and an input file (the --input-file argument too).

    As the documentation for the "Zabbix trapper" item type describes, this allows you to push arbitrary data into Zabbix. You could run your script that gathers the data via a scheduled task or cron job and then just push the data into Zabbix once per day, with the correct timestamp specified in the input file that you send via zabbix_sender.

    Comment

    • Benjamin Auger
      Junior Member
      • Apr 2020
      • 4

      #3
      Hello Tim,

      Thanks a lot for your time!
      This is exactly what I was looking for.
      I had no clue about this way and it's sound like a better approach to manage the time shifting.

      I'll try, and let you know if it work as expected!

      Comment

      • Benjamin Auger
        Junior Member
        • Apr 2020
        • 4

        #4
        I confirm it works like a charm

        For instance what I do with zabbix_sender (in bash) :
        Code:
        echo hostName item.custom.key unixTimestamp value | zabbix_sender -z 127.0.0.1 -p 10051 -T -i -
        Btw I use this inside a bash loop (to retrieve data from last 180 days) and added it in a cron for every day gathering.

        Thanks a lot Tim!

        Comment

        • tim.mooney
          Senior Member
          • Dec 2012
          • 1427

          #5
          Glad to hear this works for your needs!

          Comment

          Working...