Hi All
I try to creat a REST custom sensor that counts the number of items in the response array.
Response:
{ "TicketID": [ "156319", "156312", "156050", "155987", "155929", "155897", "155895", "155887", "155050", "154801", "154369", "136742" ] } **Template (not working):** { "prtg": { "result": [ { "channel": "Total count" , "value": len($.*), "unit": "Count" } ] } }
Problem: In PRTG it counts as "1"
If I try without len() -> "value": $.* I get the array of TicketID:
Could not create channel Total count0: expected number but got [156319 156312 156310 156254 156242 156228 156158 156094 156050 155987 155929 155897 155895 155887 155738 155667 155476 155466 155412 155376 155050 154801 154369 154344 153803 152947 152107 150923 150558 147733 143883 143180 136742] ([]interface {}).
Is "len()" the wrong function and how can I count the entries in this array?
Thanks and best regards Manuel
Add comment