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访问控制台了
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。