##安装环境ucloud云主机centos6.4_64系统并做好初始化工作
mkdir -p /data/software yum -y install httpd gcc glibc glibc-common *gd* php php-mysql mysql mysql-server mysql-devel openssl openssl-devel cd /data/software wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz wget http://nchc.dl.sourceforge.net/project/nagios-cn/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2 wget http://cznic.dl.sourceforge.net/project/nagios/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gz wget http://nchc.dl.sourceforge.net/project/nagiosql/nagiosql/NagiosQL%203.2.0/nagiosql_320.tar.gz wget http://221.237.158.152:8888/nrpe-2.13.tar.gz
创建nagios并加入nagcmd组
useradd -s /sbin/nologin nagios groupadd nagcmd usermod -G nagcmd nagios usermod -G nagcmd apache
安装nagios中文版
tar jxf nagios-cn-3.2.3.tar.bz2 cd nagios-cn-3.2.3 ./configure --with-command-group=nagcmd --enable-event-broker make all &&make install &&make install-init && make install-config&&make install-commandmode&&make install-webconf htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin ##此处输入nagiosadmin的密码 cd ..
安装nagios-plugin
tar zxvf nagios-plugins-2.0.3.tar.gz cd nagios-plugins-2.0.3 ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd make && make install cd .. echo ‘date.timezone = PRC‘ >> /etc/php.ini service httpd restart && service nagios restart chkconfig httpd on && chkconfig nagios on
安装ndoutlis
tar zxvf ndoutils-2.0.0.tar.gz cd ndoutils-2.0.0 ./configure --enable-mysql make cp -v src/{ndomod-3x.o,ndo2db-3x,file2sock,log2ndo} /usr/local/nagios/bin/ mysql -uroot -p ##进入数据库 mysql>create database 库名; mysql>grant all on 库名.* to 用户名@localhost identified by ‘密码‘; mysql>flush privileges; mysql>exit cd db/ ./installdb -u ndouser -p 1234qwer -hlocalhost -d 库名 #导入表结构 cd .. cp config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 774 /usr/local/nagios/bin/* chown nagios.apache /usr/local/nagios/bin/* chown nagios.apache /usr/local/nagios/etc/* chmod 644 /usr/local/nagios/etc/* vim /usr/local/nagios/etc/ndo2db.cfg ##修改ndo2db配置文件 socket_type=unix 改成 socket_type=tcp db_port=3306 改成 db_port=8904 ##使用8904 db_name= 改成 db_name=nagios_db db_user=ndouser #连接数据库的用户名 db_pass= #连接数据库的密码 保存退出 vim /usr/local/nagios/etc/ndomod.cfg output_type=unixsocket 改成 output_type=tcpsocket output=/usr/local/nagios/var/ndo.sock 改成 output=127.0.0.1 保存退出 cp /data/software/ndoutils-2.0.0/daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db chkconfig ndo2db on chkconfig nagios on mv /usr/local/nagios/bin/ndo2db-3x /usr/local/nagios/bin/ndo2db vim /usr/local/nagios/etc/nagios.cfg 添加broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg nagios -v /usr/local/nagios/etc/nagios.cfg service nagios restart service ndo2db restart
nagiosql详细配置未完
时间: 2024-10-25 05:27:23