WMI Monitoring with Cacti
Monitoring machines with Cacti is easy when using SNMP but when you start adding Windows servers into the mix it can become a little more difficult. SNMP is available for Windows but it’s quite limited without the use of the old and unsupported perf2mib or the costly SNMP Informant (at least in regards to SQL and Exchange).
Advantages
- Built in.
- Plenty of documentation available.
- Supports most if not all performance counters (Exchange + SQL etc)
- Reliable.
- Possibly more secure.
Disadvantages
- RPC is required which could cause problems with firewalls.
- Requires an account with access to read WMI data.
The main problem with SNMP is that without spending a substantial amount of money on SNMP Informant or using the unreliable perf2mib it’s quite hard to get any useful results out of it. With WMI you can pull all sorts of information and monitor most performance counters across the system. And there are plenty of example power shell and vbscripts which can be used to monitor and access WMI information, so it’s relatively straightforward to monitor this data if you’re using a Windows server…
But if you’re not running Cacti on Windows you can’t use these scripts or the more common Perl:OLE. However we can rejoice for there is a WMI client available for Linux/Unix operating systems which can be used to harness the power of WMI and of course use Cacti to monitor these machines.
Now there is a plugin available for Cacti which allows you to query WMI whick looks promising but it does require manual patching of your Cacti install with the plugin architecture which is not always a viable option. Instead I have written up some scripts which will wrap around wmic and allow you to easily graph your windows hosts.
Some example graphs.
Disk I/O

CPU Usage

Disk Usage

As you can see they are quite useful and it can only get better as more scripts are made available. For now the PHP scripts and documentation (what little there is at the moment) can be found on my Subversion repository linked below, if you would like to help and expand this project swing me a message. At this stage there is no packaged release but ideally when they are stable and a lot cleaner packages will be made available.