CentOS7安裝cacti1.1.x
由於cacti 1.1.x系列釋出後,變化比較大,整合了很多外掛,自帶自動發現功能,所以記錄下來,比較適合複製貼上。
環境:CentOS 7.4
安裝前提
a、安裝系統補丁
1
|
yum update -y |
b、開啟ntp,保證時間正確
1
2
3
|
yum install chrony -y
systemctl enable chronyd
systemctl start chronyd |
c、禁用selinux,重啟生效
1
2
|
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
1
2
|
yum install centos-release-openstack-ocata -y
yum install mariadb-server -y
|
2、mariadb引數調整(最低要求)
1
2
3
4
5
6
7
|
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讓配置生效
1
2
|
systemctl enable mariadb
systemctl start mariadb |
匯入時區資訊
1
|
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql
|
3、安裝lamp
1
2
3
4
5
6
7
8
|
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
1
2
3
4
5
6
|
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建庫
1
2
3
4
5
6
7
|
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 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 檔案中新增一行
1
|
*/5 * * * * root /usr/bin/php -q /var/www/html/cacti/poller.php >/dev/null |
9、配置自動發現(可選)
功能有點類似zabbix
1
2
3
|
a、定義snmp選項,比如snmp v2,community 為abc b、定義掃描網段,比如192.168.0.0/24,定時掃描,發現snmp埠存活的機器自動新增到cacti, c、定義規則,將掃描到的機器,按照作業系統分類,放入不同的tree,劃不同的圖 |
10、安裝spine(可選)
spine是一個c寫的程式,效能比預設的poller.php要高很多。
1
2
3
4
5
6
7
8
9
|
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檔案裡記得根據需要修改。
重灌
如果需要重灌,簡單的刪除資料庫,重新初始化即可(第5-7步)
漢化
cacti 1.1.x 支援中文,但是漢化不徹底,手癢的同學可以按照下面的辦法漢化:
1、安裝
1
|
yum install gettext -y
|
2、反編譯mo檔案為po檔案
1
2
|
cd /var/www/html/cacti/locales/LC_MESSAGES
/usr/bin/msgunfmt chinese_china_simplified.mo -o chinese_china_simplified.po
|
3、用文字編輯器修改檔案
4、編譯po檔案為mo檔案
1
|
/usr/bin/msgfmt chinese_china_simplified.po -o chinese_china_simplified.mo
|
本文轉自 紫色葡萄 51CTO部落格,原文連結:http://blog.51cto.com/purplegrape/1910243,如需轉載請自行聯絡原作者
相關文章
- Centos7安裝安裝部署dockerCentOSDocker
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- centos7 安裝pipCentOS
- CentOS7 安裝 MySQLCentOSMySql
- centos7安裝protobufCentOS
- 4.1 CentOS7安裝CentOS
- CentOS7安裝wpsCentOS
- VirtualBox安裝Centos7CentOS
- CentOS7 安裝NginxCentOSNginx
- CentOS7安裝OpenvswitchCentOS
- centos7 安裝rocketmqCentOSMQ
- CentOS7 安裝 dockerCentOSDocker
- centos7安裝dockerCentOSDocker
- CentOS7 安裝 memcacheCentOS
- CentOS7 安裝 libreofficeCentOS
- centos7 安裝 rcloneCentOS
- centos7安裝nginxCentOSNginx
- centos7安裝mysqlCentOSMySql
- Centos7 安裝 NginxCentOSNginx
- Centos7安裝RabbitMQCentOSMQ
- centos7安裝composerCentOS
- centos7安裝supervisorCentOS
- CentOS7安裝RedisCentOSRedis
- Centos7 安裝ffmpegCentOS
- centos7安裝HadoopCentOSHadoop
- centos7安裝教程詳解 centos7安裝詳細步驟CentOS
- mac virualbox 安裝centos7MacCentOS
- centos7快速安裝dockerCentOSDocker
- CentOS7 安裝配置 GitLabCentOSGitlab
- Centos7上安裝dockerCentOSDocker
- 【CentOS】CentOS7安裝PostgreSQLCentOSSQL
- centos7 docker 安裝教程CentOSDocker
- Centos7快速安裝RocketMQCentOSMQ
- centos7下安裝ffmpegCentOS
- centos7下安裝 dockerCentOSDocker
- CentOS7 下安裝 ElasticsearchCentOSElasticsearch
- centos7安裝elasticsearch:7.9.3CentOSElasticsearch
- centos7 安裝MariaDB 10.6CentOS
- centos7安裝zabbix 5.0CentOS