To check the SSH service (default port 22):
nc -z $IP 22
To check the XML Management Interface (default port 5550):
nc -z $IP 5550
To check the SNMP (UDP port 161):
nc -zu $IP 161
If connection is successful, it will report a message like:
Connection to $IP 22 port [tcp/ssh] succeeded!
and exit with 0.
Reference: nc(1) – Linux man page