Cacti on Windows Server 2003 - My Experience

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
tymbow
Cacti User
Posts: 54
Joined: Sat May 14, 2005 8:00 pm

Cacti on Windows Server 2003 - My Experience

Post by tymbow »

This is just a collection of my experiences with running Cacti on Windows Server 2003. My main issues occurred because I wanted to run the components in specific locations on my disks. This can cause some issues which I have detailed following. I hope someone may find them useful. Generally I'd say just follow http://www.cacti.net/downloads/docs/htm ... ndows.html and all will be well, but for those who have to tinker...

SNMP
Windows default SNMP works just fine if you only want SNMP v1 and you don't want to install net-snmp.

IIS
Don't forget to set add a Web Service Extension to allow the PGP ISAPI dll component to execute (don't just enable Allow All Unknown ISAPI Extensions as it is a bad practice and defeats the purpose of having it in the first place).

MySQL
No problems whatsoever. The new installer for version 4.1.11 is excellent (very windows like). MySQL can be installed into any directory, and no special file permissions are required.

RRD Tool 1.2x
The first time I installed RRDTool I used the version from the RRDTool web site. You must use the version on the Cacti site compiled to work with Cygwin so SETUID can function correctly.

See: http://www.cacti.net/downloads/rrdtool/

RRDTool can be installed into any directory providing the file permissions are correct for the poller process to access rrdtool.exe and the associated components and that the paths are set correctly.

It is also important to set the RRD_DEFAULT_FONT environment variable to point to the font you want RRDTool to use (eg: c:\windows\fonts\arialn.ttf ). Note that the arialn.ttf does not appear to come with Windows Server 2003 (I nicked a copy from my Windows XP PC).

PHP
I have had no issues with PHP. It can be installed into any directory providing the file permissions are correct for the poller process and the IIS worker process account to access the php components (more on this below). The paths and MIBDIRS and PHPRC environment variables must also be correctly set.

It is important to ensure that both Cacti and the polling process use the php-win.exe and not php.exe.

Cacti
Cacti can be installed into any directory as long as the paths are set correctly and long file names (eg: C:\Program Files) are not used.

I have seen three problems which there have been numerous comments on:

1. Make sure that the IIS worker process account (eg: Network Service) and the IIS anonymous user account (only if your Cacti web site is accessible by anonymous users of course) have access to the cacti folder.

2. Make sure the account the poller process runs under has write access to the cacti folder (or just the rra subfolder).

3. For the cacti poller server scripts to function correctly when setting up graphs (eg: The host SNMP MIB CPU graphs), the IIS worker process account and IIS anonymous user account (same caveat as above) must have permissions on the cacti folder and at minimum the right to traverse to this folder. I have found that enabling bypass traverse checking makes no difference. As an example, if cacti is in d:\website\cacti the worker process account must have permission all the way from the disk root D: through website to the cacti folder. Folder traverse permissions are sufficient.

Smokeping Scripts
There is a post regarding a graph template built to work like Smoke Ping (http://forums.cacti.net/viewtopic.php?t ... =smokeping) which has had much interest. This will work perfectly with Windows with a modified version of the sample Perl script to use the version of FPING for Windows from http://www.kwakkelflap.com/fping.html. I can pass on my (crappy) Perl script if anyone wants it (it was my first Perl script so be nice).

I haven't had a chance to muck about with cactid yet. Apart from that all appears to work as it should - great product :D
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Great comments. Have you considered modifying the Cacti install manual for windows to include you comments relative to Windows 2003 and IIS. Most people just give up and run Apache. Your contribution to the project would be appreciated.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
BelgianViking
Cacti User
Posts: 97
Joined: Thu Mar 24, 2005 4:59 am
Location: Brussels, Belgium

I'd like that script

Post by BelgianViking »

I'd like that modified ping script very much in fact ...
Thanks !!
tymbow
Cacti User
Posts: 54
Joined: Sat May 14, 2005 8:00 pm

Post by tymbow »

Sure, here you go:

Code: Select all

use strict;

# Check a host was supplied

my $host = $ARGV[0];

if (!$host) {
	print "The host must be supplied. Eg: pinglatency.pl host";
	exit(1);
}

# Run fping

my $fping=`d://Website//cacti//scripts//fping.exe $host -n 10 -t 50`;

# Filter the output

my ($xmt, $rcv, $loss) = ($fping =~ /Sent = (\d+).+Received = (\d+).+Lost = (?:\d+).+(\d+)/);
my ($min, $max, $avg) = ($fping =~ /Minimum = (\d+\.?\d*).+Maximum = (\d+\.?\d*).+Average = (\d+\.?\d*)/);
my $dev1 = $avg - $min;
my $dev2 = $max - $avg;
my $dev = ($dev1 + $dev2) / 2;

# Write the results for cacti

printf ("min:%.3f avg:%.3f max:%.3f dev:%.3f loss:%.0f", $min, $avg, $max, $dev, $loss);
I'm sure someone probably can cleanup the regex a bit better than I did. Just adjust the path to fping and the fping switches as you see fit.
User avatar
TJworld
Posts: 4
Joined: Sat Jun 04, 2005 8:53 pm
Location: Nottingham, UK
Contact:

Post by TJworld »

I've just installed on Windows 2003 Enterprise Server SP1, cacti 0.8.6d with PHP 5.03 and the cygwin 1.2.9 RRDTool. I laready had PHP installed and working for other applications.

I hit a few snags:

The scheduled task for poller was timing out after 296 seconds... I ran php.exe from the command prompt and saw reports like this:

Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)

