I’ve added netwatch to monitor every interface (we struggle with some APs not responding sometimes). To make sure I don’t get more than one email pr. incident (instead of periodic 30sec emails), i set the up/down-script enabled/disabled, but it seems silly coded. Could this be done better? I’m thinking a generic script, which is called with an argument or two to send an email.
add comment=GuestNetUp up-script="/tool e-mail send to=xxx subject=\"Guest net is up\" start-tls=yes body=\"Guest net 192.168.2.2 is up: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=GuestNetUp]; /tool netwatch enable [/tool netwatch find comment=GuestNetDown]" host=192.168.2.2 interval=30s
add comment=GastrofixNetDown down-script="/tool e-mail send to=xxx subject=\"Gastrofix net is down\" start-tls=yes body=\"Gastrofix net is down: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=GastrofixNetDown]; /tool netwatch enable [/tool netwatch find comment=GastrofixNetUp]" host=192.168.7.1 interval=30s
add comment=GastrofixNetUp up-script="/tool e-mail send to=xxx subject=\"Gastrofix net is up\" start-tls=yes body=\"Gastrofix net is up: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=GastrofixNetUp]; /tool netwatch enable [/tool netwatch find comment=GastrofixNetDown]" host=192.168.7.1 interval=30s
add comment=KontorDown down-script="/tool e-mail send to=xxx subject=\"Kontor net is down\" start-tls=yes body=\"Kontor net is down: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=KontorDown]; /tool netwatch enable [/tool netwatch find comment=KontorUp]" host=192.168.1.1 interval=30s
add comment=KontorUp up-script="/tool e-mail send to=xxx subject=\"Kontor net is up\" start-tls=yes body=\"Kontor net is up: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=KontorUp]; /tool netwatch enable [/tool netwatch find comment=KontorDown]" host=192.168.1.1 interval=30s
add comment=GastrofixMasterDown down-script="/tool e-mail send to=xxx subject=\"Gastrofix master is down\" start-tls=yes body=\"Gastrofix master is down: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=GastrofixMasterDown]; /tool netwatch enable [/tool netwatch find comment=GastrofixMasterUp]" host=192.168.7.41 interval=30s
add comment=GastrofixMasterUp up-script="/tool e-mail send to=xxx subject=\"Gastrofix master is up\" start-tls=yes body=\"Gastrofix master is up: \$[/system clock get time]\"; /tool netwatch disable [/tool netwatch find comment=GastrofixMasterUp]; /tool netwatch enable [/tool netwatch find comment=GastrofixMasterDown]" host=192.168.7.41 interval=30s