Dear Support,

We want to monitor the state of some databases asking via api rest. The JSON response has a variable lenght of database dictionaries as the DDBB are being created/deleted from time to time.

I made a static custom Rest sensor that discovers 3 channels for the 3 databases currently running, but if one more database is creted next days, it wont be added to monitoring automatically (see code below)

{
  "prtg": {
    "result": [
      {
        "channel": $.databases[0].name,
        "value": lookup($.databases[0].status, "ACTIVE", "INACTIVE"),
		"ValueLookup": "rest.api.sigea.system.status"
      },
      {
        "channel": $.databases[1].name,
        "value": lookup($.databases[1].status, "ACTIVE", "INACTIVE"),
		"ValueLookup": "rest.api.sigea.system.status"
      },
	  {
        "channel": $.databases[2].name,
        "value": lookup($.databases[2].status, "ACTIVE", "INACTIVE"),
		"ValueLookup": "rest.api.sigea.system.status"
      },
    ],
    "Text": $.databases[*].message
  }
}

Cuestion is, Is there any way to use a generic channel definition that allows to create one channel for each of the databases in the response automatically?

(PS: I read several times the manual of the Rest Custom Sensor and It's a little bit difficult to understand, so please, I kindly ask you to help me using my example if possible)


Article Comments