nagios监控oracle
一、增加用户并设置密码
- #useradd nagios
- #passwd nagios
二、安装nagios插件
上传nagios-plugins插件
解压缩
tar -zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
编译安装
- ./configure
- make
- make install
这一步完成后会在/usr/local/nagios/下生成两个目录libexec和share
- #ls /usr/local/nagios/
修改目录权限
- #chown nagios.nagios /usr/local/nagios
- #chown -R nagios.nagios /usr/local/nagios/libexec
安装nrpe
上传nrpe-2.12.tar.gz
解压缩
- #tar -zxvf nrpe-2.12.tar.gz
- #cd nrpe-2.12
编译安装
- #./configure
- #make all
安装check_nrpe这个插件
- #make install-plugin
安装deamon
- #make install-daemon
安装配置文件
- #make install-daemon-config
安装xinetd脚本
- make install-xinetd
编辑这个脚本
- vi /etc/xinetd.d/nrpe
- service nrpe
- {
- flags = REUSE
- socket_type = stream
- port = 5666
- wait = no
- user = nagios –>修改为oracle用户
- group = nagios
- server = /usr/local/nagios/bin/nrpe
- server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
- log_on_failure += USERID
- disable = no
- only_from = 127.0.0.1在后面增加监控主机的地址10.30.1.82,以空格间隔
- }
编辑/etc/services文件,增加NRPE服务
- #vi /etc/services
- nrpe 5666/tcp # nrpe
重启xinetd服务
- #service xinetd restart
查看NRPE是否已经启动
- #netstat -at|grep nrpe
- #netstat -an|grep 5666
测试NRPE是否则正常工作
- #/usr/local/nagios/libexec/check_nrpe -H localhost
会返回当前NRPE的版本
NRPE v2.8.1
编辑nrpe.cfg增加如下命令使其可以监控oracle
- command[check_oracle_tns]=/usr/local/nagios/libexec/check_oracle –tns orcl
- command[check_oracle_db]=/usr/local/nagios/libexec/check_oracle –db orcl
- command[check_oracle_login]=/usr/local/nagios/libexec/check_oracle –login orcl
- command[check_oracle_cache]=/usr/local/nagios/libexec/check_oracle –cache orcl system oracle 80 90
- command[check_oracle_tablespace]=/usr/local/nagios/libexec/check_oracle –tablespace orcl system oracle EXAMPLE 90 80
编辑命令之后,Nagios监控oracle便不再是一件难事儿。
【编辑推荐】