I have created a REST Custom Sensor to Monitor our VPN Tunnels on a Palo Alto Firewall.
We have over 50 Tunnels so my question. Is it possible to just create the tunnels that startswith "at00" ?
Example from a Tunnel Name "name": "at00_vpn-de02:de02",
"result": [ "valueLookup": "lookup-file", "value": {#1: $..({ @.name : lookup(@.state, "active","init","inactive") }).* }, }
Thanks for you help
Article Comments
Hi and thanks for your reply,
is it possible to count all tunnels with one sensor and if the status of a tunnel goes to inactive an output via channel text will be displayed.
Nov, 2020 - Permalink
With a script, you can absolutely count the number of tunnel according to their status (Active/Down) and then, return the names of the tunnels in Down state in the sensor message field.
Therefore, if you monitor both channels mentioned above, you have to use the EXE/Script Advanced sensor. Here is the output you could return with the script into PRTG:
<prtg> <result> <channel>Active</channel> <value></value> </result> <result> <channel>Down</channel> <value></value> </result> <text></text> </prtg>
Then, for each channel you return the corresponding value, and add the name of each Down tunnel inside <text></text>.
Kind regards.
Nov, 2020 - Permalink
Hi, now i have got the right filter
"value": { "Tunnel "+ #2 +"": $..entry[60:68]({ @.name : lookup(@.state, "active","init","inactive")}).*}
Channels will be created with the Tunnel Name and there Status.
Nov, 2020 - Permalink
Hello Philipp,
As filtering by name is not possible, you can indeed match multiple children by using [<begin>:<end>] as you did. Thank you for sharing your template.
I just add the manual of the Rest Custom sensor as documentation for this article. The manual includes information on the JSON Path as well as functions available: https://www.paessler.com/manuals/prtg/rest_custom_sensor#jsonpath
Regards.
Nov, 2020 - Permalink
Hello Philipp,
Thank you for your message.
I'm afraid that it's not possible to apply filter on the name via the template. Therefore, I invite you to use our EXE/Script, EXE/Script Advanced sensors instead.
Regarding custom sensors, please have a look to this manual: https://www.paessler.com/manuals/prtg/custom_sensors
Kind regards.
Nov, 2020 - Permalink