#!/usr/bin/perl
use IO::Socket;
@servers = ( 'one', 'two', 'three');
foreach (@servers) {
$socket = IO::Socket::INET->new( PeerAddr => $_, PeerPort => '22', Proto => 'tcp'); if ($socket) { #print $_ . " SSH is UP" . "\n"; } else { open(MAIL, "| /usr/sbin/sendmail -oi -n -t"); print MAIL << EMAIL_TO_USER; To: unix\@whoever.com, unixunix\@whoever.com From: mon\@whoever.com Subject: MON Alert - SSH on $_ is DOWN Issue: SSH Port on $_ is DOWN. Business Impact: Cannot remote login into $_. Historical Fixes: Restart SSH via svcadm refresh ssh or service sshd restart EMAIL_TO_USER close MAIL; print $_ . " SSH is DOWN" . "\n"; } };
Recent Comments