Googling eventually found a bug report for the php-snmp module that says the path to the MIBs was hard-coded in. The hard-coded path is "/usr/mibs/".

Copied the MIBs from D:/Server/PHP5/extras/mibs/ to D:/usr/mibs/

It cured the problem then but having just checked I'm getting the same reports again! What is the Environmental Variable that can be set for PHP to find the MIBs?

Also had to disable the magic-mime extension in PHP, it was generating tons of errors.

Added two hosts (the W2K3-EE and a W2K-SBS) as SNMP devices, monitoring traffic on their internal and external interfaces.

I didn't understand about the path to the default font file for RRDTool 1.2 in the settings and was wondering where the labels were, until I read this topic by tymbow :D

One problem outstanding:

In the console, Tree View never lists anything under the root entries. I tried creating a new Tree and a Header as well as adding graphs from the two hosts to the default tree.
I've also noticed that when trying to add a host the host-name combo is always empty. If I add a graph the graph-list combo looks to be correctly filled.

When I go to view the graphs the new tree is empty. If I add my graphs to the default tree they do not show up. I can only see the graphs if I choose preview mode.

SELECT * FROM graph-tree-items;

shows what appear to be the entries I've added but I'm not sure what good entries will look like.

There's nothing in the logging at all.

If I add the graphs to the tree from Graph Management action "Place On A Tree" the graphs appear correctly on the Graph View page, but still don't get listed in the console Tree View.

In hacking about in db table graph_local I noticed that the database stores the OID interface reference numbers in snmp_index - what happens if the interfaces are renumbered (as happens occassionally when Windows servers restart) ?

I know MRTG deals with this by allowing you to set the targets based on IP address or MAC address.
[color=red][b]TJ[/b][/color]
Cacti 0.8.6d+patches in PHP 5.0.3 with MySQL 4.1.7 on Windows 2003 Enterprise Server SP1
User avatar
TJworld
Posts: 4
Joined: Sat Jun 04, 2005 8:53 pm
Location: Nottingham, UK
Contact:

Post by TJworld »

Quick Update

It turns out when using the php_snmp.dll module that the hard-coded /usr/mibs/ causes PHP to add that to the Current Drive Letter of the starting directory of a PHP script.

In other words:

D:\usr\mibs\ = all the MIBs

Code: Select all

C:\>PHP.EXE
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Because PHP is looking for C:\usr\mibs\ - note the C drive whereas PHP and the MIBs are on the D drive

If your scripts are going to run PHP from more than one drive then you'd need a copy of \usr\mibs\ on each drive :roll:

See http://uk2.php.net/manual/en/ref.snmp.php

The Environmental Variable is:

set MIBDIRS=D:\\Server\\PHP5\\extras\\mibs

With that set everything gets back to normal 8)
[color=red][b]TJ[/b][/color]
Cacti 0.8.6d+patches in PHP 5.0.3 with MySQL 4.1.7 on Windows 2003 Enterprise Server SP1
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Double back slashes, hmm. Interesting. Does it still misbehave if you use single back slashes.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests