◎ 軟體基本需求
1.(非必要) Apache> - 這個軟體是非必要的如果您的 Windows 已經有 Windows Internet Information Server.
2.Cacti> - 安裝它從 *.zip 的檔案,並將它解壓縮,然後將程式檔案複製到在您的網頁目錄裡 "Cacti" 的資料夾裡.
3.Cactid - 安裝它從 *. zip 的檔案 ,並將它解壓縮到 c:\cacti 資料夾. 確定您的 cactid.conf 檔案裡的 MySQL 資訊都正確.
4.RRDTool - 安裝它並從 Cacti 網站下載. 安裝到 c:\cacti 資料夾.
5.PHP 4.3.6+ or 5.x - 安裝它在 c:\php 資料夾或者其他資料夾.
6.MySQL 4.x or MySQL 5.x - 安裝在預設的資料夾.
7.(非必要) Cygwin - 下載它從 Cygwin website. 執行 setup.exe 檔案,之後就可以使用它.
8.Net-SNMP - 安裝它在 c:\net-snmp 資料夾.
9.(非必要)ActivePerl - 如果您要執行perl檔的話,請安裝它.
◎ 設定PHP
假如您使用PHP 4 建議將安裝目錄選在 c:\php 下面
增加系統變數 PATH c:\php 系統變數的設定在 控制台 → 系統 → 進階 → 環境變數 → 系統變數
新增一個新的系統變數 PHPRC c:\php
新增一個新的系統變數 MIBDIRS 假如使用PHP4 設定如下 c:\php\mibs ,假如使用PHP5 設定如下 c:\php\extras\mibs
假如您使用 PHP 4.3.5 或者更少,請建立下面資料夾 c:\tmp
將您的 php.ini 移到 c:\php下面
假如使用 PHP4 請將 php.ini修改如下
extension_dir = c:\php\extensions
extension=php_snmp.dll
extension=php_sockets.dll
cgi.force_redirect = 0
假如使用 PHP5 請將 php.ini 修改如下
extension_dir = c:\php\ext
extension=php_mysql.dll
extension=php_snmp.dll
extension=php_sockets.dll
cgi.force_redirect = 0
假如您使用 PHP 4.3.5或者更少 請修改 php.ini 如下
session.save_path=c:\tmp
假如您想上傳檔案請將 php.ini 修改如下
file_uploads = On
◎ 安裝 RRDTool
下載 RRDTool zip 檔案從下面網站
http://www.cacti.net/downloads/rrdtool/win32/
並將它解壓縮,複製資料夾裡的資料到 c:\cacti .
◎ 安裝 Net-Snmp
從網站 http://net-snmp.sourceforge.net/ 下載最新版本的Win32檔案
並將它安裝在 c:\net-snmp 下面
◎ 啟動本機 SNMP
如果您也要偵測本機的snmp狀態請啟用它
開啟控制台 → 新增移除程式 → 新增移除Windows元件 → Management and Monitoring Tools → Simple Network Management Protocol
將它打勾後點選確定並啟動它.
◎ 安裝 Cactid
下載 最新版本的 Cactid 從下面網站
http://www.cacti.net/downloads/cactid/packages/Windows/
解壓縮 Cactid zip 檔案,複製資料夾裡的資料到 c:\cacti,並確定 cactid.conf 檔案裡的下面資料符合您的MySQL資訊.
DB_Host 127.0.0.1 or hostname (請勿輸入 localhost)
DB_Database cacti
DB_User cactiuser
DB_Password cacti
DB_Port 3306
◎ 安裝ActivePerl
請到下面網站下載最新版本的ActivePerl for Windows
http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl
請下載5.6.x.xxx版本
◎ 設定 Cacti
下載最新版本的 Cacti 從下面網站
http://www.cacti.net/downloads/
解壓縮檔案後將檔案複製到您的網頁目錄
MySQL 裡新增一個 cacti 的資料庫 然後匯入 cacti_web_root/cacti/cacti.sql 這一個檔案
修改 cacti_web_root/cacti/include/config.php 這一個檔案,並符合您的 MySQL 資訊.
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
◎ 打開您的瀏覽器輸入下面網址:
http://your-server/cacti/install
並依照指示選擇 New Install 然後點選下一步
之後這裡需輸入一寫資訊,如rrdtool、php、snmpwalk、snmpget的位置,請依照您上面安裝路徑輸入正確的路徑
所有路徑都是此檔案的絕對路徑而不是所在目錄
如果事後無法顯示出圖形請到Configuration → Settings → General
→ RRDTool Utility Version 將它改成RRDTool 1.2x
如果有圖確沒文字的話,請到paths裡的RRDTool Default Font Path - c:/windows/fonts/arial.ttf
如果系統是Windows 2003 Server請將C:\WINDOWS\system32\cmd.exe及rrdTool跟netsnmp的*.exe加入IIS的使用者讀取權限,此舉對系統有一定的危險性,如果無相關對策請更改作業系統。
如果系統是是Windows 2003 Server 請到系統管理工具→服務→SNMP Service→安全性,將cacti後台裡的public新增到此群體裡,並將下面的可接受主機輸入進去,這樣才能存取Windows 2003 Server的SNMP資料
◎ 登入的帳號密碼
登入的帳號密碼預設都是 admin. 登入後需立即更改您的密碼。
◎ 定時執行命令
請打開您的命令提示自元
輸入下面
c:/php/php.exe c:/cacti_web_root/cacti/poller.php
測試是否有輸出下面類似資訊
C:\>c:/php/php.exe c:/cacti_web_root/cacti/poller.php
OK u:0.00 s:0.06 r:1.32
OK u:0.00 s:0.06 r:1.32
OK u:0.00 s:0.16 r:2.59
OK u:0.00 s:0.17 r:2.62
10/28/2005 04:57:12 PM - SYSTEM STATS: Time:4.7272 Method:cmd.php Processes:1 Threads:N/A Hosts:1 HostsPerProcess:2 DataSources:4 RRDsProcessed:2
之後您應該確認 cacti.log 檔案有在 /cacti/log/出現跟 *.rrd 檔案有在 /cacti/rra/ 出現.
點選開始 → 設定 → 控制台 → 排定的工作
點新增排定工作 → 下一步 → 點選瀏覽 → 並選擇 C:\PHP\php.exe
輸入排程名稱 選擇每日執行 → 下一步
這邊不要變更 → 下一步
輸入執行者的名稱及密碼 → 下一步
完成 → 勾起按下[完成]後開啟這項工作的進階內容
選擇上方選項裡的 → 工作 將執行裡的指令改成(請注意您的poller.php檔案的位置)
c:/php/php.exe c:/cacti_web_root/cacti/poller.php
選擇上方選項裡的 → 排程 點選進階
勾選 重覆執行 → 每隔改成5分鐘 → 直到:改成期間 24小時 0 分鐘
◎ 開始設定
現在您可以立即連線到cacti去設定了
以下是原廠英文說明
Chapter 3. Installing Under Windows
Software Components Required
-
(Optional) Apache> - This software is optional if running Windows Internet Information Server.
-
Cacti> - Install from the zip distribution and install in the web root or your choice. Many choose to install into a "Cacti" sub folder.
-
Spine - Install from the zip distribution into the c:\cacti directory. Make sure your spine.conf.dist is located in that directory as well.
-
RRDTool - Install from the Cacti website. Install it into the c:\cacti directory.
-
PHP 4.3.6+ or 5.x - Install into the c:\php folder. If you choose to install into c:\Program Files\php, you will have to use 8.3 filenames to reference it's binaries in Cacti.
-
MySQL 4.x or MySQL 5.x - Install into the default location. This is typically c:\Program Files\MySQL\MySQL Server X.XX.
-
(Optional) Cygwin - Download and execute setup.exe from the Cygwin website. Keep the setup.exe file for later use.
-
(Optional) Net-SNMP - Install to the c:\net-snmp directory. If you choose to use c:\Program Files\net-snmp you will have tu use 8.3 filenames to reference it's binaries in Cacti.
Configure PHP
-
If using PHP 4, move the files in c:\php\dlls to c:\php
-
Add the following directory to the existing Windows System PATH environment variable: c:\php. The Windows path can be accessed via the Control Panel at: System | Advanced | Environment Variables | System Variables.
-
Add the following directory to a new Windows System environment variable called PHPRC: c:\php.
-
Add a new Windows System environment variable called MIBDIRS. If using PHP 4, set it to c:\php\mibs. If using PHP 5, set it to c:\php\extras\mibs
-
If using PHP 4.3.5 or less, create the following directory c:\tmp.
-
Rename the file c:\php\php.ini.dist to php.ini, and make the following changes to it:
If using PHP 4 add/uncomment the following lines.
extension_dir = c:\php\extensions
extension=php_snmp.dll
extension=php_sockets.dll
cgi.force_redirect = 0
If using PHP 5 uncomment the following lines.
extension_dir = c:\php\ext
extension=php_mysql.dll
extension=php_snmp.dll
extension=php_sockets.dll
cgi.force_redirect = 0
If using PHP 4.3.5 or less include the following line. If using 4.3.6 or greater, you should remove this line if present.
session.save_path=c:\tmp
-
In earlier installation guides to PHP, they recommended moving certain DLL's to the c:\winnt\system32 directory. If so, you will have to remove those files. Please review the PHP installation documentation for instructions on removing those files.
-
If you want to allow template importing, uncomment the following line:
file_uploads = On
-
Give the user who will be running the scheduled task, modify rights to the .index file in the location pointed to by the MIBDIRS Windows System environment variable.
Configure the Webserver (Apache)
-
Make sure you have stopped any IIS web servers before you proceed with Apache installation, or make sure Apache is configured on an alternate port.
-
If you are using Apache 1.3.x, installation of PHP 5 is not recommended. If using PHP 4, add the following lines to your httpd.conf file. You can edit that file by selecting Start | All Programs | Apache HTTP Server X.XX | Configure Server | Edit the httpd.conf file pick from the Taskbar.
If using Apache 1.3.x and PHP 4, then add the following lines:
LoadModule php4_module c:\php\sapi\php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php
DirectoryIndex index.html index.htm index.php
If using Apache 2.x and PHP 4, then add the following lines:
LoadModule php4_module c:\php\sapi\php4apache2.dll
AddType application/x-httpd-php .php
DirectoryIndex index.html index.htm index.php
If using Apache 2.x and PHP 5, then add the following lines.
LoadModule php5_module c:\php\php5apache2.dll
AddType application/x-httpd-php .php
DirectoryIndex index.html index.htm index.php
Configure the Webserver (IIS)
-
Start the Internet Information Services (IIS) Manager, right click on the Default Web Site (in most cases) and select Properties.
-
Under the Home Directory tab, select Configuration and click Add. Browse to the path of php4isapi.dll or php5isapi.dll, and type in .php as the extension. Note: if using IIS6, Enable All Verbs and Script Engine.
-
Under the ISAPI Filters tab, click Add and browse to the php4isapi.dll or php5isapi.dll file. Name the filter "php" and click OK.
-
Under the Documents tab, add index.php to the list.
-
If using IIS6, goto Web Service Extensions and add a new Web Service Extension. Name the extension "php", and click Add and browse to the php4isapi.dll orphp5isapi.dll file, enable Set Extension status to Enable, and click OK.
-
Give the IUSR_XXXX and IIS_WPG users read & execute permissions to the file %windir%\system32\cmd.exe. They will also need read permissions on cacti_web_root/cactiand it's subfolders.
-
If using IIS6, give the IIS_WPG user modify permissions to the folders cacti_web_root/cacti/log and cacti_web_root/cacti/rrd.
-
Completely stop and start the IIS service using the following commands:
net stop iisadmin
net start w3svc
Install Cygwin (optional)
-
Installing a single instance of Cygwin, and using it for all applications that require it is recommended so you do not have different versions of the Cygwin dlls laying around on your system, which can cause conflicts.
-
Run setup.exe you previously download.
-
Once you reach the portion of setup entitled Select Packages, install the following:
Base (include all items)
Libs
libart_lgpl
libfreetype26
libpng12
zlib
openssl
Utils
patch
Web
wget
-
Add c:\cygwin\bin to your Windows System PATH environment variable.
-
Move setup.exe to c:\cygwin for future use.
Install RRDTool
-
Extract the RRDTool zip file from the Cacti web site to c:\cacti\rrdtool.exe.
Install MySQL
-
Extract the MySQL zip file to a temp directory and run setup.exe.
-
Install MySQL to the default directory, or for the purposes of this manual to the c:\mysql directory.
-
If running an older version of MySQL, start it by running c:\mysql\bin\winmysqladmin.exe. In more recent versions, this is not required.
-
Set a password for the root user
shell> cd mysql\bin
shell> mysqladmin --user=root password somepassword
shell> mysqladmin --user=root --password reload
-
Create the MySQL database:
shell> mysqladmin --user=root --password create cacti
-
Import the default Cacti database:
shell> mysql --user=root --password cacti < c:\apache2\htdocs\cacti\cacti.sql
-
Create a MySQL username and password for Cacti.
shell> mysql --user=root --password mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;
-
If you are running MySQl 4.1 and above, you will need to apply the old password setting in order to authenticate with Cacti. To make this change, stop the MySQL service and add the following to the Start Parameter field. Start it again once it has been added.
--old-password
You will also need to update the cactiuser account with the old password style.
shell> UPDATE mysql.user SET Password = OLD_PASSWORD('cactipwd')
WHERE Host = 'localhost' AND User = 'cactiuser';
mysql> FLUSH PRIVILEGES;
Install Net-SNMP
-
If you plan to use any hosts with SNMP v2c support, and are using early versions of PHP, you must download and install the Net-SNMP libraries. Net-SNMP provides installers to install their product. However, caution must be taken if you choose to use long file names as Cacti does not them as long file names. You will have to user 8.3 notation. For example c:\Program Files\Net-SNMP\bin becomes c:\progra~1\net-snmp\bin.
Install Spine
-
Extract the Spine zip file to c:\cacti and modify the spine.conf.dist file to include the following statements.
DB_Host 127.0.0.1 or hostname (not localhost)
DB_Database cacti
DB_User cactiuser
DB_Password cacti
DB_Port 3306
All other pre 0.8.6 settings are obsolete.
-
Spine now comes with a binary distribution. However, we strongly suggest that you install Cygwin and then remove all the DLL files and sh.exe from the c:\cacti directory.
Configure Cacti
-
Edit cacti_web_root/cacti/include/config.php and specify the MySQL user, password, database, and database port for your Cacti configuration.
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
-
Point your web browser to:
http://your-server/cacti/
Log in using the username and password of admin/admin. You will be required to change this password immediately.
-
From Cacti, go to Settings->Paths and verify/udate your paths to point to the correct locations. Recommended examples are posted below. If you plan on using Spine, then it is very important that all paths include forward slashes instead of backslashes.
PHP Binary Path:
c:/php/php.exe
RRDTool Binary Path:
c:/cacti/rrdtool.exe
SNMPGET, SNMPWALK, SNMPBULKWALK, SNMPGETNEXT Paths:
c:/progra~1/net-snmp/bin/snmpget.exe
c:/progra~1/net-snmp/bin/snmpwalk.exe
c:/progra~1/net-snmp/bin/snmpbulkwalk.exe
c:/progra~1/net-snmp/bin/snmpgetnext.exe
Cacti Logfile Path:
c:/mycacti/website/cacti/log/cacti.log
Spine Path:
c:/cacti/Spine.exe
-
Click on Devices. Delete the Localhost devices as it intended for Linux environments In the upper right corner, click Add. Fill in the following information and then click Add.
Description: My Windows localhost
Hostname: localhost
Host Template: Windows 2000/XP
-
You should now be looking at the localhost device screen. Right under it's name, there should be some SNMP information listed, if not you should double check the SNMP settings on the server and firewall settings. In the upper right-hand corner, click on Create Graphs for this Host. On the following screen, select a disk partition and network interface. At the bottom of the page, click on Create.
-
Log into the user account you'll be using for the scheduled task and verify starting a Cacti polling cycle works. Do this by running the following from the command prompt:
php c:/cacti_web_root/cacti/poller.php
The output should look something like the following:
C:\>php c:\inetpub\wwwroot\cacti\poller.php
OK u:0.00 s:0.06 r:1.32
OK u:0.00 s:0.06 r:1.32
OK u:0.00 s:0.16 r:2.59
OK u:0.00 s:0.17 r:2.62
10/28/2005 04:57:12 PM - SYSTEM STATS: Time:4.7272 Method:cmd.php Processes:1 Threads:N/A Hosts:1 HostsPerProcess:2 DataSources:4 RRDsProcessed:2
After this has ran once, you should have cacti.log in /cacti/log/ and rrd files in /cacti/rra/.
-
You are going to need to schedule a task while logged on as an Administrator. This task is required to you can run poller.php every 5 minutes. Make sure the Task Scheduler service is started and follow the steps below to begin.
Note: The following instructions are based on Windows XP and Windows Server 2003. You should be able to follow these instructions close enough for Windows 2000 as well.
-
Select Start --> Settings --> Control Panel and double click on Scheduled Tasks.
-
Double click on Add Scheduled Task.
-
Click Next and Browse on the following screen. Find c:\php and select php.exe. Choose Daily on and click Next.
-
Click Next again without changing the time or date settings.
-
When entering a username and password make sure the user has read and write access to the following directories:
cacti_web_root/cacti/rra
cacti_web_root/log
Make sure the user has read, write, and execute access to the following directories:
c:\php
c:\php\sapi
-
Click Next and Finish to close the wizard.
-
Right click on the task you just created, and select Properties.
-
Select the Schedule tab.
-
Make sure Daily is selected and click the Advanced button.
-
Check the Repeat checkbox, set it for 5 minutes and set the duration for 24 hours.
-
Click Ok
-
In the Run textbox enter the following text making sure to use the appropriate paths.
c:\php\php.exe c:\mycacti\website\cacti\poller.php
The start in box should say c:\mycacti\website\cacti.
Apply Patches
-
There are two methods of applying patches to Cacti:
-
If you have Cygwin installed, then the patch instructions which use wget and patch, will work.
-
The other method requires you to visit http://www.cacti.net/downloads/patches/0.8.6h/pre-patched/ and manually download and replace the patched files.
-
You might need to reapply file/folder security on the files patched. Double check they are correct.