您好,登錄后才能下訂單哦!
由于cacti 1.1.x系列發(fā)布后,變化比較大,集成了很多插件,自帶自動發(fā)現(xiàn)功能,所以記錄下來,比較適合復(fù)制粘貼。
環(huán)境:CentOS 7.4
安裝前提
a、安裝系統(tǒng)補丁
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參數(shù)調(diào)整(參考配置)
[mysqld] ...... character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci max_heap_table_size = 128M max_allowed_packet = 32M tmp_table_size = 64M join_buffer_size = 64M innodb_buffer_pool_size = 1024M innodb_doublewrite = off innodb_flush_log_at_timeout = 3
重啟mariadb讓配置生效
systemctl enable mariadb systemctl start mariadb
導(dǎo)入時區(qū)信息
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql
3、安裝lamp
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 http://www.cacti.net/downloads/cacti-1.1.0.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 mysql.user where Host = 'localhost' and User = 'cactiuser'" mysql -u root -e "create database `cacti` default character set utf8mb4 collate utf8mb4_unicode_ci" 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、安裝向?qū)?/strong>
訪問http://ip/cacti 進入安裝向?qū)?/p>
7、修改密碼
默認用戶密碼admin/admin,首次登陸要求改密碼,密碼長度和復(fù)雜度都比較嚴格,點贊。
8、定時任務(wù)
設(shè)置定時任務(wù),在/etc/crontab 文件中添加一行
*/5 * * * * root /usr/bin/php -q /var/www/html/cacti/poller.php >/dev/null
9、配置自動發(fā)現(xiàn)(可選)
功能有點類似zabbix
a、定義snmp選項,比如snmp v2,community 為abc b、定義掃描網(wǎng)段,比如192.168.0.0/24,定時掃描,發(fā)現(xiàn)snmp端口存活的機器自動添加到cacti, c、定義規(guī)則,將掃描到的機器,按照操作系統(tǒng)分類,放入不同的tree,劃不同的圖
10、安裝spine(可選)
spine是一個c寫的程序,性能比默認的poller.php要高很多。
yum install gcc libtool make autoconf mysql-devel net-snmp-devel help2man wget -y wget tar zxvf cacti-spine-1.1.0.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文件里記得根據(jù)需要修改。
重裝
如果需要重裝,簡單的刪除數(shù)據(jù)庫,重新初始化即可(第5-7步)
漢化
cacti 1.1.x 支持中文,但是漢化不徹底,手癢的同學(xué)可以按照下面的辦法漢化:
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、用文本編輯器修改文件
4、編譯po文件為mo文件
/usr/bin/msgfmt chinese_china_simplified.po -o chinese_china_simplified.mo
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。