We want to monitor a loadbalancer via REST-API (Rest-Custom Sensor) and get a JSON Response like the following:
{ "errorcode": 0, "message": "Done", "severity": "NONE", "servicegroup": [ { "servicegroupname": "placeholder-text", "state": "ENABLED", "servicetype": "HTTP", "servicegroupmember": [ { "servicegroupname": "placeholder-text?SERVER01?80", "port": 0, "avgsvrttfb": "0", "primaryipaddress": "x.x.x.64", "primaryport": 80, "servicetype": "HTTP", "state": "UP", "totalrequests": "3193139", "requestsrate": 0, "totalresponses": "3193031", "responsesrate": 0, "totalrequestbytes": "591593610", "requestbytesrate": 10, "totalresponsebytes": "3171602975", "responsebytesrate": 26, "curclntconnections": "1", "surgecount": "0", "cursrvrconnections": "6", "svrestablishedconn": "6", "curreusepool": "5", "maxclients": "0" }, { "servicegroupname": "placeholder-text?SERVER02?80", "port": 0, "avgsvrttfb": "0", "primaryipaddress": "x.x.x.65", "primaryport": 80, "servicetype": "HTTP", "state": "DOWN", "totalrequests": "3336147", "requestsrate": 0, "totalresponses": "3336045", "responsesrate": 0, "totalrequestbytes": "624119084", "requestbytesrate": 0, "totalresponsebytes": "3301098120", "responsebytesrate": 0, "curclntconnections": "0", "surgecount": "0", "cursrvrconnections": "0", "svrestablishedconn": "0", "curreusepool": "0", "maxclients": "0" }, { "servicegroupname": "placeholder-text?SERVER10?80", "port": 0, "avgsvrttfb": "0", "primaryipaddress": "x.x.x.73", "primaryport": 80, "servicetype": "HTTP", "state": "DOWN", "totalrequests": "2820384", "requestsrate": 0, "totalresponses": "2820282", "responsesrate": 0, "totalrequestbytes": "813913148", "requestbytesrate": 0, "totalresponsebytes": "2561866400", "responsebytesrate": 0, "curclntconnections": "0", "surgecount": "0", "cursrvrconnections": "0", "svrestablishedconn": "0", "curreusepool": "0", "maxclients": "0" } ] } ] }
We want to create the channels dynamically based on the number of members (servicegroupname) and the channels should have the name from the value "servicegroupname", these are the backend webservernames and the monitored value "requestrate" for example. How can we achieve this without creating a channel manually for every backend server. We want to reuse this template for other loadbalances services as well with more or less backend webservers.
We tried to build a query like this, but got no luck so far:
{ "prtg": { "result": [{ "unit": "Count", "value": {"host " + servicegroup.servicegroupmember[#0].servicegroupname: $.servicegroup.servicegroupmember[*].requestrate} }, ] } }
Regards
Add comment