I have a template with one item. It checks the existence of a openvpn tunnel.
I have three triggers. One for "business hours", one for "non-business hours" and one for "weekends".
Business hrs are M-F 7am to 5pm.
Non-business hrs are M-F 5pm - 7am
Weekends are Saturdays 00:00 to 23:59:59 Sunday.
The following is the Business hours trigger:
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].max(300)}=0
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].time(0)}>070000
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].time(0)}<170000
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].dayofweek(0)}#6
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].dayofweek(0)}#7
When this trigger is fired, everything works for the most part.
The problem I'm having is that if the trigger remains active longer than 5pm on say, a Tuesday, I get a "Recovery" message for the business hours rule (because it's outside of the hours defined) and then I immediately get a notification for the "Non-Business Hours" trigger being tripped.
Is there any way to improve this?
I have three triggers. One for "business hours", one for "non-business hours" and one for "weekends".
Business hrs are M-F 7am to 5pm.
Non-business hrs are M-F 5pm - 7am
Weekends are Saturdays 00:00 to 23:59:59 Sunday.
The following is the Business hours trigger:
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].max(300)}=0
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].time(0)}>070000
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].time(0)}<170000
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].dayofweek(0)}#6
{Linux-Network-Interface-Tun0-TX-RX:system.run[ip addr | grep -i "tun0:" | wc -l || echo 0].dayofweek(0)}#7
When this trigger is fired, everything works for the most part.
The problem I'm having is that if the trigger remains active longer than 5pm on say, a Tuesday, I get a "Recovery" message for the business hours rule (because it's outside of the hours defined) and then I immediately get a notification for the "Non-Business Hours" trigger being tripped.
Is there any way to improve this?
Comment