Posts tagged: Cacti

0.0.6 Release of CactiWMI

I posted this on the forums some time ago and realised I had not posted here. This is the latest version, the mini change log is below.

  • Update templates to suit new input method
  • Backwards compatibility for old argument input method
  • Overhaul how arguments are passed to wmi.php
  • Debug mode via console option
  • Add support for alternate namespaces
  • Use isset() instead of is not null
  • Prevent passwords from showing up in process list
  • Fix data template MIN & MAX
  • Enterprise Vault Templates

I have added support for additional namespaces and overhauled how  input arguments are passed to support this. As you can see below the cmd line help details how input is now passed.

-h <hostname>         Hostname of the server to query.
-u <credential path>  Path to the credential file. See format below.
-n <namespace>        What namespace to use. (optional, defaults to root\CIMV2)
-w <wmi class>        WMI Class to be used.
-c <columns>          What columns to select. (optional, defaults to *)
-k <filter key>       What key to filter on. (optional, default is no filter)
-v <filter value>     What value for the key. (required, only when using filter key)
-d <debug level>      Debug level. (optional, default is none, levels are 1 & 2)

All special characters and spaces must be escaped or enclosed in single quotes!

Example: wmi.php -h -u /etc/ -w Win32_ComputerSystem -c PrimaryOwnerName,NumberOfProcessors -n ‘root\CIMV2′

Password file format: Plain text file with the following 3 lines replaced with your details.

username=<your username>
password=<your password>
domain=<your domain> (can be WORKGROUP if not using a domain)

In addition to this there is now no longer any need for additional PHP files. The passwords are stored in a separate file and called via passing the path. This prevents passwords showing up in your process list and allows you to secure it further by limiting access to the password file to the cacti user.

To ease the upgrade process backwards compatibility has been maintained however there is one gotcha. You will still need to update your templates to point to the new password file instead of the reference to the key pair in wmi-logins.php. Aside from this the old templates will all work.

So basically this version is a bit cleaner, adds a few key features, improves security and lays the foundation for further feature upgrades. As per usual the download is attached to this post and any fault tickets can be lodged on my Mantis bug tracker page (Link) and the subversion repository in the usual spot (Link).

  CactiWMI-0.0.6.r101.tar.gz (132.1 KiB, 4,622 hits)

0.0.5 Release of CactiWMI

It’s been a while since I released an update and there have been a number of templates since 0.0.4 so packaged them up ready for consumption :)

Below are some examples of what we now have!

So we have some standard Windows stats such as system calls, context switches and process/processor stats.





We can now also monitor processes themselves on an individual basis.



And some new Exchange graphs including the much requested SMTP graphs.




And here is the download. Any questions or suggestions let me know and feel free to stop by the thread on the Cacti forums (Link!).

  CactiWMI-0.0.5.r50.tar.gz (53.7 KiB, 1,620 hits)

New release with Exchange Monitoring!

It’s been a little while since I have released anything but after a bit of work I have a new version which now supports monitoring Exchange! Previously I had monitored Exchange myself via WMI using a custom PHP script but now this can all be done with a reasonably straight forward set of templates and the generic wmi.php :)

Aside from just supporting Exchange here are the changes below:

  • Now parses out spaces and replaces with an underscore (needed for anything that has a name with spaces in it)
  • Included new debug mode which logs detailed information to a per host text file
  • Code cleanup, should make it a bit easier to configure
  • General tweaking

The biggest issue with Exchange that I encountered was that the store names could have spaces which would throw off Cacti when it interpreted the data being passed to it. But as you can see from below the changes have fixed this issue and allow for some useful monitoring.



The templates are included in the attached tar file, please note however that the active client logons will need tweaking to suit your system. For me I created two graphs based on the template then removed the template so that the name of each store could be displayed on the graph. You can do this or alternatively do per store graphs however I found it to be overkill and used two graphs of 5 stores each.

The new debug mode logs by default to /tmp but you can adjust this to wherever you like so long as it has the correct permissions. Effectively what you will end up with is a log file per host of the filename dbug_xx.xx.xx.xx where the x’s are your IP. Inside it will contain basically all the variables being passed in and out as well as the direct output from wmic etc. With this you should be able to track whats going on and debug any issues.

So there you have it everything you need to get started. I will have some additional Exchange templates over the next few weeks so stay tuned! For now if you need help leave a message or drop by the Cacti forums. Also one last note you can browse the latest code and check out any build you like from the web based Subversion repository. Check it out at

  CactiWMI-0.0.4.r45.tar.gz (39.7 KiB, 984 hits)

