Oracle test without oracle client

riky.none riky.none at email.it
Mon Sep 24 10:58:55 CEST 2007


is possible check Oracle listening service  using telnet??

root at nagios:/usr/lib/nagios/plugins# telnet 10.0.2.122 1521
Trying 10.0.2.122...
Connected to 10.0.2.122.
Escape character is '^]'.

I think that one multipurpose script that using telnet is god idea

i find one script in perl but i know perl (i dont know c, bash, php 
pyton ecc ecc ecc)




#!/usr/bin/perl -w
use strict;

use utils qw(%ERRORS $TIMEOUT);

# in case we just hang -
$SIG{ALRM} = sub {
print "CRITICAL: Plugin timed out.\n";
exit 2
};

alarm(10);

my ($host, $key, $remote) = (at)ARGV;
unless ($host and $key and $remote) {
die "Usage: $0 hostname ssh_key remote_mail_server\n";
}

# default error
# my $connect_result = "Remote Test Failure";

open (SSH, "ssh -i $key $host telnet $remote 25|") or die "Can't open pipe:
$!";

# iterate through the loop and skip lines that don't have what we want.
then, store the last var - we know the telnet action is 4 lines
while (<SSH>){
next if /^Trying/;
next if /^Connected/;
next if /^Escape/;
if ($_ =~ /^220/) {
print "$_ this works";
exit($ERRORS{'OK'});
}
else {
print "Connect died at: $_";
exit($ERRORS{'CRITICAL'});
}
close SSH;
}
print "fell thru";
exit($ERRORS{'WARNING'});
close SSH;

i modify the script isolating the cycle while and not using paramiter 
but not work
open (CONNECTION, "telnet 10.0.2.122 1521  |") or die "Can't open pipe:




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list