Hi,
I’m trying to figure out where I’m going wrong with a script that I have written. This is my first script, so guess its a syntax error somewhere.
I have a global array called $avocet, which is used with the script below. I aim to have this script run every minute, and the aim is that after 5 minutes of downtime, it should be reported to me via email. I used netwatch, but I was inundated with emails from my router. If anyone can help me with this it would be greatly appreciated, if anyone has an alternative way of doing what I want, pease also let me know
:local p [/ping ($avocet->"ip") count=3];
:if ($p = 0) do={
:set ($avocet->"counter") (($avocet->"counter") + 1);
:log info "avocet failed";
:if (($avocet->"counter") = 5) do={
/tool email send to=me@myemailaddress.co.uk subject="Avocet Mast DOWN";
}
} else={
:if (($avocet->"counter") != 0) do={
:log info "avocet up";
/tool e-mail send to=me@myemailaddress.co.uk subject="Avocet Mast UP";
}
:set ($avocet->"counter") 0;
}
Kind regards
James