OP, if the reason you want OPNsense to notify you when internet is down is because you want to have it bring the internet back up, consider this thread: https://forum.opnsense.org/index.php?topic=40930.msg226932#new
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: ooker link=msg=83143#!/bin/sh
gatewayIP=$(netstat -4rn | grep default | awk '{print $2}')
wanInterface="em0"
echo "Gateway: $gatewayIP"
echo "WAN Interface: $wanInterface"
if [ -z $gatewayIP ]
then
echo "NO Gateway"
#Bring the interface down then up to renew the WAN DHCP
ifconfig $wanInterface down
ifconfig $wanInterface up
else
# if return = 0 then host is reachable
ping -c 1 $gatewayIP > /dev/null
if [ $? -eq 0 ]
then
echo "Gateway Reachable"
else
echo "Gateway Unreachable"
#Bring the interface down then up to renew the WAN DHCP
ifconfig $wanInterface down
ifconfig $wanInterface up
fi
fi