wmiqd-stats
The wmiqd-stats.pl script is designed to capture the output of a 'getstats' command from a wmi query daemon. This will allow us to track various metrics from the QD at a customer site, and may be useful from a troubleshooting standpoint in helping determine where WMI problems are occurring.
The script will also create all of the tests it pushes via EDF, with the appropriate command line switches. This is expected to be run via cron (or windows scheduled tasks) every 5 minutes.
Typical crontab entry (using the new gcron/vixiecron style) :
*/5 * * * * /usr/local/traverse/plugin/monitors/wmiqd-stats.pl --devicename="Traverse Server" --deviceaddress 127.0.0.1 --wmiserver 192.168.10.116 --edf
This crontab will run the script every 5 minutes, pulling stats from the wmiqd at 192.168.10.116, and placing them into Traverse under the device "Traverse Server".
Command line help :
usage: wmiqd-stats.pl [--edfserver=<fqdn|ip] [--edfport=<port>]
                       [--edfuser=<userid>] [--edfpassword=<password>]
                       [--wmiserver=<fqdn|ip>] [--wmiport=<port>]
                       [--wmiuser=<userid>] [--wmipassword=<password>]
                       [--devicename=<name>] [--deviceaddress=<fqdn|ip>]
                       [--edf ] [--log=<logfile>] [--createtests ]
                       [ --help ] [--debug]

 --devicename    WMIQD fqdn in Traverse (devices tab)
 --deviceaddress WMIQD ip address in Traverse (devices tab)

 --edf           Use EDF to store Data
 --log           File to store getstats entries into (old getstats.pl behavior)
                 Can be used in conjunction with --edf

 --createtests   Create tests in Traverse (requires BVE API, uses the
                 edfserver,port,user and pass parameters if provided)

 --help          print this help message
 --debug         provide extra debugging information
When using --createtests, you will need to place the credentials, server port, and server IP address in the corresponding --edf<n> parameters.
Additionally, you can use --log to store the output in a log, for offline analysis.
The script requires the Traverse PERL Api, and should work on any functional Traverse installation. Install to plugin/utils/.
Tests that the script updates :
WMIQD:currentQueryCount - Deprecated, and no longer tracked. This is (waitingquerycount+busythreads).
WMIQD:waitingQueryCount - # of Queries waiting to be processed
WMIQD:totalProcessedQueries - Total # of queries processed. Tracked as a delta in Traverse. (This should equal cacheHits+cacheMiss ?)
WMIQD:numberOfTimedOutQueries - Total # of Timed out Queries. Tracked as a delta in Traverse.
WMIQD:numberOfErrQueries - Total # of Err Queries. Tracked as a delta in Traverse.
WMIQD:avgGetProcessTime - Time in ms to ??
WMIQD:avgQueryProcessTime - Average time in ms to get a query result back from a target.
WMIQD:avgConnTime - Average time in ms to establish a WMI connection to a target.
WMIQD:cacheHits - Total # of cached results returned. Tracked as a Delta in Traverse.
WMIQD:cacheMiss - Total # of results returned not from cache. Tracked as a Delta in Traverse
WMIQD:connectedHosts - # of Hosts with a good connection state.
WMIQD:failedHosts - # of Hosts with a failed connection state.
WMIQD:jobsWaitingPerThread - Average # of jobs waiting per thread. 
WMIQD:jobsWaitingPerThreadMax - Maximum # of jobs on any individual thread.
WMIQD:freeThreads - # of threads idle.
WMIQD:busyThreads - # of threads busy.
 
1.	Usage Examples:
 
To Create tests on device (device 2 master) in this example (the second example utilizes a superuser/admin user account):
 
wmiqd-stats.pl --createtests --devicename "device 2 master" --deviceaddress 127.0.0.1 --edfserver "127.0.0.1" --edfuser zyrion --edfpassword zyrion

wmiqd-stats.pl --createtests --devicename "device 2 master" --deviceaddress 127.0.0.1 --edfserver "127.0.0.1" --edfuser superuser --edfpassword zyrion --username=zyrion
2.	To execute the script manually once so that data is populated to the configured tests:
To populate tests (assuming defaults for most parameters)
 
wmiqd-stats.pl --devicename "device 2 master" --deviceaddress 127.0.0.1  --edf --edfserver=127.0.0.1 --wmiserver=127.0.0.1
3.	To create a Windows scheduled task, use the xml attachment (make appropriate changes, especially to the command line arguments. In this example, the tests run every 10 minutes (PT10M)

scheduled task
 
schtasks /create /ru SYSTEM /tn "Traverse WMI Query Daemon Stats" /xml sch_qd.xml

