1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| use strict;
use DBI;
use DBD::Oracle;
$ENV{'ORACLE_HOME'} = "/app/oracle/product/11.2/db_1";
$ENV{'LD_LIBRARY_PATH'} = "/app/oracle/product/11.2/db_1/lib";
my $dbh;
my $selecth;
my $error;
#try to check if zabbix knows about this IP
eval {
$dbh = DBI->connect("DBI:Oracle:$DB_NAME",
$DB_USER,
$DB_PASS,
{'RaiseError' => 1}
);
$selecth = $dbh->selectrow_hashref("select h.hostid hostid, h.host host, i.ip ip from hosts h, interface i where h.hostid = i.hostid and i.type = 2 and i.main = 1 and i.ip='$ipaddress'"); |
Partager