First CactiWMI release! (0.0.3)

Yer yer I know it’s not the first actual release but it’s the first one I am posting up publicly.

CactiWMI is the project I have been working on as a method to monitor Windows servers and applications such as Exchange and SQL from a Linux based Cacti install. To do this it uses a combination of some PHP scripting and the WMI client for Linux which just so happens to be available as a Debian package :)

Anyway I’ve posted up some previous examples of what can be done and they were pretty rough. So here are a few examples of what can be done and what templates are available in the package.

Here we can monitor memory usage, this one showing the physical memory usage compared against the commit limit and the current commited bytes.


Simple disk space monitor. It also does not suffer from the SNMP remapping problem where when you add a new disk the OID’s are remapped and thus your stats break.


Pretty straight forward, disk I/O so you can see what is really going on when you have load problems.


CPU usage, available with templates for 1, 2 and 4 core machines. I will do one for an 8 core machine shortly.


SQL performance. Tested against SQL 2005.


Domain controller LDAP stats. If you use a lot of query based distribution groups or use LDAP for external authentication this can be invaluable to see when there are performance problems.



NT Domain Controller stats. Both authentications per second as well as the read/write/searches against your domain. Good for performance troubleshooting and detecting rogue applications.



Pretty useful no?

So how to set them up… Grab the package attached to this post. It will contain two PHP scripts and a number of templates. Extract the two files to your Cacti scripts folder and then start editing the wmi-logins.php file. In this file are listed the username/password pairs which are referenced by the script. This separates the credential itself from Cacti meaning your Cacti admins don’t actually need to know your WMI user which you are using to pull the stats. In any case add the credential as per the file which should be pretty self explanitory.

Before we go too much further there are some gotcha’s that need to be taken care of regarding the user you have selected to do the WMI queries. This user needs to both have access to remotely query WMI but also to be able to query the subsystems from WMI. What this means in our case is that the user needs have remote access to WMI, be allowed to remote query and then also to be allowed to access perfmon. From my understanding this is due to perfmon being a subsystem which WMI is accessing and thus the credential being used must also have access to the perfmon counters in order to be able to graph anything. For the WMI portion of things you can get most of the information from this MSDN link The basics are you grant the user permission to remote WMI as discussed, you then need to grant the user access to the appropriate WMI namespace, in our case this is CIMV2 and then add the user to the perfmon group which by default the 2003 server and up machines should have. This should grant it all the permission it requires, however if you do have problems test with an admin credential and see if you get results. If you do get results as admin but not as your non-admin user then you have a permission issue.

Ok so thats out of the way now you may need to update the wmi.php file to ensure the correct path to your wmic binary so edit that and ensure it is correct. Additionally you can redirect the location of the wmi-logins.php by editing the appropriate variable. Most of the code should be commented to help explain what it is doing, basically its acting as the glue between Cacti and the wmic results. So everything is in place, all that you need to do is import the templates included and attach them to the hosts you want to graph. The slack way I have been doing things is simply adding the graph to the device or the host template which will auto generate the required data sources when you add the graph however your more than welcome to do the the manual way by adding the data source and then the graph and linking the two. Make sure if you used a different credential name to update the data templates as I have not set them to be a per data source credential reference, you will understand once you take a look. It’s up to you if you need the ability to do per data source credentials for different servers but the option is there should it need to be enabled.

So that should cover everything, add your graphs and start monitoring those hosts! If there are any questions feel free to leave a comment or drop me a PM on the Cacti forums :) (51.6 KiB, 1,255 hits)

Monitoring a Speedstream 4200

Due to a recent ADSL fault I began monitoring the stats from my Speedstream 4200 DSL modem. I figured the Cacti graphs might be handy for anyone else out there in a similar situation. Example graphs are below :) As you can see there was a pretty bad line fault!




Attached below are the templates required, all that is really needed is a few Get SNMP data sources and away you go :)

  cacti_graph_template_sync_rate.xml (7.3 KiB, 826 hits)

  cacti_graph_template_snr_attenuation.xml (8.4 KiB, 759 hits)

For reference here are the SNMP OID’s required to pull the stats.

Attenuation    .
Sync        .
SNR        .

Attenuation    .
Sync        .
SNR        .

One last thing… I have attached to this post the latest open version of the firmware. As these modems were always branded when sold you may require the open version to get around the VOIP block and also enable a few of the hidden features that were turned off by some resellers.

  Update_D240_A5Y_106-15_j045_v1r.exe (1.8 MiB, 743 hits)