Hi,
I have to monitor two Oracle 9i instances called vipru and vipru2,
respectively. I have made a customized Mon script in Perl (called
oracle.monitor). Here is it (It is not too large):
--------
#!/usr/bin/perl -w
use strict;
use DBI;
########################################################
# Valores necesarios para la instancia "VIPRU"
########################################################
my $bd1 = "vipru";
my $usuario1 = "system";
my $password1 = "hidden";
my $conexion1 = 0;
my $sentencia1 = 0;
########################################################
# Valores necesarios para la instancia "VIPRU2"
########################################################
my $bd2 = "vipru2";
my $usuario2 = "system";
my $password2 = "hidden";
my $conexion2 = 0;
my $sentencia2 = 0;
########################################################
# Valores generales.
########################################################
my $sql = qq{ SELECT SYSDATE FROM SYS.DUAL };
my $valorDeRetorno = 0;
########################################################
# Comenzamos a inspeccionar la instancia Oracle "VIPRU"
########################################################
eval {
$conexion1 = DBI->connect("dbi:Oracle:$bd1",$usuario1,$password1,{ RaiseError
=> 1, AutoCommit => 0 }) || die "\nError al conectar: $DBI::errstr\n";
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$sentencia1 = $conexion1->prepare($sql);
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$sentencia1->execute();
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$sentencia1->finish();
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$conexion1->disconnect();
};
if ($@) {
$valorDeRetorno = 1;
}
########################################################
# Comenzamos a inspeccionar la instancia Oracle "VIPRU2"
########################################################
eval {
$conexion2 = DBI->connect("dbi:Oracle:$bd2",$usuario2,$password2,{ RaiseError
=> 1, AutoCommit => 0 }) || die "\nError al conectar: $DBI::errstr\n";
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$sentencia2 = $conexion2->prepare($sql);
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$sentencia2->execute();
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$sentencia2->finish();
};
if ($@) {
$valorDeRetorno = 1;
}
eval {
$conexion2->disconnect();
};
if ($@) {
$valorDeRetorno = 1;
}
########################################################
# Si ha habido algun error, lo devolvemos y mostramos un
# mensaje identificativo en pantalla.
########################################################
if ( $valorDeRetorno > 0 ) {
print "ERROR";
exit 1;
}
print "OK";
exit 0;
--------
It does not receive any arguments. When I try this in the Linux command line:
./oracle.monitor
With Oracle instances started up, the script prints "OK" in the console and
returns 0. Moreover, if I execute oracle.monitor and there is some problems
like no listener, instance closed... the script returns 1 and prints "ERROR".
It seems to be good. But when I modify mon.cf to use it:
------------
hostgroup oracleservers 192.168.1.1
watch oracleservers
service ServidorOracle
interval 30s
monitor oracle.monitor
allow_empty_group
period wd {Mon-Sun}
alertafter 2
alert bajar-heartbeat.alert
------------
It fails immediatelly and then It calls bajar-heartbeat.alert ¿?¿?¿?¿ I'm sure
I'm making a mistake, but I cannot find it... Can enyone help me?
bajar-heartbeat.alert contents only one line: "service heartbeat stop"
---
Manuel Domínguez Dorado
SADIEL, S.A.
Avda. Constitución blq. 4
Urbanización los Naranjos
06800 MERIDA
Tels. 924 373 620 Fax 924 370 073
http://www.sadiel.es e-mail: [EMAIL PROTECTED]
_______________________________________________
mon mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/mon