I have a bunch of web apps presenting a /healthcheck JSON report like this:
I created a template and added an item like this:

Then added a discovery rule to that template:
The item extracts the health check names by doing JavaScript preprocessing to get an array of names:
And then define an LLD macro:
Then added an item prototype for the discovery rule:
It has the preprocessing setup like this:
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?
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"
}
Then added a discovery rule to that template:
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))
Then added an item prototype for the discovery rule:
It has the preprocessing setup like this:
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?
Comment