Install and configure Cacti on IIS

Categories:

Cacti is an open source PHP/MySQL based graphing and monitoring solution designed to utilise the very powerful RRDTool data logging tool by Tobias Oetiker. Using RRDTool, Cacti is capable of graphing and monitoring everything from network interface usage to temperature. Basically anything that can log data in a format RRDTool can read can be graphed and monitored by Cacti. In this guide we'll look at the steps necessary to install Cacti into your IIS environment.

Install PHP and MySQL

Being a PHP/MySQL based application you will need to first ensure that you have PHP and MySQL installed and configured. If you have not done so yet, then you can use my guide on installing PHP 5 on IIS in 5 simple steps and my guide on how to install and configure MySQL 5 on Windows.

The only additional steps you'll need to take to prepare your PHP environment for Cacti is to enable the following PHP extensions;

php_snmp.dll
php_sockets.dll

If you don't know how to enable these extensions, then have a look at my guide on enabling PHP PECL extensions for Windows.

Configure Cacti & RRDTool

Next step is to download Cacti and RRDTool then extract them to where you plan to install them. Cacti itself would usually reside inside your webroot unless you plan to connect to via a virtual directory, and RRDTool can go anywhere really as long as PHP has access to it. This is particularly relevant if you use the open_basedir directive in php.ini

Once you have done this you will need to grant the IUSR_COMPUTERNAME user account and the IIS_WPG group read and execute permissions on cmd.exe. To do this open a command prompt and type in the following commands;

cacls %COMSPEC% /E /G %COMPUTERNAME%\IUSR_%COMPUTERNAME%:R

cacls %COMSPEC% /E /G %COMPUTERNAME%\IIS_WPG:R

If you need further information please have a look at this article I wrote on giving IIS access to cmd.exe. Please be aware this is a potential security risk, so do so at your own risk. You'll also need to give the IUSR_COMPUTERNAME user account and the IIS_WPG group NTFS read permissions to your Cacti installation directory, and NTFS write permissions to the log and rra directories inside your Cacti installation directory.

Finally, you'll need to set the values in your Cacti configuration file. This file is called config.php and is located in the include directory in your Cacti directory. In this file you'll need to specify the details which cacti will use to connect to your MySQL database, and will look something like;

$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";

Change these values to suite your environment.

Comments

Anonymous's picture

Other PHP Apps

Hi, I've installed Cacti on Win 2003, it is working fine, I have few other php apps installed on the server therefore i had php/mysql preinstalled, once I got cacti working, the other php apps don't work now, I get cannot modify header error. anyideas.
R.N

Brashquido's picture

That is a bit weird if those

That is a bit weird if those other apps were working to begin with. My first thought would be to ensure the output_buffering option in your php.ini is set to on, although PHP should work with it turned off. My other suggestion would be to do a search for "IIS" in your php.ini and ensure you have all the IIS specific directives set correctly as advised in the php.ini comments.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Problems with Links

I am having problems getting cacti to work on IIS and am obviously very interested in this article. However the links from this article to the other guides (such as installing php and enabling extensions etc.) don't seem to work for me.

Anonymous's picture

RE: Problems with Links

Scratch that last comment. The link at the bottom in the footer of the page to poular content / installing php works fine - sorry RTFM!

Brashquido's picture

Thank you for reporting it!

Thank you for reporting this! Had an issue a while back with the software that generates the friendly URL's, and ever since I've been hunting down links in my articles that are no longer valid. I've updated the links in this article now, and if you find any more like that feel free to report them again.
----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

blank display

hi, i have encountering blank display when i open localhost/cacti. What wrong with my setup?

thanks

Brashquido's picture

Back to basics

A blank screen could be caused by a lot of things, so first thing to do is to go back to basics. Do other PHP applications work? Did you verify that your PHP installation works at the basic level using the phpinfo function? Make sure you have enabled php logging using the log_errors and error_log directives in php.ini, and also check your IIS logs (C:\WINDOWS\system32\LogFiles by default) to see what status code IIS is reporting. In a nutshell we'll need more information than just a blank page to rectify the issue.

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

error to display localhost/cacti

#Software: Microsoft Internet Information Services 5.1
#Version: 1.0
#Date: 2009-04-25 02:58:48
#Fields: time c-ip cs-method cs-uri-stem sc-status
02:58:48 10.10.10.60 GET /cacti/ 302
02:58:48 10.10.10.60 GET /cacti/index.php 200
03:02:04 10.10.10.60 GET /cacti/ 302
03:02:04 10.10.10.60 GET /cacti/index.php 304
#Software: Microsoft Internet Information Services 5.1
#Version: 1.0
#Date: 2009-04-25 21:13:14
#Fields: time c-ip cs-method cs-uri-stem sc-status
21:13:14 127.0.0.1 GET /cacti/ 302
21:13:18 127.0.0.1 GET /cacti/index.php 500

Brashquido's picture

Most probably a PHP config issue rather than Cacti

You can see there is a 500 status code there at the end which means there is some form of server side error. This doesn't tell what is wrong though, but as I know Cacti works on IIS I'd suggest that it is a PHP configuration issue rather than anything to do with Cacti. Have a read through this article on the PHP http 500 error and also look through the comments for more suggestions. I also highly recommend enabling your php log as suggested above, and also use the phpinfo function to verify your php install.

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster