1、操作系统准备:
系统:CentOS x86_64 6.2最小化安装
安装httpd、php及编译工具等基本软件:
[root@nagiostest ~]# yum -y install php-MySQL mysql perl mysql-server perl-DBI perl-DBD-MySQL httpd gcc glibc glibc-common gd gd-devel php openssl openssl-devel |
创新互联始终坚持【策划先行,效果至上】的经营理念,通过多达十载累计超上千家客户的网站建设总结了一套系统有效的全网营销推广解决方案,现已广泛运用于各行各业的客户,其中包括:小搅拌车等企业,备受客户称誉。
2、准备软件:
下载nagios-plugins
[root@nagiostest ~]#wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz/download |
[root@nagiostest ~]# tar -zxvf nagios-plugins-1.4.16.tar.gzt |
[root@nagiostest ~]#wget http://sourceforge.net/projects/nagios-cn/files/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2/download |
解压:
[root@nagiostest ~]# tar -jxvf nagios-cn-3.2.3.tar.bz2 |
[root@nagiostest ~]# ls
anaconda-ks.cfg nagios-cn-3.2.3 nagios-plugins-1.4.16.tar.gz install.log nagios-cn-3.2.3.tar.bz2 install.log.syslog nagios-plugins-1.4.16 |
[root@nagiostest ~]#groupadd nagcmd /*建立组nagcmd*/ [root@nagiostest ~]#usermod –G nagcmd apache /*添加用户apache到组nagcmd*/ [root@nagiostest ~]#useradd -G nagcmd nagios /*新建用户nagios并添加到组nagcmd*/ [root@nagiostest ~]#passwd nagios /*修改nagios密码*/ |
[root@nagiostest ~]# cd nagios-cn-3.2.3 [root@nagiostest nagios-cn-3.2.3]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd [root@nagiostest nagios-cn-3.2.3]#make && make install [root@nagiostest nagios-cn-3.2.3]#make install-init [root@nagiostest nagios-cn-3.2.3]#make install-commandmode [root@nagiostest nagios-cn-3.2.3]#make install-config |
5、 编译安装nagios- plugins
[root@nagiostest ~]# cd nagios-plugins-1.4.16 [root@nagiostest nagios-plugins-1.4.16]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios [root@nagiostest nagios-plugins-1.4.16]# make && make install |
[root@nagiostest ~]#htpasswd -c /usr/local/nagios/etc/htpasswd nagiosadmin |
[root@nagiostest ~]#chkconfig --add nagios [root@nagiostest ~]#chkconfig nagios on [root@nagiostest ~]#chkconfig httpd on [root@nagiostest ~]#chkconfig mysqld on [root@nagiostest ~]#service httpd start [root@nagiostest ~]#service nagios start [root@nagiostest ~]#service mysqld start |
[root@nagiostest ~]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg |
[root@nagiostest ~]# vi /root/.bashrc |
这样以后只要输入check就相当于执行上面的那一长串命令。
执行上述命令如果没有错,则出现如下图:
如果有错,则根据错误提示进行修改配置。
9、 登录控制台:
现在就可以用http://serverip/nagios 方式访问nagios web访问控制台了