不安装oracle客户端,使用sqlplus连接oracle(大部分转载,部分进行修改)

nagios 不安装oracle客户端,使用sqlplus连接oracle
在oracle官网下载instant
client
下载地址
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
版本
Version 11.1.0.7.0
Instant Client Package – Basic: All files required to run
OCI, OCCI, and JDBC-OCI
applications
instantclient-basic-linux32-11.1.0.7.zip
Instant Client
Package – SQL*Plus: Additional libraries and executable for running SQL*Plus
with Instant
Client
instantclient-sqlplus-linux32-11.1.0.7.zip
解压,将目录中所有以lib开头的文件copy到/usr/lib下,将sqlplus拷贝到/usr/sbin下,并执行
# ldconfig -p 生成动态连接库。
测试,# sqlplus
system/1234567890@192.168.1.4:1521/orcl
正常将显示
SQL*Plus: Release 10.2.0.4.0
– Production on Mon Aug 17 16:31:08 2009
Copyright (c) 1982, 2007, Oracle.
All Rights
Reserved.
监控脚本
check_oracle_instant监控脚本,用perl写的,在exchange.nagios.org站点可以找到。

将这个脚本copy到/usr/local/nagios/libexec下,这是你的nagios安装目录,这个脚本默认是监控windows下oracle服务器的(不能确定,不过我的下载下来后没有任何更改就可监控windows下的oracle数据库状态)。
配置nagios
定义命令文件
vi
/usr/local/nagios/object/etc/commands.cfg,加入
### CHECK ORACLE ###
define
command {
command_name check_oracle_instant
command_line perl
$USER1$/check_oracle_instant $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
$ARG4$;参数含义请看下面实例
}
定义服务文件
define service {
host_name
hostname
service_decription ORACLE: check_login_health
check_command
check_oracle_instant!1521(端口)!orcl(SID)!system(username)!1234567890(password)
}
重启nagios服务即可。

posted @ 2015-12-22 10:12  burningsky  阅读(896)  评论(0编辑  收藏  举报