check if squid is up

hi, i need a script to do something like this

Check if a port in a pc is opened
if yes do nothing
if not, disable some firewall/nat rules and send an email

my scripting skills are none… but if someone can help me with the first part (red bold line) then i can obtain the rest from other scripts

I couldn’t find a way to check a specific port so I created a queue for traffic coming from the proxy server and I know that if it drops below a certain level squid has probably failed.


:global proxy1rate ([/queue tree get “Proxy 1 Cache Hit” rate])
:if ($proxy1rate < 50000) do={/system script run “Proxy 1 - Disable Redirect”}
:if ($proxy1rate < 50000) do={/tool e-mail send to=“me@here.org” subject=“Proxy1 Below Threshold” body=("Proxy1 Below Threshold " . [/system clock get time])}