2168575 发表于 2019-1-9 11:59:32

构建cacti基本检测体系支持lamp架构

  

Cacti的工作结构:
C/S模式,采集监测数据
B/S模式,管理监测平台
需求描述
在主机192.168.90.108中构建Cacti系统
集中监测网关、网站、MySQL这三台服务器
实现思路
在被控端安装、配置snmpd服务
构建Cacti监测服务器,添加percona-mysql-monitor插件
设置具体的监测任务、并验证实验结果
配置LAMP环境
实验操作之前:
service iptables stop
setenforce=0#yum -y install mysql mysql-server mysql-develhttp://s1.运维网.com/wyfs02/M00/86/4A/wKioL1e7EV2QiC15AAAjh6YGx8k119.png
  配置apache与php---安装包
#yum -y install zlib freetype libjpeg fontconfig gd libxml2 php-gd
#yum -y install httpd php php-mysqlhttp://s4.运维网.com/wyfs02/M00/86/4B/wKiom1e7EYihTl44AAAHzN0Hi4w123.png
  

  2> 安装rrdtool和net-snmp
#yum -y installnet-snmp net-snmp-utils  安装如下内容:

http://s1.运维网.com/wyfs02/M02/86/4A/wKioL1e7EcOAZ4t9AAAYvgtlMDs249.png
  

  3> 安装cacti
#tar -zxvf cacti-0.8.8b.tar.gz -C/opt/http://s2.运维网.com/wyfs02/M00/86/4A/wKioL1e7EmngvtOMAAAGnvHCJTY940.png
#mv cacti-0.8.8b/var/www/html/cacti/  

http://s1.运维网.com/wyfs02/M01/86/4B/wKiom1e7Et7AXU_RAAAMu3N8NV4397.png
  

  4> 配置cacti:
#useradd cacti//增加cacti
#chown -R cacti.cacti /var/www/html/cacti/  

  5> 配置 mysql并导入 cacti.sql
#service mysqld start
mysql -u root
mysql> create database cacti default character set utf8;
mysql> grant all on cacti.* to cacti@'localhost' identified by 'cacti';
mysql> flush privileges;
mysql -u cacti -pcacti cacti < /var/www/html/cacti/cacti.sql
vi /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$url_path = "/";  

  a> 配置httpd服务
#vim /etc/httpd/conf/httpd.conf  //修改如下

http://s4.运维网.com/wyfs02/M01/86/4A/wKioL1e7E2rAXAROAAASICZH5R4843.png
#service httpd start  

  b> 配置snmpd服务
#yum install -y net-snmp lm_sensors#vi /etc/snmp/snmpd.conf  //修改如下

http://s1.运维网.com/wyfs02/M02/86/4B/wKiom1e7E_WDJQJvAAAFospCWms040.png
http://s1.运维网.com/wyfs02/M01/86/4A/wKioL1e7E_WjsRvgAAAHVvaBYKc724.png
http://s4.运维网.com/wyfs02/M00/86/4B/wKiom1e7FCuBTAhCAAAEDaqb53Y590.png
#service iptables stop
#service snmpd start  

  c> 配置cron计划任务
#crontab -u cacti -e  

  */10 * * * * /usr/bin/php/var/www/html/cacti/poller.php& > /dev/null
  

  6> 配置完成,设置服务开机自启动
#chkconfig --level 35 httpd on
#chkconfig --level 35 mysqld on
#chkconfig --level 35 snmpdonhttp://s1.运维网.com/wyfs02/M00/86/4A/wKioL1e7F0SDZ1AXAAAVGjRATFk571.png
  在Windows 10 客户端IE浏览器中输入网址:http://192.168.90.108/cacti/
  默认用户名和密码都是admin
http://s3.运维网.com/wyfs02/M02/86/4B/wKiom1e7FTix4LMDAADvJGsTdLg361.png-wh_500x0-wm_3-wmp_4-s_1221691008.png
  

  添加被控制端:
http://s4.运维网.com/wyfs02/M01/86/4B/wKiom1e7FUri2Nm4AAD4UHU0O5s478.png-wh_500x0-wm_3-wmp_4-s_1804965108.png
  

  http://blog.运维网.com/e/u261/themes/default/images/spacer.gif扩展Cacti的功能
  安装perchttp://blog.运维网.com/e/u261/themes/default/images/spacer.gifona-mysql-monitor插件 即可
  

  

  




页: [1]
查看完整版本: 构建cacti基本检测体系支持lamp架构