nagios自带的oracle监控check_oracle功能较少,可以采用perl写的check_oracle_health脚本1、安装check_oracle_health
nagios自带的oracle监控check_oracle功能较少,,可以采用perl写的check_oracle_health脚本
1、安装check_oracle_health
wget
wget
版本任意选(此处使用1.6.3)
tar zxvf check_oracle_health-1.6.3.tar.gz
cd check_oracle_health-1.6.3
./configure --prefix=/usr/local/nagios/ --with-nagios-user=nagios --with-nagios-gourp=nagios --with-mymodules-dir=/usr/local/nagios/libexec/ --with-mymodules-dyn-dir=/usr/local/nagios/libexec/
#指定用户、用户组以及目标路径等
make all
make install
2、设定系统环境变量
在root下,编辑.bash_profile,插入oracle用户的环境变量,要和oracle用户的.bash_profile文件中设置的一样
export path
unset username
ps1=\[\e[0m\][\u@\[\e[32;1m\]`/sbin/ifconfig eth0 | grep inet addr | sed -e s/^.*inet addr:\(.*\) bcast.*$/\1/`\[\e[0m\]\w]#
export ps1
export oracle_base=/u01/app/oracle
export oracle_home=$oracle_base/product/10.2.1/db
export path=$path:$oracle_home/bin
export oracle_sid=qiyue
3、安装perl的oracle插件
① wget
tar zxvf dbi-1.609.tar.gz
cd dbi-1.609
perl makefile.pl
make all
make install
② wget
tar -zxvf dbd-oracle-1.24a.tar.gz
cd dbd-oracle-1.24
perl makefile.pl #此处如果之前不设定root的oracle环境变量会报错
make all
make install
③ 如果在运行脚本时报错
can't locate time/hires.pm in @inc (@inc contains: /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi
wget
tar zxvf time-hires-01.02.tar.gz
cd time-hires-01.02
perl makefile.pl
make all
make install
4、测试
cd /usr/local/nagios/libexec
./check_oracle_health --connect=nagios --username system --password ora123 --mode connected-users
ok - 11 connected users | connected_users=11;50;100
./check_oracle_health --connect=nagios --username system --password ora123 --mode=tnsping
ok - connection established to nagios.
5、其余配置和nagios配置相同