您好,登錄后才能下訂單哦!
1、關掉selinux
setenforce 0
2、安裝相應的工具
yum -y install wget unzip vim
3、安裝httpd、mariadb數據庫、php、php數據庫相關、rrdtool繪圖工具相關及對應的圖形庫,snmp等
yum -y install httpd mariadb-server mysql-devel php php-mysql php-gd php-pear rrdtool rrdtool-devel rrdtool-php rrdtool-perl gd gd-devel php-gd net-snmp net-snmp-utils php-snmp net-snmp-libs
3.1、配置httpd
systemctl start httpd
systemctl enable httpd
firewall-cmd --reload
3.2、配置mariadb數據庫
systemctl start mariadb
mysql_secure_installation
Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
mysql -u root -p
3.2.1、創建用于測試php和mariadb連通性的用戶
grant all privileges on . to test@localhost identified by 'test';
flush privileges;
systemctl restart mariadb
systemctl enable mariadb
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload
3.3、配置PHP時區
vim /etc/php.ini
date.timezone =PRC 修改時區
systemctl restart httpd
3.4、建立測試頁,注意紅色標記部分和測是賬戶的一致;
vim /var/www/html/index.php
<?php
$conn=mysql_connect('localhost','test','test');
if ($conn)
echo "database connect ok";
else
echo "database connect failure";
?>
<?php
phpinfo()
?>
systemctl restart httpd
3.4.1、測試連通性,ok沒問題,開始cacti的安裝。
4、在tmp目錄下創建cacti文件夾用戶下載cacti相應的安裝包
cd /tmp
mkdir cacti
5、進入到cacti目錄,開始安裝
cd /tmp/cacti/
wget http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz
tar zxvf cacti-0.8.8f.tar.gz
mv cacti-0.8.8f /var/www/html/cacti
5.1、創建cacti數據庫和cacti用戶,賦予權限
mysql -u root -p
create database cacti default character set utf8;
grant all privileges on cacti. to cacti@localhost identified by 'cacti';
flush privileges;
5.2、把cacti.sql導入數據庫
mysql -ucacti -predhat cacti < /var/www/html/cacti/cacti.sql
5.3、修改config.php和global.php中對應數據庫的信息
vim /var/www/html/cacti/include/config.php
vim /var/www/html/cacti/include/global.php
/ make sure these values refect your actual database/host/user/password /
$database_type = "mysql"; 數據庫名稱
$database_default = "cacti";數據庫名稱
$database_hostname = "127.0.0.1";主機名稱
$database_username = "cacti";數據庫用戶名
$database_password = "cacti";數據庫密碼
$database_port = "3306";
$database_ssl = false;
/
6、配置snmp,修改一下對應行信息
vim /etc/snmp/snmpd.conf
41 com2sec notConfigUser default public
62 access notConfigGroup "" any noauth exact systemview none none
85 #view all included .1 80
systemctl restart snmpd.service
systemctl enable snmpd.service
7、創建cacti用戶,授權目錄權限
useradd -r -M cacti
chown -R cacti /var/www/html/cacti/rra/
chown -R cacti /var/www/html/cacti/log/
8、配置一個抓圖的計劃任務
crontab -e
/5 /usr/bin/php /var/www/html/cacti/poller.php >> /tmp/cacti_rrdtool.log
執行poller.php, 生成圖形
/usr/bin/php /var/www/html/cacti/poller.php
9、訪問安裝界面開始cacti的安裝,http://ip/cacti/安裝即可
下面為對應插件的安裝,注意插件的版本與cacti的對應即可,老版本可能會報錯
cacti插件setting、thold、monitor、wethermap、realtime、spine的安裝
wget https://docs.cacti.net/media/plugin:settings-v0.71-1.tgz
mv plugin\:settings-v0.71-1.tgz /tmp/cacti/settings-v0.71-1.tgz
tar -zxvf settings-v0.71-1.tgz
mv settings /var/www/html/cacti/plugins/*
wget https://docs.cacti.net/media/plugin:thold-v0.5.0.tgz
mv plugin\:thold-v0.5.0.tgz /tmp/cacti/thold-v0.5.0.tgz
tar -zxvf thold-v0.5.0.tgz
mv thold /var/www/html/cacti/plugins/
wget https://docs.cacti.net/media/plugin:monitor-v1.3-1.tgz
mv plugin\:monitor-v1.3-1.tgz /tmp/cacti/monitor-v1.3-1.tgz
tar -zxvf monitor-v1.3-1.tgz
mv monitor /var/www/html/cacti/plugins/
wget https://github.com/howardjones/network-weathermap/releases/download/version-0.98a/php-weathermap-0.98a.zip
unzip php-weathermap-0.98a.zip
mv weathermap/ /var/www/html/cacti/plugins/
插件安裝完畢后,進入weathermap視圖,點擊edit,如出現錯誤,需要修改weathermap/editor.php文件,將$ENABLED=false;改為$ENABLED=ture;
cd /var/www/html/cacti/plugins/weathermap/
vi editor.php
$ENABLED=true;
然后修改weathermap/configs/ 和weathermap/output/宿主權限:
chown -R apache:apache configs/
chown -R cacti:apache output/
修改完畢后就可以創建配置文件,添加圖形。若出現不能編輯圖形等問題,請關閉SElinux。
wget wget https://docs.cacti.net/media/plugin:realtime-v0.5-1.tgz --no-check-certificate
mv plugin\:realtime-v0.5-1.tgz /tmp/cacti/realtime-v0.5-1.tgz
tar -zxvf realtime-v0.5-1.tgz
mv realtime /var/www/html/cacti/plugins/
mkdir /var/www/html/cacti/cache
chown apache:apache -R /var/www/html/cacti/cache
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8f.tar.gz
yum -y install libtool net-snmp-devel mysql-devel
tar zxvf cacti-spine-0.8.8f.tar.gz
cd cacti-spine-0.8.8f
./configure
make && make install
cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
vim /etc/spine.conf
DBHost localhost
DBDatabase cacti
DBUser cacti
DBPass cacti
DBPort 3306
/usr/local/spine/bin/spine
SPINE: Using spine config file [/etc/spine.conf]
SPINE: Version 0.8.8f starting
SPINE: Time: 0.0913 s, Threads: 5, Hosts: 2
cat /var/www/html/cacti/log/cacti.log
firewall-cmd --permanent --add-port=161/udp
firewall-cmd --reload
然后進入cacti的Plugin Management上的頁面對插件進行安裝。**
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。