Cacti的安裝配置
Cacti 安裝配置:回大綱
1.解壓縮壓縮包,把 Cacti 解壓到你網(wǎng)絡(luò)服務(wù)器的 DOCUMENT_ROOT 文件夾下:
shell> tar xzvf cacti-version.tar.gz
2.創(chuàng)建 MySQL 數(shù)據(jù)庫:
- shell> mysqladmin --user=root create cacti
3.導(dǎo)入默認的 Cacti 數(shù)據(jù)庫:
- shell> mysql cacti < cacti.sql
4.(可選)為 Cacti 數(shù)據(jù)庫設(shè)置用戶名和密碼:
- shell> mysql --user=root mysqlmysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';mysql> flush privileges;
5.編輯 "include/config.php" 設(shè)置數(shù)據(jù)庫類型,數(shù)據(jù)庫名稱,主機名,用戶和密碼:
- $database_type = "mysql";$database_default = "cacti";$database_hostname = "localhost";$database_username = "cactiuser";$database_password = "cacti";/* load up old style plugins here */$plugins = array();//$plugins[] = 'thold';/* 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/";/* Default session name - Session name must contain alpha characters */#$cacti_session_name = "Cacti";
只有在使用 Plugin Architecture (PIA) 時才需要設(shè)置$Plugins 數(shù)組。對老版本的插件,這些變量需要設(shè)置在 global.php,現(xiàn)在這些插件配置已經(jīng)從 global.php 中移出,被放置在 config.php 中。這樣改變的目的是使 global.php 盡量保持簡單的結(jié)構(gòu)。global.php 應(yīng)該是一個盡量不被編輯的文件,所以如果安裝了 PIA,那么就盡量不要編輯 global.php 文件。
基于同樣的原因,"URL_PATH" 變量也從 global.php 中被移動到 config.php。對于哪些從較老的 PIA 升級升級而來的人來說,需要了解的是,過去我們會嘗試"探測"這個路徑,但是,這種處理是不可靠的。因此,你需要在 config.php 中顯式的指定這一路徑。
6.為 Cacti 的目錄文件夾設(shè)置合適的權(quán)限,以支持圖形文件/日志文件的生成。你需要在 Caacti 目錄文件夾中執(zhí)行如下命令:
- shell> chown -R cactiuser rra/ log/
(使用有效的用戶名來替換上文中的 cactiuser, 這個用戶在下面配置數(shù)據(jù)采集的時候還要使用。)
7.在 "/etc/crontab" 文件中增加類似如如下的內(nèi)容:
- */5 * * * * cactiuser php /var/www/html/cacti /poller.php > /dev/null 2>&1
使用在上一步中指定的有效的用戶名來替換 cactiuser, 使用你的 cacti 完整路徑來替換 "/var/www/html/cacti/"。
(如果使用二進制包安裝的話,請確認crontab的這些內(nèi)容是否已經(jīng)在安裝時被設(shè)置了。)
譯者注:在RedHat及其衍生版本上,如此配置crontab是不可行的,crontab文件是不支持用戶名的配置的。推薦以確定用戶執(zhí)行 "crontab -u cacti -e" 然后添加:
- */5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
8.請確認cron守護進程已經(jīng)運行:
- shell> service crond startshell> chkconfig crond level 345 on
9.使用瀏覽器訪問 http://your-sever/cacti,初始的用戶名和密碼都是 "admin"。首次登錄時,系統(tǒng)會強制要求你立即修改密碼。
在下一步的配置中,請確認仔細填寫了所有的路徑,并且確保他們是正確的。
【編輯推薦】