cacti1.1.2安裝過程

提前安裝的包

yum install help2man
yum install rrdtool rrdtool-devel rrdtool-php rrdtool-perl
yum install gd gd-devel php-gd
yum install net-snmp*

yum安裝 MariaDB-10.3

添加文件/etc/yum.repos.d/MariaDB.repo,內(nèi)容如下。

# MariaDB 10.3 CentOS repository list - created 2017-02-17 06:03 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

安裝MariaDB

yum install MariaDB-server MariaDB-client

配置文件/etc/my.cnf,添加如下內(nèi)容

[client]
default-character-set=utf8mb4
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 16M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 240K
max_heap_table_size = 50M
tmp_table_size = 64M
join_buffer_size = 64M
innodb_doublewrite = OFF
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
max_connections = 128
default_time_zone = 'Asia/Shanghai'
character_set_server = utf8mb4
collation-server = utf8mb4_unicode_ci
innodb_buffer_pool_size = 242M

解決MySQL TimeZone database is not populated問題

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p

php

使用nginx做web服務(wù)器(建議編譯安裝)

yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-ldap php-fpm

安裝cacti-1.1.2

安裝cacti-spine

tar zxvf cacti-spine-1.1.2.tar.gz
cd cacti-spine-1.1.2
./bootstrap
./configure
make
make install
chown root:root /usr/local/spine/bin/spine
chmod +s /usr/local/spine/bin/spine
cd /usr/local/spine/etc
cp spine.conf.dist spine.conf

編輯spine.conf

修改數(shù)據(jù)庫相關(guān)的用戶名和密碼

安裝cacti

安裝源碼

tar zxvf cacti-1.1.2.tar.gz
mv cacti-1.1.2 /var/www/html/cacti
chown -R nginx:nginx /var/www/html/cacti

編輯config.php

cd /var/www/html/cacti/include/
cp config.php.dist config.php

修改數(shù)據(jù)相關(guān)的用戶名和密碼

導(dǎo)入sql

mysql -uroot -p
MariaDB [(none)]> create database cacti;
MariaDB [(none)]> grant all on *.* to cactiuser@localhost identified by "cactipass";
MariaDB [(none)]> flush privileges;
mysql -u cactiuser -p cacti < /var/www/html/cacti/cacti.sql

數(shù)據(jù)庫名稱:cacti
用戶名:cactiuser
數(shù)據(jù)庫密碼:cactipass

確認web和db服務(wù)都已啟動,使用下面命令啟動

systemctl start mariadb.service
systemctl start nginx.service
systemctl start php-fpm.service

這3個進程都要啟動

配置cacti

添加crontab任務(wù)

vim /etc/cron.d/cacti
*/1 * * * * nginx /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

注意是使用nginx用戶運行crontab

訪問 http://your-ip/cacti ,根據(jù)向?qū)нM行配置。

默認用戶admin 密碼admin,第一次登陸需要修改,新密碼規(guī)則最低要求包括字母大小寫、數(shù)字。

Configuration的settings修改

paths

spine二進制文件和spine.conf所在路徑。
RRDfile Auto Clean打勾,方式選擇Delete。

Device Defaults

Downed Device Detection選擇none。

Poller

Poller Type選擇spine
Poller Interval選擇Every Minute
Cron Interval選擇Every Minute
Maximum Threads per Process選擇2(CPU內(nèi)核數(shù)的整數(shù)倍)
Number of PHP Script Servers選擇1
Script and Script Server Timeout Value選擇45
The Maximum SNMP OIDs Per SNMP Get Request選擇8(2的次方)

Data Storage

Structured RRD Path (/host_id/local_data_id.rrd)打勾

Visual

Enable Real-time Graphing打勾

Mail/Reporting/DNS

Server Base URL填寫網(wǎng)站完整的url

Templates

Data Source里的Interface - Traffic修改Data Source Profile為High Collection Rate(支持每分鐘視圖)

cacti版本升級

備份mysql數(shù)據(jù)

mysqldump -l --add-drop-table cacti > mysql.cacti -u root -p

升級spine

刪除老版本spine

rm -rf /usr/local/spine/

安裝配置新版本spine

升級cacti

備份老cacti文件夾

cd /var/www/html
mv cacti cacti_old

解壓新版本

tar zxvf cacti-1.1.5.tar.gz
mv cacti-1.1.5 /var/www/html/cacti
chown -R nginx:nginx /var/www/html/cacti

編輯config.php

從老版本文件夾復(fù)制相關(guān)文件到新版本

cp -r cacti_old/rra/* cacti/rra/
cp -u cacti_old/scripts/* cacti/scripts/
cp -u -R cacti_old/resource/* cacti/resource/
chown -R nginx:nginx /var/www/html/cacti

確認rra,log這2個文件夾的權(quán)限(user/group)。

管理界面升級

訪問cacti所在url,根據(jù)向?qū)塩acti

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容