像是CA、Zabbix、What's Up等
但用過這麼多套後Cacti還是相當容易上手安裝的一套
Cacti需要的相關套件為 MySQL, PHP, RRDTool, net-snmp,Apache.
但mysql不一定要與cacti裝在一起,故將步驟分開說明。
========
1.安裝相關套件(root only)
yum install httpd*
yum install php*
yum install net-snmp*
yum install rrdtool*
yum install freetype-devel libpng-devel libart_lgpl-devel
========
2. php 設定
vi /etc/php.ini
原來為
;date.timezone =
改為
========
2. php 設定
vi /etc/php.ini
原來為
;date.timezone =
改為
========
3.下載安裝cacti至目錄位置
yum install cacti
或是自行至網站下載新版(http://www.cacti.net/downloads/)
cd /tmp
wget http://www.cacti.net/downloads/cacti-0.8.tar.gz
tar -xzvf cacti-0.8.tar.gz
cp cacti /var/www/html/
(依不同設定也有可能在 /usr/share/)
若是yum大概都沒甚麼問題
==========
4.config html
vi /etc/httpd/conf.d/cacti.conf
Alias /cacti /var/www/cacti
<Directory /var/www/cacti>
DirectoryIndex index.php
order deny,allow
Addtype application/x-httpd-php .php
php_flag magic_quotes_gcp on
php_flag track_vars on
</Directory>
==========
5. service httpd restart
service httpd restart
==========
5.modify cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost"; //也可填寫ip如"192.168.1.99"
$database_username = "cactiuser";
$database_password = "cactipassword";
$database_port = "3306";
$database_ssl = false;
#
/*
Edit this to point to the default URL of your Cacti install
ex: if your cacti install as at http://serverip/cacti/ this
would be set to /cacti/
*/
//$url_path = "/cacti/"; <======將註解去除
$url_path = "/cacti/";
==========
6. crontab –e
*/5 * * * * root php /var/www/cacti/poller.php &>/dev/null
==========
7.SNMP設定
修改/etc/snmp/snmpd.conf
#com2sec notConfigUser default public
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
新增下列設定
com2sec local localhost public
com2sec mynetwork 192.168.3.0/24 public
group notConfigGroup v1 local
group notConfigGroup v2c local
group notConfigGroup v1 mynetwork
group notConfigGroup v2c mynetwork
view all included .1 80
view systemview included .1.3.6.1.2.1.2
access notConfigGroup "" any noauth prefix all none none
access notConfigGroup "" any noauth prefix all all all
===========
至此Cacti http端設定完畢
如果開啟網頁設定應該會顯示無法連結mysql
http://ServerIP/cacti/
接下來則是開始設定mysql端
看安裝於哪裡做決定
===========
安裝
1.yum install mariadb*
初始化設定
2.mysql
systemctl start mariadb
systemctl start mariadb
mysql_secure_installation
(該設定的設一設)
3.建立資料庫
mysql -u root -p
create database cacti ;
//GRANT cacti 資料庫權限給Cacti 資料庫使用者,密碼為cacti
//GRANT ALL ON '資料庫'.* TO '帳號'@'IP/hostname' IDENTIFIED BY '密碼';
//@後之IP或是HOSTNAME為限定其主機與IP可連結,留空白則為都開放。
grant all on cacti.* to 'cactiuser'@'localhost' identified by "cactipassword";
flush privileges;
FLUSH privileges; //刷新
4.將欄位設定匯入mysql
如果都安裝在同一台則
cd /var/www/cacti/
mysql -u root -p -A cacti < cacti.sql
如果不同台則要看root有無開放給其他主機登入(通常不會....)
如果無則需複製檔案至mysql主機上在執行此指令。
================
防火牆設定:
http 80
如果需查看SNMP須開啟udp 161 , 162
sudo firewall-cmd --permanent --zone=public --add-port=161/udp
sudo firewall-cmd --permanent --zone=public --add-port=162/udp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
=====
SELINUX需設定為permissive
# vim /etc/selinux/config
SELINUX=permissive
沒有留言:
張貼留言