Hi,
I have a user parameter called "camera1.status" - it looks like this:
This returns 0 when the camera is online, and something else when its not. Well, at least the bash part does (ping camara1 -c 1 -w 1 &>/dev/null; echo $?)
If I call this from Zabbix, I get the full output, even though I am piping the ping output to null:
I am expecting to see only 0 or another number. I should not see the actual output of the command - not sure how this is finding its way through. Once I have the 0 or other number, I will use preprocessing to change it to "Camera is up" or "Camera is down" as needed.
I am trying to figure out the regex I could use to match, but the fact that its multiline is really stumping me. I have tried several possibilities, and am using https://regex101.com/ to try and shape the regex. I can get it to match, but only line for line.
Any advice?
I have a user parameter called "camera1.status" - it looks like this:
Code:
UserParameter=camara1.pingstatus,ping camara1 -c 1 -w 1 &>/dev/null; echo $?
If I call this from Zabbix, I get the full output, even though I am piping the ping output to null:
Code:
0 PING camara1 (10.10.102.21) 56(84) bytes of data. 64 bytes from camara1 (10.10.102.21): icmp_req=1 ttl=64 time=0.240 ms --- camara1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.240/0.240/0.240/0.000 ms
I am trying to figure out the regex I could use to match, but the fact that its multiline is really stumping me. I have tried several possibilities, and am using https://regex101.com/ to try and shape the regex. I can get it to match, but only line for line.
Any advice?
Comment