Monitor Windows via WMI from Cacti on Linux
Moderators: Developers, Moderators
Or even Ben Coleman's WMI Query tool..
Which gives all the lines if you run this query:
SELECT * FROM Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox
One line per Mounted DB (+ one for total I think) with a column for each counter....
So if there is a "Count" function in WQL...
Which gives all the lines if you run this query:
SELECT * FROM Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox
One line per Mounted DB (+ one for total I think) with a column for each counter....
So if there is a "Count" function in WQL...
No longer a n00by, probably, by now an 0ldby
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Well this
Returns the correct no. of mounted DBs!!
So there should be a way to write a data query to return this data to Cacti, and to set it up as a template, using your wmi stuff.... (particularly the security (username/password) bit of it)....
[EDIT:] Wonders to self if it might be a good idea to include a count with all queries, then realises this would only work on all Select * from queries, where as, atm, each query returns a specific row. To get sensible data from select * query you'd need to use index method to get data... Which must have been what Jimmy did...
So will work on creating a query to get the data into Cacti specifically for Exchange DBs
Code: Select all
<?php
exec('/var/www/html/plugins/wmi/wmic -U domain/username%password //x.x.x.x "select * FROM Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox"',$out);
$count = (count($out)-2);
echo $count;
?>
So there should be a way to write a data query to return this data to Cacti, and to set it up as a template, using your wmi stuff.... (particularly the security (username/password) bit of it)....
[EDIT:] Wonders to self if it might be a good idea to include a count with all queries, then realises this would only work on all Select * from queries, where as, atm, each query returns a specific row. To get sensible data from select * query you'd need to use index method to get data... Which must have been what Jimmy did...
So will work on creating a query to get the data into Cacti specifically for Exchange DBs
No longer a n00by, probably, by now an 0ldby
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Sorted!!!
Thanks for the pointers Claymen, look forwards to your next revision...
If anybody else is interested in this, here's how I did it.
Using Claymen's wmi.php as a template I created a script which returns Count:xx Where xx = no. of rows returned by Query. See attached.
Then I created a Data Template, with three values - hostname, Credentials, and class. Specifying the default values for credentials (in my case cacti, you may want to change this) and class = Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox
BTW a quick edit of the Class element should give you the ability to count the rows returned by any Query.
And a Data Input Method which took these and queried using the wmi-countrows.php script
Finally created a script graphing the Count value...
These Latter 3 should be in the XML attached, just import this using the Cacti import facility - it should work with any .8.7 version as I'm not doing any CDEF calculations.
Good luck, if you try it out let me know if it works.
I'm not sure if this xml file includes the Data Input Methods/Templates - although it looks as if it does, let me know if you need them separately
I developed this because we occasionally get our Exchange Server dropping Databases - something to do with it being a Virtual Machine, and us using vcbmounter to get a backup...
Now, if Jimmy comes through with the "run script" functionality of thresholds I can script the Exchange Server to remount the DBS if they get dismounted.... (maybe...)
Cheers
Argon0
Thanks for the pointers Claymen, look forwards to your next revision...
If anybody else is interested in this, here's how I did it.
Using Claymen's wmi.php as a template I created a script which returns Count:xx Where xx = no. of rows returned by Query. See attached.
Then I created a Data Template, with three values - hostname, Credentials, and class. Specifying the default values for credentials (in my case cacti, you may want to change this) and class = Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox
BTW a quick edit of the Class element should give you the ability to count the rows returned by any Query.
And a Data Input Method which took these and queried using the wmi-countrows.php script
Finally created a script graphing the Count value...
These Latter 3 should be in the XML attached, just import this using the Cacti import facility - it should work with any .8.7 version as I'm not doing any CDEF calculations.
Good luck, if you try it out let me know if it works.
I'm not sure if this xml file includes the Data Input Methods/Templates - although it looks as if it does, let me know if you need them separately
I developed this because we occasionally get our Exchange Server dropping Databases - something to do with it being a Virtual Machine, and us using vcbmounter to get a backup...
Now, if Jimmy comes through with the "run script" functionality of thresholds I can script the Exchange Server to remount the DBS if they get dismounted.... (maybe...)
Cheers
Argon0
- Attachments
-
- wmi-countrows.rar
- Unrar file, and upload to the scripts directory of your Cacti Installation.
- (1.85 KiB) Downloaded 195 times
-
- cacti_graph_template_exchange_-_mounted_databases_wmi.xml
- Import this using Cacti's import facility
- (9.12 KiB) Downloaded 350 times
-
- Example Graph
- Exchange Mounted DBs.png (14.89 KiB) Viewed 4837 times
No longer a n00by, probably, by now an 0ldby
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Name is returned by default however I didn't have it set to be stored in the RRD file. I didn't see store size anywhere in the classes but if its there then yer it'd be possible. I'll have a skim over and see if I can spot it.mcutting wrote:Claymen - is it possible to return the store name and size using the bones of this query ? This is something I'd like to have. (I am talking Exchange)
Claymen/Mcutting...
I suspect I have brain freeze, but... Is there a way to get this/similar data from a Linux machine?
I've tried the linux and unix templates, but they just give the same data whichever host I point them at (i.e. the same as the local host), I would have thought I could get some, if not all, the data required via SNMP, but....
And I can't believe there are no templates out there...
Argon0
I suspect I have brain freeze, but... Is there a way to get this/similar data from a Linux machine?
I've tried the linux and unix templates, but they just give the same data whichever host I point them at (i.e. the same as the local host), I would have thought I could get some, if not all, the data required via SNMP, but....
And I can't believe there are no templates out there...
Argon0
No longer a n00by, probably, by now an 0ldby
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
New release 0.0.6-RC1
Well the time has come for a new release.
Attached is the 0.0.6-RC1 release. There has been a whole stack of changes but here are the main ones that I can remember (you are welcome to check the SVN logs).
- 0000016: [template] Update templates to suit new input method (claymen) - resolved.
- 0000018: [feature] Backwards compatibility for old argument input method (claymen) - resolved.
- 0000012: [feature] Overhaul how arguments are passed to wmi.php (claymen) - resolved.
- 0000003: [feature] Debug mode via console option (claymen) - resolved.
- 0000013: [feature] Add support for alternate namespaces (claymen) - resolved.
- 0000008: [authentication] Prevent passwords from showing up in process list (claymen) - resolved.
- 0000006: [template] Fix data template MIN & MAX (claymen) - resolved.
- 0000005: [feature] Enterprise Vault Templates (claymen) - resolved.
So basically, much cleaner and added support for alternate namespaces. Better input methods which means adding features later on is easier. A bunch of new templates and of course the security updates. And also added the good ol readme.txt and help info when you run wmi.php without arguments.
One thing to keep in mind with this, although backwards compatibility was added you still need to change your credential reference to a path to the credential file. Basically you no longer need wmi-logins.php instead you specify the path to the credential file as per Samba actually... But for reference it is included in the readme and of course below for you.
You reference that file and lock down the permissions and then you also no longer have details showing up in your process list
So give it a go and if there are any issues please log tickets on the bug tracker so that I can follow them up Ideally there won't be any and I can mark this as the final 0.0.6 release.
Attached is the 0.0.6-RC1 release. There has been a whole stack of changes but here are the main ones that I can remember (you are welcome to check the SVN logs).
- 0000016: [template] Update templates to suit new input method (claymen) - resolved.
- 0000018: [feature] Backwards compatibility for old argument input method (claymen) - resolved.
- 0000012: [feature] Overhaul how arguments are passed to wmi.php (claymen) - resolved.
- 0000003: [feature] Debug mode via console option (claymen) - resolved.
- 0000013: [feature] Add support for alternate namespaces (claymen) - resolved.
- 0000008: [authentication] Prevent passwords from showing up in process list (claymen) - resolved.
- 0000006: [template] Fix data template MIN & MAX (claymen) - resolved.
- 0000005: [feature] Enterprise Vault Templates (claymen) - resolved.
So basically, much cleaner and added support for alternate namespaces. Better input methods which means adding features later on is easier. A bunch of new templates and of course the security updates. And also added the good ol readme.txt and help info when you run wmi.php without arguments.
One thing to keep in mind with this, although backwards compatibility was added you still need to change your credential reference to a path to the credential file. Basically you no longer need wmi-logins.php instead you specify the path to the credential file as per Samba actually... But for reference it is included in the readme and of course below for you.
Code: Select all
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)
So give it a go and if there are any issues please log tickets on the bug tracker so that I can follow them up Ideally there won't be any and I can mark this as the final 0.0.6 release.
- Attachments
-
- CactiWMI-0.0.6-RC1.zip
- (168.92 KiB) Downloaded 278 times
Hello,
I couldn't make any previous versions to work, so I just downloaded latest one claymen posted and I'm having this in my cacti log with debug on:
I couldn't make any previous versions to work, so I just downloaded latest one claymen posted and I'm having this in my cacti log with debug on:
And this if I run it from the command line (wmi.php debug level set to 1):CMDPHP: Poller[0] Host[8] DS[37] CMD: /usr/bin/php -q /var/www/html/scripts/wmi.php -h '10.32.1.110' -u '/etc/cacti/wmi.pw' -w 'Win32_LogicalDisk' -n '' -k 'DeviceID' -v 'C:' -c 'Size,FreeSpace', output: U
CMDPHP: Poller[0] Host[8] DS[37] WARNING: Result from CMD not valid. Partial Result: U
My Hostinfo:[root@localhost ~]# /usr/bin/php -q /var/www/html/plugins/wmi/wmic
--namespace='root\CIMV2' --authentication-file=/etc/cacti/wmi.pw
//10.32.1.110 "SELECT Size,FreeSpace, FROM Win32_LogicalDisk WHERE
DeviceID='C:'"
PHP Warning: Unexpected character in input: ' (ASCII=8) state=1 in
/var/www/html/plugins/wmi/wmic on line 31387
Warning: Unexpected character in input: ' (ASCII=8) state=1 in
/var/www/html/plugins/wmi/wmic on line 31387
PHP Parse error: syntax error, unexpected ':' in
/var/www/html/plugins/wmi/wmic on line 31387
Parse error: syntax error, unexpected ':' in
/var/www/html/plugins/wmi/wmic on line 31387
Thank you for any help!Cacti Version - 0.8.7c
Plugin Architecture - 2.2
Poller Type - CMD.php
Server Info - Linux 2.6.9-78.0.13.plus.c4smp
Web Server - Apache/2.0.63 (CentOS)
PHP - 5.1.6
PHP Extensions - libxml, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, standard, SimpleXML, sockets, SPL, shmop, session, Reflection, pspell, posix, mime_magic, iconv, hash, gmp, gettext, ftp, exif, date, curl, ctype, calendar, bz2, zlib, pcre, openssl, apache2handler, gd, ldap, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, snmp, eAccelerator
MySQL - 5.0.68
RRDTool - 1.2.23
SNMP - 5.1.2
Plugins
- Global Plugin Settings (settings - v0.5)
Large Site Performane Booster for Cacti (boost - v2.2)
Device Monitoring (monitor - v0.8.2)
Network Discovery (discovery - v0.8.5)
Network Tools (tools - v0.3)
Syslog Monitoring (syslog - v0.5.2)
Device Tracking (mactrack - v1.1)
Login Page Mod (loginmod - v1.0)
Update Checker (update - v0.4)
FlowView (flowview - v0.6)
Host Info (hostinfo - v0.2)
Error Images (errorimage - v0.1)
PHP Network Weathermap (weathermap - v0.95b)
docs
Cacti-ReportIt (reportit - v0.6.1)
Router Configs (routerconfigs - v0.1)
WMI Query (wmi - v0.1)
Realtime for Cacti (realtime - v0.35)
Hmm, I think it's working now. I downloaded wmic from this post (http://forums.cacti.net/about29392.html), replaced the one that was already on the system, and it's working now. Claymen, thank you very much for great plugin!
Who is online
Users browsing this forum: No registered users and 1 guest