check_telnet

Bookmark and Share

Rating
0 votes
Favoured:
0
Hits
65950
Files:
FileDescription
check_telnet.plProduction release. All reported bugs addressed.
Script to check using Net::Telnet. Expect-like passing of commands/arguments and returning data. Verifies serial console (or telnet...) is responding and that its banner matches some string (like its hostname).
Primary uses:
1) check telnet banner for a matching return string.
2) log in via telnet and run specified command, check output for string.

Handy for:
-Screen scraping last console output from Cyclades ACS (or any console server supporting terminal buffering) for automatic inclusion in crash report, Nagios alert email, etc.

-Periodically checking to make sure serial console is still attached/working... for when you DO need it.

-Using in a custom host check, to determine if host is _really_ down and not responding on serial console.

-Last-ditch eventhandler usage, for starting SSH if dead (or any other arbitrary thing... as long as you can still log in via console).


/ command run/output example:

root@monitor02 libexec# ./check_telnet.pl -H deathstar1001-console -C 'date --iso-8601' -user username -password 'password'
date --iso-8601
2006-12-15


/ testing console login banner:

root@monitor02 libexec# ./check_telnet.pl -H deathstar1001-console -M deathstar1001
OK: host (deathstar1001) matches login banner.

root@monitor02 libexec# ./check_telnet.pl -H deathstar1001-console -M deathstar1002
CRITICAL: host (deathstar1002) did not match login banner.