---其它设置

[root@localhost nagios_plugins]# cd [root@localhost ~]# chkconfig --add nagios[root@localhost ~]# chkconfig nagios on[root@localhost ~]# chkconfig httpd on[root@localhost ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

---检测配置

  1. [root@localhost ~]# service nagios start  
  2.  
  3. @localhost ~]# cp /etc/sysconfig/selinux /etc/sysconfig/selinux.bak[root@localhost ~]# vi /etc/sysconfig/selinux ---SELINUX=permissive  

---安装mysql

  1. [root@localhost ~]# yum -y install mysql[root@localhost ~]# yum -y install mysql-server[root@localhost ~]# yum -y install mysql-devel[root@localhost ~]# yum -y install php-mysql  
  2.  
  3. [root@localhost ~]# chkconfig --levels 345 mysqld on[root@localhost ~]# service mysqld start  
  4.  
  5. [root@localhost ~]# mysqlSET PASSWORD FOR 'root'@'localhost' = PASSWORD('mysql');  
  6.  
  7. [root@localhost yum.repos.d]# yum install php  
  8.  

  ---安装cacti

  1. [root@localhost ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm[root@localhost ~]# rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm[root@localhost ~]# yum install rrdtool[root@localhost ~]# yum install net-snmp net-snmp-utils net-snmp-devel  
  2.  
  3. [root@localhost ~]# yum install cacti ---php-mysql,php-pdo,php-snmp  
  4.  
  5. [root@localhost conf.d]# vi cacti.conf  
  6.  
  7. Alias /cacti/ /usr/local/wwwroot/cacti/ DirectoryIndex index.php Options -Indexes AllowOverride all order deny,allow allow from all AddType application/x-httpd-php .php php_flag magic_quotes_gpc on php_flag track_vars on  
  8.  
  9. [root@localhost ~]# mysql -u root -pMysql>create database cacti;Mysql>use cacti;Mysql>source /usr/local/wwwroot/cacti/cacti.sqlMysql>grant all privileges on cacti.* to cacti@localhost identified by 'cacti';Mysql>flush privileges;  
  10.  

---apache设置

  1. [root@localhost ~]# vi /var/www/cacti/include/config.php  
  2.  
  3. $database_type = "mysql";$database_default = "cacti";$database_hostname = "localhost";$database_username = "cacti";$database_password = "cacti";$database_port = "3306";  
  4.  

---安装ndoutils,实现nagios采集数据写入mysql

  1. [root@localhost ~]# wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b9/ndoutils-1.4b9.tar.gz[root@localhost ~]# tar zxf ndoutils-1.4b9.tar.gz[root@localhost ~]# cd ndoutils-1.4b9[root@localhost ndoutils-1.4b9]# ./configure --enable-mysql --disable-pgsql --with-mysql-lib=/usr/lib/mysql[root@localhost ndoutils-1.4b9]# make[root@localhost ndoutils-1.4b9]# cp config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg  
  2.  

通过文章,我们对Nagios的安装都有了自己的心得,希望你们赶快去装一个Nagios,真的非常好用。


相关内容