资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

rhel下安装配置nagios和cacti

 nagios安装指南
环境:rhel6.2 
软件:nagios-3.3.1.tar.gz


1、最小化安装系统
2、安装缺失插件
yum install -y httpd http-devel MySQL mysql-devel mysql-server gcc glibc glibc-common gd gd-devel php  make php-devel php-gd ntp make  net-snmp net-snmp-devel 
3、创建nagios用户并创建nagcmd组,允许用户在web上执行命令.
useradd -m nagios  
  


groupadd nagcmd  
usermod -a -G nagcmd nagios  
usermod -a -G nagcmd apache 
3、编译安装nagios
./configure  --with-gd-lib=/usr/local/lib  --with-command-group=nagcmd  --prefix=/var/www/html/nagios
make all 
make install
make install-init  
make install-config  
make install-commandmode
4、修改发信邮箱、修改apache配置文件
vi  /var/www/html/nagios/etc/objects/contacts.cfg
nagios-3.2.3/sample-config/httpd.conf中的片段拷贝到/etc/httpd/conf/httpd.conf中
5、添加登录认证文件
htpasswd -c  /var/www/html//nagios/etc/htpasswd.users nagiosadmin  
6、安装nagios-plugins插件
tar -zvxf nagios-plugins-1.4.15.tar.gz 
cd nagios-plugins-1.4.15 
./configure --with-nagios-user=nagios --with-nagios-group=nagios  --prefix=/var/www/html/nagios
make && make install
7、nagios 测试
chown nagios:nagios /var/www/html/nagios/ -R 
/etc/init.d/httpd restart  
chkconfig httpd on   
/etc/init.d/nagios start 
8、安装nrpe
tar xzvf nrpe-2.12.tar.gz  
cd nrpe-2.12  


./configure  
make all    
make install-plugin  
make install-daemon  
make install-daemon-config  
make install-xinetd  
9、修改nrpe配置
编辑/etc/xinetd.d/nrpe 
only_from = 127.0.0.1 #这里只能加一个IP
编辑/etc/services,在最后一行加上 
nrpe 5666/tcp # NRPE


在监控主机上编辑 /var/www/html/nagios/etc/objects/commands.cfg,加入下面的command。
[plain] view plaincopy
define command{  
        command_name  check_nrpe  
        command_line  $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$  
}  
10、配置snmp服务
yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
chkconfig –level 35 snmpd on
service snmpd start
vi /etc/snmp/snmpd.conf
修改com2sec notConfigUser  default       public
为:com2sec notConfigUser  127.0.0.1       public
修改access  notConfigGroup ""      any       noauth    exact  systemview none none
为access  notConfigGroup ""      any       noauth    exact  all  none none
并启用view all    included  .1                               80此行;


11、解压移动cacti
tar xvf cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /var/www/html/cacti


12、安装rrdtool
tar xzf rrdtool-1.4.5.tar.gz   ;
cd rrdtool-1.4.5  ; 
./configure –-prefix=/usr/local/rrdtool/  ;
make  &&make install

网站建设哪家好,找成都创新互联公司!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了裕民免费建站欢迎大家使用!

ln -s /usr/local/rrdtool/bin/* /usr/local/bin/

或者执行:

yum install rrdtool* 



13、配置cacti数据库
mysql -uroot –p##输入你的密码进入数据库,然后创建数据库:
create database cacti; ## 创建库
grant all on cacti.* to  cacti@’localhost’   identified by  ’123456′;##创建用户并授权
flush privileges;##刷新权限
mysql配置完毕后,把cacti数据导入cacti数据库里面:
mysql -ucacti  -p cacti 回车输入cacti用户的密码123456即可。
需要在修改/var/www/html/cacti/include/config.php ;

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "123456";
$database_port = "3306";
改成相应的数据即可;


配置完mysql后,我们需要设置cacti rra、log 目录的权限,这里设置为777 :
chmod -R  777  /var/www/html/cacti/rra/
chmod -R  777  /var/www/html/cacti/log/


为了绘制图表,需要手动添加以下任务
* /5  * * * * php /var/www/html/cacti/poller.php
14、浏览器中打开:
http://localhost:/cacti
执行install安装即可;


网站标题:rhel下安装配置nagios和cacti
转载来于:http://cdkjz.cn/article/ppojgc.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220