Ad Widget

Collapse

LLD not creating items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jazzman
    Junior Member
    • Aug 2024
    • 7

    #1

    LLD not creating items

    I have a bunch of web apps presenting a /healthcheck JSON report like this:

    Code:
    {
        "entries": {
            "Application status": {
                "data": {},
                "description": null,
                "duration": "00:00:00.0000007",
                "exception": null,
                "status": "Healthy",
                "tags": []
            },
            "Worker running": {
                "data": {},
                "description": "A healthy result.",
                "duration": "00:00:00.0000003",
                "exception": null,
                "status": "Healthy",
                "tags": []
            }
        },
        "status": "Healthy",
        "totalDuration": "00:00:00.0000010"
    }
    I created a template and added an item like this:
    Click image for larger version

Name:	image.png
Views:	316
Size:	65.1 KB
ID:	489257

    Then added a discovery rule to that template:
    Click image for larger version

Name:	image.png
Views:	237
Size:	43.9 KB
ID:	489258
    The item extracts the health check names by doing JavaScript preprocessing to get an array of names:
    Code:
    return JSON.stringify(Object.keys(JSON.parse(value).entries))
    And then define an LLD macro:
    Click image for larger version

Name:	image.png
Views:	237
Size:	29.2 KB
ID:	489259
    Then added an item prototype for the discovery rule:
    Click image for larger version

Name:	image.png
Views:	236
Size:	52.7 KB
ID:	489260
    It has the preprocessing setup like this:
    Click image for larger version

Name:	image.png
Views:	230
Size:	48.2 KB
ID:	489261
    Then added a host and assigned the template.
    I can see the report item and latest value (the JSON) so that works; I see the discovery rule, it is enabled and green. However, 'Test' button is grayed out, so have no clue how to track this further.
    But on the host, the items don't appear.

    I used the 'Test' buttons on the Preprocessing tabs with input values to try to see if my code works.
    I tried setting server DebugLevel up to 5 and try track what is he doing internally but can't find anything useful.

    How to debug this? Where to look next? What could be wrong? I thought about that HCNAME which in my case contains spaces and it will go in the key. Is that an issue?
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    I am not too sure in this, but do you really need "$.entries[{#HCNAME}].status". You previously already preprocess it out in discovery... Shouldn't "$[{#HCNAME}].status" be enough? and you can always wrap object names in ''-s
    ['<name>'] Match object property by name.


    But as I said, I am not too sure in this.. :P jsonpath gives me headache every time..

    Comment

    • jazzman
      Junior Member
      • Aug 2024
      • 7

      #3
      I think it is “$.entries[‘{#HCNAME}’].status” because you still pull the data from the original JSON report as the master item for the item prototype is still the report.

      I tried using simple quotes everywhere, still nothing. Problem is that I find no error anywhere, have no idea how to debug this.

      Any other ideas?

      Comment

      Working...