Centos 7系统安装Cacti监控.doc

上传人:大张伟 文档编号:10812476 上传时间:2021-06-05 格式:DOC 页数:5 大小:21.95KB
返回 下载 相关 举报
Centos 7系统安装Cacti监控.doc_第1页
第1页 / 共5页
Centos 7系统安装Cacti监控.doc_第2页
第2页 / 共5页
Centos 7系统安装Cacti监控.doc_第3页
第3页 / 共5页
Centos 7系统安装Cacti监控.doc_第4页
第4页 / 共5页
Centos 7系统安装Cacti监控.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《Centos 7系统安装Cacti监控.doc》由会员分享,可在线阅读,更多相关《Centos 7系统安装Cacti监控.doc(5页珍藏版)》请在三一文库上搜索。

1、Cacti需要安装的rpm包httpdphpphp-mysqlphp-snmpphp-ldap (when using LDAP authentication)php-xmlmariadbmariadb-servermariadb-develnet-snmp*(主要安装net-snmp net-snmp-devel net-snmp-utils net-snmp-libs 组件) rrdtool rrdtool-devel rrdtool-php rrdtool-perl -安装rrdtool以生成图像gd gd-devel php-gd -rrdtool绘制图像需要的图形库crond (cr

2、on, cronie or the like)Centos 7 Yum不能工作报错如下:File /usr/libexec/urlgrabber-ext-down, line 61, in mainfo = PyCurlFileObject(opts.url, opts.filename, opts)File /usr/lib/python2.7/site-packages/urlgrabber/grabber.py, line 1258, in _init_self._do_open()File /usr/lib/python2.7/site-packages/urlgrabber/grab

3、ber.py, line 1589, in _do_openself._do_grab()File /usr/lib/python2.7/site-packages/urlgrabber/grabber.py, line 1723, in _do_grabself._do_perform()File /usr/lib/python2.7/site-packages/urlgrabber/grabber.py, line 1517, in _do_performraise KeyboardInterruptKeyboardInterruptExiting on user cancel解决方法:V

4、im /usr/lib/python2.7/site-packages/urlgrabber/grabber.py将elif errcode in (42,55,56):更改为:elif errcode = 42:即可。系统相关设置:1.同步时间:Yum install ntpNtpdate time.nist.gov22 Jan 14:00:07 ntpdate51575: step time server 128.138.141.172 offset 24261.632577 sec如果出去上面的内容说明,同步成功了。然后在crontab里面加上以下内容。*/10 * * * * /usr

5、/sbin/ntpdate time.nist.gov #域名或IP 每隔十分钟同步一次。推荐几个时间服务器。asia.pool.ntp.org2.更新yum源(建议使用国内163yum)进入yum源配置目录cd /etc/yum.repos.d备份系统自带的yum源mv CentOS-Base.repo CentOS-Base.repo.bk下载163网易的yum源:wget http:/ clean allyum makecacheyum update3.安装gcc编译器Yum install gcc#make #make install4.直接关闭防火墙systemctl stop fi

6、rewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动开机启动服务目录:/usr/lib/system/system/systemctl list-units -type=service | grep firewall.service 查看firewall是否开机启动开始安装:一、配置SNMP vi /etc/snmp/snmpd.conf 将41行(各有不同,请自行查找)下的default更改为127.0.0.1 将62行(各有不同,请自行查找)下的systemview更改为all 将85行

7、(各有不同,请自行查找)下的#注释掉 启动snmp systemctl start snmpd.service 启动服务 systemctl enable snmpd.service 设置开机启动二、MariaDB数据库配置 MariaDB设置数据库默认编码Vim /etc/fmysqldCharacter_set_server=utf8 添加内容 启用MariaDB数据库 systemctl start mariadb.service 启动服务 systemctl enable mariadb.service 设置开机启动服务 为root用户设置密码(以123456为例),并修改登录权限,默

8、认密码为空 #mysql u root p 回车后输入密码(空)MariaDB (none) use mysql; MariaDB mysql update user set password=password( 123456) where user=root;MariaDB mysqlgrant all privileges on *.* to rootlocalhost identified by 123456 with grant option;MariaDB mysqlflush privileges; 添加cacti用户和cacti数据库,并为其设置权限MariaDB mysqlcr

9、eate database cacti;创建cacti数据库MariaDB mysqlgrant all privileges on cacti.* to cactilocalhost identified by cacti with grant option;MariaDB mysqlflush privileges;1.4三、Cacti配置下载cactiwget http:/ #下载cacti tar -zxvf cacti-0.8.8f.tar.gz #解压cacti mv cacti-0.8.8f /var/www/html/cacti #移动至/var/www/html/cacti下

10、 将cacti的表内容导入创建的数据库 cd /var/www/html/cacti mysql -ucacti -pcacti cacti /dev/null 2&1 启用http服务 systemctl start httpd.service systemctl enable httpd.service四、修改cacti连接数据库的用户名和密码vim /var/www/html/cacti/include/config.php$database_type = mysql;$database_default = cacti;$database_hostname = localhost;$da

11、tabase_username = cacti; 用户名$database_password = cacti; 密码$database_port = 3306;$database_ssl = false;五、安装Spine由于默认cmd.php来轮询数据,速度会很慢,特别是在监控节点比较多的情况下,cmd.php就更显不足了,因此我们采用Spine来轮询数据。cacti-spine是一个由C语言开发的,用于替代cmd.php的快速获取速度的引擎。 下载并编译安装 #wget http:/ -zxvf cacti-spine-0.8.8f.tar.gz#cd cacti-spine-0.8.8f

12、#./configureMake & make install修改访问数据库的用户名密码信息#cp/usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf# vi /usr/local/spine/etc/spine.confDB_Host localhostDB_Database cactiDB_User cacti 用户名DB_Pass cacti 密码DB_Port 3306cp /usr/local/spine/etc/spine.conf /etc/注:spine默认配置文件需要放在/etc才会生效,否则

13、测试时会报如下错误:SPINE: Poller0 FATAL: Unable to read configuration file! (Spine init)测试是否正常#/usr/local/spine/bin/spineSPINE: Using spine config file ./etc/spine.confSPINE: Version 0.8.8f startingSPINE: Time: 2.0130 s, Threads: 1, Hosts: 2 进入Cacti页面设置spine路径Console - Configuration - Settings - Paths - Alte

14、rnate Poller Path - Spine Poller File Path/usr/local/spine/bin/spine 修改Cacti使用的Poller TypeConsole - Cacti Settings-Poller-Poller Type在下拉中选择spine五、不能出图的几个问题: 安装Cacti后,完全无图,这是因为rrdtool没有完全安装 如不能出图,可能是时钟问题,如下: #cat /var/www/html/cacti/log/cacti.log 1).#timedatectl #CentOS7统一的时间管理命令#timedatectl set-loca

15、l-rtc yes #yes表示使用本地时间,no则表示是UTC时间# rm -rf /var/www/html/rra/* #删除/var/www/html/rra/下面的所有文件#/usr/bin/php /var/www/html/cacti/poller.php -force #强制执行poller程序重新生成文件 2).cron的时间与poller.php的时间设置错误一般poller.php的更新时间为60s,所以cron里边也要设置成每分钟更新一次#crontab e 【输入以下内容】*/1 * * * * php /var/www/html/cacti/poller.php /dev/null 2&1 3).# cat /var/www/html/cacti/log/cacti.logOK,数据采集已经正常啦。 4.)进入Cacti查看,已经OK了

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1