Last updated: July, 2009
Downloads
Required:
Optional:
Log on as an Administrator and install the following pieces of software.
Cacti
Recommended Install Path:
C:\Inetpub\wwwroot\cacti\
PHP
Recommended Install Path: C:\PHP\
Note: Do not install into a path containing spaces (i.e.
C:\Program Files\PHP\).
Note: PHP 5.2.10 and later dropped ISAPI support in favor for FastCGI.
MySQL
Recommended Install Path: C:\MySQL\
RRDTool
Recommended Install Path: C:\RRDTool\
Now at this point you have enough installed to configure and test before adding further complication and problems. Continue on to the patching section.
Installations - Optional Components
These various components are not required for Cacti to function. Some are a choice of preference or performance.
Spine
Recommended Install Path: C:\Spine\
Information: Spine is a poller for Cacti that primarily
strives to be as fast as possible. For this reason it is written in native C,
makes use of POSIX threads, and is linked directly against the net-snmp library
for minimal SNMP polling overhead. Spine is a replacement for the default
cmd.php poller so you must decide if using Spine makes sense for your
installation. It is highly recommended that users start out with the
default cmd.php poller until their installation is fully functional!
Cactid was renamed to Spine for the 0.8.7 release.
Cactid is for Cacti 0.8.6 and below.
Spine is for Cacti 0.8.7 and above.
WARNING: Spine is only compiled with Cygwin and thusly needs a few Cygwin dlls on the system. These are included with the downloaded zip file. This can become a problem if RRDTool is also compiled under a different Cygwin version, since then there will be different Cygwin dll versions on the system which can cause issues. If you're using a Win32 build of RRDTool, then nothing to worry about. There are a few ways to solve the problem:
Cygwin
Recommended Install Path: C:\Cygwin\
Information: Cygwin is a Linux-like environment for Windows.
The benefit of having Cygwin installed is so there that there are only one
set of Cygwin dlls on the system. Both RRDTool and Spine come with
cygwin dlls and can cause version conflicts. If you plan on compiling
RRDTool or Spine, Cygwin is required.
Base (whole thing)
Libs
libart_lgpl
libfreetype26 libintl3
libpng12 readline
zlib
Utils
patch
Web
wget
Apache
Recommended Install Path: C:\Apache2\
Note: Do not install into a path containing spaces (i.e.
C:\Program Files\Apache\) unless you're prepared to deal with 8.3 filenames.
Information: Using Apache instead of IIS is purely preferential
as Cacti works with either.
If planning on using Apache, it should be installed before installing PHP.
Make sure you have stopped & disabled all IIS services before you proceed with the Apache installation.
Net-SNMP
Recommended Install Path: C:\Net-SNMP\
Information: If PHP 5.2 is not installed, then Net-SNMP should
be installed. If you plan to use any hosts with SNMP v3 support, you must install the Net-SNMP binaries,
since the PHP SNMP extension does not handle SNMPv3. You do NOT
need to install/use the Net-SNMP SNMP agent. The Microsoft SNMP agent is
recommended. The Net-SNMP binaries are useful when creating custom
scripts, as they provide an easy way to query SNMP data from devices.
PHP:
Verify the PHP installer properly added C:\PHP\ to your Windows PATH environment variable.
The Windows path variable can be accessed via the Control Panel at: System | Advanced | Environment Variables
In the System Variables groupbox, find Path and click Edit. Make sure C:\PHP\ is in there somewhere.
Verify the PHP installer properly added a new system variable called PHPRC. Its value should be C:\PHP\.
Add a new system variable called MIBDIRS. Its value should be C:\PHP\Extras\mibs
Refer to step 1 on the location of the System Variables
Under the System variables groupbox, click on New.
In the Variable name field, type MIBDIRS.
In the Variable value field, type C:\PHP\Extras\mibs
Click OK and close the dialog boxes.
Find and then uncomment/modify the following lines in C:\PHP\php.ini.
fastcgi.impersonate = 1
register_argc_argv = On
safe_mode = Off
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
upload_tmp_dir = "C:\PHP\Uploadtemp"
session.save_path="C:\PHP\Session"The following resource limits should be changed from their defaults. Depending on the scripts, amount of data being returned and number of devices you use, they might need to be further increased at a later period in time.
max_execution_time = 60 ; Maximum execution time of each script, in seconds
max_input_time = 120 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume (8MB)
If you have had previous versions of PHP installed, you had likely moved the PHP system files to in the Windows directory structure. If so, you will have to remove those files. Please review your PHP installation documentation for instructions on removing those files.
Change NTFS permissions on C:\PHP\Uploadtemp and C:\PHP\Session to grant Modify rights to the IUSR_ and IIS_WPG users for only files in the directory.
IIS:
Instead of retyping all the instructions configuring PHP for FastCGI, please read the following links. For IIS 7, read this link. For IIS 5.1 and 6, read this link.
The instructions below are for older PHP versions which use the ISAPI module. FastCGI users will still need to follow the bottom half of the instructions though, just disregard the php5isapi.dll stuff.
Note: IIS6 has the IIS_WPG user account. IIS7 it's called IIS_USRS.
Start the Internet Information Services (IIS) Manager, right click on Default Web Site and select Properties.
Under the ISAPI Filters tab:
Click on Add.
In the Filter Name field, type: .php.
In the Executable field, click on Browse...
Navigate to C:\PHP\php5isapi.dll.
Click OK.
Under the Home Directory tab:
Verify the PHP installer created a mapping for the .PHP extension to C:\PHP\php5isapi.dll.
Verify the .PHP mapping has All Verbs and Script Engine checked.
Under the Documents tab, add index.php to the list.
Click OK to close the Default Website Properties window.
Completely stop and start the IIS service using the following commands from the command prompt. Alternatively, use the Service MMC snap-in under Administrative Tools.
net stop iisadmin
net start w3svc
c:\> php -m [PHP Modules] bcmath calendar com_dotnet ctype date dom filter ftp hash iconv json libxml mssql mysql odbc pcre Reflection session SimpleXML snmp sockets SPL standard tokenizer wddx xml xmlreader xmlwriter zlib [Zend Modules]
RRDTool
MySQL
Stop the MySQL service.
Edit your C:\MySQL\my.ini file
Verify you don't have a sql-mode defined. If so, comment it out.
#Use old password encryption method (needed for 4.0 and older clients).
old-passwords
Start the MySQL service.
Set a password for the root user (if not set already during MySQL installation)
c:\> mysqladmin --user=root password somepassword
c:\> mysqladmin --user=root --password reload
Create the MySQL database:
c:\> mysqladmin --user=root --password create cacti
Import the default Cacti database:
c:\> mysql --user=root --password cacti < c:\inetpub\wwwroot\cacti\cacti.sql
Create a MySQL username and password for Cacti.
c:\> mysql --user=root --password mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipw';
mysql> flush privileges;
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('cactipw') WHERE Host = 'localhost' AND User = 'cactiuser';
mysql> FLUSH PRIVILEGES; mysql> exit
Cacti
Edit c:\inetpub\wwwroot\cacti\include\config.php and specify the MySQL user, password and database for your Cacti configuration.
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipw";
Point your web browser to http://localhost/cacti/
You should be presented with the Cacti Installation Guide
page.
PHP Binary Path:
c:/php/php.exe
RRDTool Binary Path:
c:/rrdtool/rrdtool.exe
RRDTool Default Font Path:
c:/windows/fonts/arial.ttf
RRDTool Version:
Select the appropriate version
SNMPGET, SNMPWALK, SNMPBULKWALK, SNMPGETNEXT Paths:
c:/net-snmp/bin/snmpget.exe
c:/net-snmp/bin/snmpwalk.exe
c:/net-snmp/bin/snmpbulkwalk.exe
c:/net-snmp/bin/snmpgetnext.exe
Cacti Logfile Path:
c:/inetpub/wwwroot/cacti/log/cacti.log
Spine Path:
c:/Spine/Spine.exe
Description: localhost
Hostname: localhost
Host Template: Windows 2000/XP
php c:\inetpub\wwwroot\cacti\poller.php
C:\> php c:\inetpub\wwwroot\cacti\poller.phpAfter this has ran once, you should have cacti.log in /cacti/log/ and rrd files in /cacti/rra/.
10/28/2009 04:57:12 PM - SYSTEM STATS: Time:1.7272 Method:cmd.php Processes:1 Threads:N/A Hosts:1 HostsPerProcess:2 DataSources:4 RRDsProcessed:2
You are going to need to schedule a task while logged on as an Administrator account, so poller.php can run every 5 minutes. Make sure the Task Scheduler service is started and follow the steps below to begin.
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 modify permissions to the following directories:
c:\inetpub\wwwroot\cacti\rra\
c:\inetpub\wwwroot\cacti\log\
Make sure the user has Read & Execute permissions to the following directories:
c:\php\
c:\inetpub\wwwroot\cacti\
c:\rrdtool\
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 the repetition for every 5 minutes, set the duration for 24 hours, and check the If the task is still running, stop it at this time checkbox.
Click OK
In the Run textbox enter the following text making sure to use the appropriate paths.
c:\php\php.exe c:\inetpub\wwwroot\cacti\poller.php
The start in box should say c:\inetpub\wwwroot\cacti.
After waiting 10 minutes (aka 2 polling cycles), one should be able to view the graphs.
Go to Graph Management and click on each graph to view its progress.
Go to Graph Trees and click on Default Tree.
Click on Add.
Under Tree Item Type, select Host. Click on Create and then Save.
View the new graph tree by clicking on the Graphs tab at the top of the screen.
Configuration - Optional Components
Apache:
Add the following lines to your httpd.conf file in the c:\apache2\conf directory:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php PHPIniDir "C:/php"
DirectoryIndex index.php index.html index.htm
Net-SNMP
Append the MIBDIRS system variable with the path of
Net-SNMP MIB files.
MIBDIRS=c:\php\extras\mibs;C:\Net-SNMP\share\snmp\mibs
Modify the Spine.conf file in c:\Spine to include the following statements.
DB_Host IP Address or Hostname (not localhost)
DB_Database cacti
DB_User cactiuser DB_Password cactipw DB_Port 3306
If you have Cygwin installed, remove the DLL files from the c:\Spine directory.
CMDPHP: Poller[0] Host[2] DS[18] SNMP: v1: 192.168.100.1, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.1, output: 322328722 CMDPHP: Poller[0] Host[2] DS[18] SNMP: v1: 192.168.100.1, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.1, output: 426701050If the output was NaN, then Cacti did not collect any data. This is where either the Net-SNMP tools or GetIF comes in handy for testing SNMP.
C:\net-snmp\bin>snmpwalk -v 1 -c public 192.168.2.1 .1.3.6.1.2.1.2.2.1
POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\inetpub\wwwroot\cacti\rra\cable_modem_traffic_1.rrd --template traffic_out:traffic_in 1141333802:322328722:426701050
Optimizations:
There are several things you can do to speed up your Cacti web server. It's suggested that you only apply these
after you have a fully functional Cacti installation.
#The memory allocated to store results from old queries.
query_cache_size=16M
#Don't cache results that are bigger than this.
query_cache_limit=1M
#Query cache type to use.
query_cache_type=1
FAQ (eventually added to the FAQ section of Cacti)
Q: Call to undefined function mysql_connect() in C:\Inetpub\www\cacti\lib\adodb\drivers\adodb-mysql.inc.php on line 338
A: This is caused because newer versions of PHP no longer support the new client libraries for MySQL 4.1.0 and beyond. The universal fix is to apply the
old client
hack, outlined in the MySQL section above. Cacti will not
work with the php_mysqli extension.
Q: How do I stop the command windows from opening every 5 minutes?
A: This is occurring because your Cacti scheduled task is using the same user name you've logged onto the computer with. There are two possible fixes:
Set objWSHShell = WScript.CreateObject("WScript.Shell")
objWSHShell.Run "poller.php", 0, FalseC:\Windows\system32\wscript.exe "C:\invisible.vbs" "C:\Inetpub\wwwroot\cacti\poller.php"
Q: I see errors in the cacti.log file. How to I find out what is wrong?
A: Turn up the logging level in Cacti. In Cacti go to Settings and change the Poller Logging Level to Debug for one cycle. If you notice your log file is filled with WEBLOG entries, which makes it hard to follow what is going on, then uncheck all of the Web Events, save and wait for the next polling cycle.
Q: Does Cacti use MIB files?
A:
No. But they are handy to have around when making custom scripts in conjunction
with Net-SNMP or GetIF. PHP SNMP and Net-SNMP do use MIB files to resolve OIDs to friendly names.
Q: How can I debug SNMP output from a device?
A: The easiest tools are either GetIf or Net-SNMP. GetIf is fairly self explanatory since it has a GUI. Using the MBrowser tab is handy for navigating the SNMP trees and OIDs. Net-SNMP is comprised of several tools. You'll want to use snmpget and snmpwalk. An example of parsing the interfaces on a device would be:
C:\net-snmp\bin\> snmpwalk -v 1 -c public 127.0.0.1 .1.3.6.1.2.1.2.2An alternative would be to use a MIB name. This of course does require the use of MIB files:
C:\net-snmp\bin\> snmpwalk -v 1 -c public 127.0.0.1 ifDescr
Q: Why doesn't Windows return Disk or CPU usage via SNMP?
A: Open up the SNMP Service and click on the Agent tab. Make sure all the service checkboxes are marked (they are not by default). Restart the SNMP service. Also try increasing the SNMP timeout and decreasing the Maximum OID's Per Get Request.
Q: How do I get FastCGI working?
A: For IIS 7, read this link. For IIS 5.1 and 6, read this link.
The following has been superceeded by the above FAQ. Left in for history.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI]
"S"StartServers"=dword:00000002
"IncrementServers"=dword:00000002
"MaxServers"=dword:00000019
"Timeout"=dword:00000258
[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI\.php]
"AppPath"="c:\\php\\php-cgi.exe"
"BindPath"="php-fcgi"
Q: ERROR: change root is not supported by your OS or at least by this copy of rrdtool.
register_argc_argv = On
safe_mode = Off
Another possibility is a logic bug in cmd.php only present in Cacti 0.8.6j and
PHP 5.2. Open cmd.php and go to line 49. Change it to:if (version_compare("5.2.0", PHP_VERSION, ">=")) {
Allow remote administration exception
Allow local port exceptions
Get properties on WMI Control.
Enable Account Enable Remote
Remote Activation
Q: Why doesn't a WMI counter say it exists when I know it should?
A: It's possible you need to run wmiadap /f which will re-parses all the performance libraries on the system.
Q: I don't see any graphs on the main graph page, but when I click on one, I see 4 graphs with data.
A: This happens because you have the wrong version of RRDTool selected in Cacti. Set it by going to Settings and applying the proper RRDTool Utility Version.
Q: Why do my graphs randomly not have any text while the data is properly displayed?
A: It seems there is a bug in newer versions of PHP
4 & 5, specifically in php4ts.dll. Get php4ts.dll from PHP 4.3.11 and replace the current one in your PHP directory. *WARNING* not responsible for any adverse affects this might have on your system.
Q: How does one know if Cacti has debugging logging properly enabled?
A: It seems there is a bug in Cacti were even though the logging level is set to DEBUG, you do not truly get debugging output.
If your log file is filled with something like the following which constantly repeats, Cacti is NOT in debugging mode:
CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, <snip> CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
If your log file contains things like the following, then debugging logging is properly enabled:
CMDPHP: Poller[0] Host[1] SNMP: Host responded to SNMP
CMDPHP: Poller[0] DEBUG: SQL Exec: "update host set status = '3', status_event_count = '0', status_fail_date = '2006-01-19 02:20:10', <snip>
CMDPHP: Poller[0] Host[1] RECACHE: Processing 3 items in the auto reindex cache for 'ares.mydomain.com'.
CMDPHP: Poller[0] DEBUG: SQL Exec: "update poller_reindex set assert_value='368365818' where host_id='1' and data_query_id='8' and arg1='.1.3.6.1.2.1.1.3.0'"
CMDPHP: Poller[0] DEBUG: SQL Exec: "update poller_reindex set assert_value='368365819' where host_id='1' and data_query_id='14' and arg1='.1.3.6.1.2.1.1.3.0'"
CMDPHP: Poller[0] Host[1] DS[10] SNMP: v2: ares.mydomain.com, dsname: proc, oid: .1.3.6.1.2.1.25.1.6.0, output: 53
CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id,rrd_name,time,output) values (10,'proc','2006-05-28 09:20:02','53')"
CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_id,end_time from poller_time where poller_id = 0"
CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_output.output, poller_output.time, poller_output.local_data_id, poller_item.rrd_path, <snip>
CMDPHP: Poller[0] DEBUG: SQL Exec: "delete from poller_output where local_data_id='10' and rrd_name='proc' and time='2006-05-28 09:20:02'"
POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\ares_proc_10.rrd
Q: What are the NTFS permissions that need to be set for Cacti to
function?
A:
| Alias | Username/Group | Desciption |
|---|---|---|
| TaskUser | Domain\Usename | The user account that runs the scheduled task for Cacti. |
| IIS_USER | IUSR_COMPUTERNAME | Internet Guest Account (Windows NT/2000/XP/2003) |
| IIS_USER | IUSR | Internet Guest Account (Windows Vista/2008) |
| IIS_SERVICE | IIS_WPG | IIS Service Account (Windows 2003) |
| IIS_SERVICE | IIS_USRS | IIS Service Account (Windows Vista/2008) |
| Path | User | NTFS Permissions |
|---|---|---|
| C:\Spine\ | TaskUser | Read & Execute |
| C:\Cygwin\bin\ | TaskUser | Read & Execute |
| C:\Inetpub\wwwroot\cacti\ | TaskUser | Read & Execute |
| IIS_USER | Read & Execute | |
| C:\Inetpub\wwwroot\cacti\rra\ | IIS_SERVICE | Modify |
| IIS_USER | Modify | |
| TaskUser | Modify | |
| C:\Inetpub\wwwroot\cacti\log\ | IIS_SERVICE | Modify |
| IIS_USER | Modify | |
| TaskUser | Modify | |
| C:\PHP\ | IIS_USER | Read & Execute |
| TaskUser | Read & Execute | |
| C:\PHP\sessiondata\ | IIS_USER | Modify (Files only) |
| C:\PHP\uploadtemp\ | IIS_USER | Modify (Files only) |
| C:\Net-SNMP\ | IIS_USER | Read & Execute |
| C:\RRDTool\ | IIS_USER | Read & Execute |
| TaskUser | Read & Execute | |
| C:\Windows\System32\cmd.exe | IIS_USER | Read & Execute |
| IIS_SERVICE | Read & Execute | |
| TaskUser | Read & Execute |
Q: How do I reset the default permissions and user rights for IIS?
A: http://support.microsoft.com/kb/812614
Q: How do I repair my Cacti database?
A: Run the following from the command prompt: