Hi !
I want to monitor TCP protocol in a WorkStation,
But I can’t use check_tcp in Nagios.
Who can show an idea.
Thanks so much
Hugolina
Hi !
I want to monitor TCP protocol in a WorkStation,
But I can’t use check_tcp in Nagios.
Who can show an idea.
Thanks so much
Hugolina
Here’s an idea:
#!/usr/bin/perl
use strict;
use Net::Telnet;
my $server = $ARGV[0];
my $port = $ARGV[1];
my $chaine = $ARGV[2];
my $sortie = sub { my $string = shift @_; print "Error on $server $port :".$string."! ! ! \n"; exit 2 ; } ;
my $telnet = new Net::Telnet (
Binmode => 0,
Telnetmode => 1,
Timeout=>25,
Port => $port,
Errmode=>$sortie);
$telnet->open("$server");
$telnet->waitfor("/$chaine/");
$telnet->close ();
print "Test $serveur $port OK\n";
exit 0;
hope this helps (you’ll need the Net::Telnet library; you can find it on search.cpan.org)
ps: server stands for your tcp server
port: …it’s a bit obvious
chaine: that’s the string of characters your script will be expecting (usually the prompt or the welcome message).
Of course, you can add identification with the right parameters in the “New” constructor (again, refer to cpan.org :))