What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Create channels dynamically using REst Custom Sensor

Votes:

0

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)

generic-channel prtg rest

Created on Mar 8, 2023 5:14:47 PM

Last change on Mar 9, 2023 6:17:25 AM by  Felix Wiesneth [Paessler Support]



Replies

Nobody has replied yet


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.