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.
Usage:
-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 10.0.0.1 -u /etc/wmi.pw -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, 1,574 hits)
Tagged Cacti, PHP, Windows, WMI