Cacti 安装教程
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
CentOS 7 安装cacti 1.1.x
环境:CentOS 7.4
安装前提
a、安装系统补丁
yum update -y
b、开启ntp,保证时间正确
yum install chrony -y
systemctl enable chronyd
systemctl start chronyd
c、禁用selinux,重启生效
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
reboot
1、安装mariadb 10.1
cacti 1.1.0 需要mysql >= 5.6 ,所以这里选择mariadb 10.1
yum install centos-release-openstack-ocata -y
yum install mariadb-server -y
2、mariadb参数调整(最低要求)
max_heap_table_size = 128M
max_allowed_packet = 32M
tmp_table_size = 64M
join_buffer_size = 64M
innodb_buffer_pool_size = 512M
innodb_doublewrite = off
innodb_flush_log_at_timeout = 3
重启mariadb让配置生效
systemctl enable mariadb
systemctl start mariadb
导入时区信息
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql
yum install httpd php php-mysqlnd php-mbstring php-ldap php-process php-gd php-snmp php-pecl-zendopcache php-xml wget net-snmp-utils rrdtool -y
echo "ServerTokens Prod" >> /etc/httpd/conf/httpd.conf
echo "ServerSignature Off" >> /etc/httpd/conf/httpd.conf
sed -i 's/;date.timezone.*/date.timezone = PRC/g' /etc/php.ini
mkdir -p /var/lib/php/session
chown -R apache:apache /var/lib/php/session
systemctl enable httpd
systemctl start httpd
4、下载cacti
cd /var/wwww/html
wget /downloads/cacti-1.1.38.tar.gz
tar zxvf cacti-1.1.0.tar.gz
mv cacti-1.1.0 cacti
cd cacti
chown -R apache:apache resource scripts log cache
5、给cacti建库
mysql -u root -e "drop database if exists cacti"
mysql -u root -e "delete from er where Host = 'localhost' and User = 'cactiuser'" mysql -u root -e "create database cacti default charset utf8mb4"
mysql -u root -e "grant all on cacti.* to 'cactiuser'@'localhost' identified by 'cactiuser'"
mysql -u root -e "grant select on mysql.time_zone_name to 'cactiuser'@'localhost'"
mysql -u root -e "flush privileges"
mysql -u root cacti < /var/www/html/cacti/cacti.sql
6、安装向导
访问http://ip/cacti 进入安装向导
7、修改密码
默认用户密码admin/admin,首次登陆要求改密码,密码长度和复杂度都比较严格,点赞。
8、定时任务
设置定时任务,在/etc/crontab 文件中添加一行
*/5 * * * * root /usr/bin/php -q /var/www/html/cacti/poller.php >/dev/null
yum install gcc libtool make autoconf mysql-devel net-snmp-devel help2man wget dos2unix -y wget https:///downloads/spine/cacti-spine-1.1.38.tar.gz
tar zxvf cacti-spine-1.1.38.tar.gz
cd cacti-spine-1.1.0
./bootstrap
./configure --with-mysql
make
cp spine /usr/local/bin/
cp spine.conf.dist /etc/spine.conf
/etc/spine.conf文件里记得根据需要修改。
汉化
cacti 1.1.x 支持中文,但是汉化不彻底,手痒的同学可以按照下面的办法汉化:
1、安装
yum install gettext -y
2、反编译mo文件为po文件
cd /var/www/html/cacti/locales/LC_MESSAGES
/usr/bin/msgunfmt chinese_china_simplified.mo -o chinese_china_simplified.po 3、编译po文件为mo文件
/usr/bin/msgfmt chinese_china_simplified.po -o chinese_china_simplified.mo