Ad Widget

Collapse

LLD / JSON / TRIGGER

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HeadQuaker
    Member
    • Jul 2015
    • 58

    #1

    LLD / JSON / TRIGGER

    Hello,

    I Have a script that return that JSON

    {
    "data": [
    {
    "DC": "DC1",
    "LASTSYNC": "09/07/2021 10:10:35",
    "LASTSYNCRESULT": "0"
    },
    {
    "DC": "DC2",
    "LASTSYNC": "09/07/2021 10:03:28",
    "LASTSYNCRESULT": "0"
    },
    {
    "DC": "DC3",
    "LASTSYNC": "09/07/2021 09:58:45",
    "LASTSYNCRESULT": "0"
    },
    {
    "DC": "DC4",
    "LASTSYNC": "09/07/2021 10:01:36",
    "LASTSYNCRESULT": "0"
    },
    {
    "DC": "DC5",
    "LASTSYNC": "09/07/2021 10:12:46",
    "LASTSYNCRESULT": "0"
    },
    {
    "DC": "DC6",
    "LASTSYNC": "09/07/2021 10:12:57",
    "LASTSYNCRESULT": "0"
    }
    ]
    }
    I can have that format too, i do not know which one i should use.
    {
    "data":[
    {"{#DC}":"DC1",
    "{#LASTSYNC}":"09/07/2021 10:40:35",
    "{#LASTSYNCRESULT}":"0"},
    {"{#DC}":"DC2",
    "{#LASTSYNC}":"09/07/2021 10:48:27",
    "{#LASTSYNCRESULT}":"0"},
    {"{#DC}":"DC3",
    "{#LASTSYNC}":"09/07/2021 10:43:45",
    "{#LASTSYNCRESULT}":"0"},
    {"{#DC}":"DC4",
    "{#LASTSYNC}":"09/07/2021 10:46:36",
    "{#LASTSYNCRESULT}":"0"},
    {"{#DC}":"DC5",
    "{#LASTSYNC}":"09/07/2021 10:48:40",
    "{#LASTSYNCRESULT}":"0"},
    {"{#DC}":"DC6",
    "{#LASTSYNC}":"09/07/2021 10:48:43",
    "{#LASTSYNCRESULT}":"0"}
    ]
    }


    What should i do to have a trigger that check is the LASTSYNCRESULT <> 0 for each DC, so i mean it should be in LDD ?


    Regards
    Last edited by HeadQuaker; 07-09-2021, 10:52.
  • HeadQuaker
    Member
    • Jul 2015
    • 58

    #2
    Hello thanks, I have got that error, the same i had when i tried. :

    Preprocessing failed for: {
    1. Failed: cannot extract value from json by path "$.data": cannot parse as a valid JSON object: invalid object name at: ''

    Into last values i have only { showing.

    Maybe my json is not well generated (come from powershell script)
    Last edited by HeadQuaker; 07-09-2021, 15:49.

    Comment

    • HeadQuaker
      Member
      • Jul 2015
      • 58

      #3
      hum that's strange so, which one ? the first or the 2nd
      how do you try with my json ?
      Can you share a command to be sure i am doing it right ?
      Last edited by HeadQuaker; 08-09-2021, 09:36.

      Comment

      • HeadQuaker
        Member
        • Jul 2015
        • 58

        #4
        hum maybe it does not work because it comes from a windows server because i did the same thing.
        Data are sent to the zabbix server but it seems that it could not read them.
        Click image for larger version

Name:	48511.png
Views:	338
Size:	1.7 KB
ID:	431195

        Click image for larger version

Name:	48510.png
Views:	300
Size:	16.0 KB
ID:	431194
        Last edited by HeadQuaker; 08-09-2021, 10:29.

        Comment

        • HeadQuaker
          Member
          • Jul 2015
          • 58

          #5
          That's strange because the file is really simple

          Click image for larger version

Name:	48513.png
Views:	310
Size:	26.2 KB
ID:	431202
          Attached Files
          Last edited by HeadQuaker; 08-09-2021, 10:53.

          Comment

          • HeadQuaker
            Member
            • Jul 2015
            • 58

            #6
            I have made it in one line, i have the same issue.
            Click image for larger version  Name:	48513.png Views:	0 Size:	26.2 KB ID:	431208

            Comment

            • HeadQuaker
              Member
              • Jul 2015
              • 58

              #7
              hum always a loss of time with zabbix
              There is nothing on their site which can help.

              To be clear :
              Data are coming into the item BUT it seems that the next step is failing.
              Last edited by HeadQuaker; 08-09-2021, 14:16.

              Comment

              • HeadQuaker
                Member
                • Jul 2015
                • 58

                #8
                Ok i have managed to make a readable json but now, it seems that the trigger is not working despite the fact the value is in error.

                Comment

                • HeadQuaker
                  Member
                  • Jul 2015
                  • 58

                  #9
                  It's working really thanks to you
                  I've passed the json using the file directly thru the send.
                  I am understanding the process better now.
                  Last edited by HeadQuaker; 08-09-2021, 17:05.

                  Comment

                  Working...