Centos 7系统安装Cacti监控.doc_第1页
Centos 7系统安装Cacti监控.doc_第2页
Centos 7系统安装Cacti监控.doc_第3页
Centos 7系统安装Cacti监控.doc_第4页
Centos 7系统安装Cacti监控.doc_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 (cron, 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/grabber.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解决方法:Vim /usr/lib/python2.7/site-packages/urlgrabber/grabber.py将elif errcode in (42,55,56):更改为:elif errcode = 42:即可。系统相关设置:1.同步时间:Yum install ntpNtpdate 22 Jan 14:00:07 ntpdate51575: step time server 72 offset 24261.632577 sec如果出去上面的内容说明,同步成功了。然后在crontab里面加上以下内容。*/10 * * * * /usr/sbin/ntpdate #域名或IP 每隔十分钟同步一次。推荐几个时间服务器。2.更新yum源(建议使用国内163yum)进入yum源配置目录cd /etc/yum.repos.d备份系统自带的yum源mv CentOS-Base.repo CentOS-Base.repo.bk下载163网易的yum源:wget /.help/CentOS6-Base-163.repo更新玩yum源后,执行下边命令更新yum配置,使操作立即生效yum clean allyum makecacheyum update3.安装gcc编译器Yum install gcc#make #make install4.直接关闭防火墙systemctl stop firewalld.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更改为 将62行(各有不同,请自行查找)下的systemview更改为all 将85行(各有不同,请自行查找)下的#注释掉 启动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为例),并修改登录权限,默认密码为空 #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 mysqlcreate database cacti;创建cacti数据库MariaDB mysqlgrant all privileges on cacti.* to cactilocalhost identified by cacti with grant option;MariaDB mysqlflush privileges;1.4三、Cacti配置下载cactiwget /downloads/cacti-0.8.8f.tar.gz #下载cacti tar -zxvf cacti-0.8.8f.tar.gz #解压cacti mv cacti-0.8.8f /var/www/html/cacti #移动至/var/www/html/cacti下 将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;$database_username = cacti; 用户名$database_password = cacti; 密码$database_port = 3306;$database_ssl = false;五、安装Spine由于默认cmd.php来轮询数据,速度会很慢,特别是在监控节点比较多的情况下,cmd.php就更显不足了,因此我们采用Spine来轮询数据。cacti-spine是一个由C语言开发的,用于替代cmd.php的快速获取速度的引擎。 下载并编译安装 #wget /downloads/spine/cacti-spine-0.8.8f.tar.gz#tar -zxvf cacti-spine-0.8.8f.tar.gz#cd cacti-spine-0.8.8f#./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才会生效,否则测试时会报如下错误: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 - Alternate 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-local-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 #强制执行

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论