Ad Widget

Collapse

Get ok notification after discovery item deleted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • The_Shadow
    Junior Member
    • Mar 2024
    • 6

    #1

    Get ok notification after discovery item deleted


    Hi all,
    i get this json with discovery rule and with array key called "components" i create item based on lld macro and prototype item.
    All work perfect but the json array is empty when no problem are detected.
    When the object array is not empty i get problem message but how can i get resolved message when the problem are resolved and the array came back empty?
    Someone can help me
    Thank you a lot

    Code:
    {
    "page": {
    "id": "0f54fx204jpt",
    "name": "Atlassian",
    "url": "https://status.atlassian.com",
    "updated_at": "2024-03-11T18:57:44Z"
    },
    "status": {
    "description": "Partial System Outage",
    "indicator": "major"
    },
    "components": [
    {
    "created_at": "2014-05-03T01:22:07.274Z",
    "description": null,
    "id": "b13yz5g2cw10",
    "name": "API",
    "page_id": "0f54fx204jpt",
    "position": 1,
    "status": "partial_outage",
    "updated_at": "2014-05-14T20:34:43.340Z"
    },
    {
    "created_at": "2014-05-03T01:22:07.286Z",
    "description": null,
    "id": "9397cnvk62zn",
    "name": "Management Portal",
    "page_id": "0f54fx204jpt",
    "position": 2,
    "status": "major_outage",
    "updated_at": "2014-05-14T20:34:44.470Z"
    }
    ]
    }
  • The_Shadow
    Junior Member
    • Mar 2024
    • 6

    #2
    Hi, please can someone help me
    Thank you

    Comment

    • Semiadmin
      Senior Member
      • Oct 2014
      • 1625

      #3
      what do the trigger and item prototypes look like?

      Comment

      • PeterZielony
        Senior Member
        • Nov 2022
        • 146

        #4
        if this is master item .. you could have another item prototype same way as for your original LLD (dependent) on this JSON to count the array if a problem exists (with preprocessing and json path that compares ID too). When you do data type - set it to numeric value (of the count)

        something like this:
        $[?(@.id=='{#PROBLEM_ID}' && @.status=='{#PROBLEM_STATUS}')].length()
        (edit: syntax might be wrong - but you get the idea)

        But .. whether using another item prototype is ok or not - cant tell as I don't know how you structured LLD macros and item prototype - same for macros and how your LLD works (but you can use syntax above to construct it in your scenario)

        Then trigger recovery expression on this item if it 0 - problem solved, 1 - problem still exists.

        I hope this make sense a bit.
        json path supported functions:

        .length() function

        this won't work if "discovery item is deleted" though - it will exist until it is not discovered plus "keep lost resources for XYZ time" (discovery settings) - but this way it will set it as resolved as soon it disappear from discovery json
        Last edited by PeterZielony; 12-03-2024, 19:00.

        Hiring in the UK? Drop a message

        Comment

        • The_Shadow
          Junior Member
          • Mar 2024
          • 6

          #5
          Hi, thanks for yours answer. I'm trying with @PeterZielony solution.
          If can help, here the actual configuration

          Discovery Rule main configuration:
          Click image for larger version  Name:	image.png Views:	0 Size:	25.1 KB ID:	480805
          Actual Preprocessing discovery rules:
          Click image for larger version  Name:	image.png Views:	0 Size:	16.2 KB ID:	480806

          Actual LLD Macros discovery rules:
          Click image for larger version  Name:	image.png Views:	0 Size:	26.4 KB ID:	480807

          Main of first prototype configuration:
          Click image for larger version  Name:	image.png Views:	0 Size:	20.8 KB ID:	480808

          Preprocessing for first prototype configuration:
          Click image for larger version  Name:	image.png Views:	0 Size:	22.3 KB ID:	480809

          Thanks a lot for new answer








          Last edited by The_Shadow; 15-03-2024, 13:57.

          Comment

          • The_Shadow
            Junior Member
            • Mar 2024
            • 6

            #6
            Hi @PeterZielony ,
            thanks a lot for your help.

            I created master item as http agent type and preprocessing jsonpath equal to $.components
            Than i created discovery rule depends on master item with this LLD macros
            Click image for larger version

Name:	image.png
Views:	233
Size:	23.4 KB
ID:	480846

            Then i created prototype item like this with preprocessing jsonpath equal to $.[?(@.id== "{#ID}")].length()
            Click image for larger version

Name:	image.png
Views:	194
Size:	24.5 KB
ID:	480847

            Then i created trigger prototype like this:
            Click image for larger version

Name:	image.png
Views:	188
Size:	40.7 KB
ID:	480848

            With this configuration i get this resolved notification
            Click image for larger version

Name:	image.png
Views:	186
Size:	27.0 KB
ID:	480849


            Do you know how to change "Operational data" value with the value inside LLD macro {#STATUS}?
            Thank you​​​

            Comment


            • PeterZielony
              PeterZielony commented
              Editing a comment
              I hope you got it sorted. I wasn't around for some time to check your answer (time off)
          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4807

            #7
            Add {#STATUS} to opdata line...

            Comment

            Working...