Here is Python code that checks telnet status.
import sys
import telnetlib
#host=sys.argv[1]
#portno=sys.argv[2]
host=input("enter hostname:")
portno=input("enter host number:")
try:
conn = telnetlib.Telnet(host,portno)
response = host+' ' + portno +' - Healthy'
except:
response = host+' ' + portno +' - Unhealthy'
finally:
print(response)
Top comments (0)