原文地址:https://www.cnblogs.com/caoguo/p/5022645.html # Nagios install ndoutils # 安装ndoutils插件 [root@Cagios ~]# yum install -y mysql-devel perl-DBD-MySQL [root@Cagios ~]# wget http://nchc.dl.sourceforge.net/project/nagios/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gz [root@Cagios src]# tar zxf ndoutils-2.0.0.tar.gz [root@Cagios src]# cd ndoutils-2.0.0 [root@Cagios ndoutils-2.0.0]# ./configure --prefix=/usr/local/nagios \ --with-ndo2db-user=nagios --with-ndo2db-group=nagcmd [root@Cagios ndoutils-2.0.0]# make && make install [root@Cagios ndoutils-2.0.0]# cp daemon-init /etc/init.d/ndo2db [root@Cagios ndoutils-2.0.0]# chmod 755 /etc/init.d/ndo2db [root@Cagios ndoutils-2.0.0]# cp config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg [root@Cagios ndoutils-2.0.0]# cp config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg [root@Cagios ndoutils-2.0.0]# chown nagios.nagcmd /usr/local/nagios/etc/ndo* [root@Cagios ndoutils-2.0.0]# chmod 664 /usr/local/nagios/etc/ndo* # 建立数据库及数据帐户 [root@Cagios ~]# mysql -uroot -p Enter password: mysql> create database nagios; mysql> create user nagios@localhost identified by 'nagios'; mysql> grant all on nagios.* to nagios@localhost; mysql> flush privileges; mysql> quit # 导入表结构 [root@Cagios ndoutils-2.0.0]# cd db/ [root@Cagios db]# ./installdb -u nagios -p nagios -h localhost -d nagios # ndo2db配置数据连接 [root@Cagios ~]# cd /etc/nagios/ [root@Cagios nagios]# vi ndo2db.cfg ndo2db_user=nagios ndo2db_group=nagcmd db_name=nagios db_user=nagios db_pass=nagios [root@Cagios ~]# /etc/init.d/ndo2db start # nagios与ndoutils通信 [root@Cagios nagios]# vi nagios.cfg broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg [root@Cagios ~]# /etc/init.d/nagios restart
#重启nagios,nagios日志输出应该如下
#查看下数据库
数据存入数据是ok的,结束!!!