msgbartop
世界上的一队小小的漂泊者呀,请留下你们的足印在我的文字里
msgbarbottom

08 七 10 Nagios ndoutils_mysql

khan.chan {at} virest.org

Version:20100324

Version:20100707

我们安装配置多为默认在CentOS release 5.4 (Final),非特例不做过多描述

最新稳定版本:http://www.nagios.org/download/core/thanks/

nagios-3.2.1.tar.gz nagios-plugins-1.4.14.tar.gz

Nagios官方有份《Fedora Quickstart》

http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html

./configure –enable-embedded-perl –with-command-group=nagcmd
make all;make install;make install-init;make install-config;make install-commandmode;make install-webconf

注:
gnutls 是一套实现了传输层安全协议(TLS) 1.0和安全套接字层协议(SSL) 3.0的可移植软件库

./configure –with-nagios-user=nagios –with-nagios-group=nagios –enable-extra-opts –enable-redhat-pthread-workaround –enable-perl-modules
make;make check;make install

安装NDOUtils
>perl CPAN -e shell
install DBI
install DBD::mysql

# ln -s /opt/mysql/include/* /usr/include/
# ln -s /opt/mysql/lib/* /usr/lib/
# echo ‘/usr/lib’ >> /etc/ld.so.conf
# ldconfig -v

tar xvzd ndoutils-1.4b9.tar.gz
./configure –perfix=/usr/local/nagios –enable-mysql –disable-pgsql LDFLAGS=-L/opt/mysql/lib –with-mysql-inc=/opt/mysql/include/mysql –with-mysql-lib=/opt/mysql/lib/mysql

cp ./src/ndomod-3x.o /usr/local/nagios/bin/
cp ./src/ndo2db-3x /usr/local/nagios/bin/
cp ./src/log2ndo /usr/local/nagios/bin/
cp ./src/file2sock /usr/local/nagios/bin/
chown nagios:nagios /usr/local/nagios/bin/*

cp ./config/ndo* /usr/local/nagios/etc/
chown nagios:nagios /usr/local/nagios/etc/*

创建NDO的数据库(dbname:nagios)
>create database `nagios` default character set utf8 collate utf8_general_ci;
>grant all on nagios.* to nagios@localhost identified by ‘passwd;
>flush privileges;

cd ./db/
./installdb -u root -p passwd -h localhost -d nagios

或者:mysql -uroot -p passwd -D nagios -h localhost < ./db/mysql.sql

修改/usr/local/nagios/etc/ndo2db.cfg
db_user=nagios
db_pass=access

vi /usr/local/nagios/etc/nagios.cfg
event_broker_options=-1
broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg

/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg

echo ‘/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg’ >> /etc/rc.local

service nagios restart

PS: ubuntu 9.10 server

apt-get install nagios3 nagios3-common ndoutils-nagios3-mysql ndoutils

安装好nagios3后需要密码才能进入nagios,  http://ip/nagios3/

#htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

#vi /etc/nagios3/nagios.cfg

broker_module=/usr/lib/ndoutils/ndomod-mysql-3x.o config_file=/etc/nagios3/ndomod.cfg

在安装ndoutils中”Configure database for ndoutils-mysql with dbconfig-common?”部分请选择”Yes”

之后可配置好ndoutils DB.

Tags: ,

24 一 10 nagios nrpe

khan.chan {at} virest.org

The NRPE addon consists of two pieces:
– The check_nrpe plugin, which resides on the local monitoring machine
– The NRPE daemon, which runs on the remote Linux/Unix machine

一. Download nrpe and make install

  1. ./configure –prefix=/usr/local/nagios
  2. make all
  3. make install-plugin
  4. make install-daemon
  5. make install-daemon-config
  6. chown -R nagios:nagios /usr/local/nagios
  7. # vi /usr/local/nagios/etc/nrpe.cf

allowed_hosts=127.0.0.1,192.168.2.x (添加监控机IP)

  1. # /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
  2. #/usr/local/nagios/libexec/check_nrpe -H  ip(被监控机器ip)

ps:  让NRPE daemon成为xinetd 下的服务来守护,可如下操作:

./configure –prefix=/usr/local/nagios;make all;make install-plugin;make install-daemon;make install-daemon-config;make install-xinetd

编辑/etc/xinetd.d/nrpe 在only_from       = 127.0.0.1 192.168.2.x 中添加监控机IP

在/etc/services加入服务:

nrpe                       5666/tcp                         #NRPE

重启xinetd:

#service xinetd restart




Tags: ,