This article is a work in progress
deb package for the Linux WMI client (wmic) for Ubuntu 10.10 can be downloaded here.
We use this utility together with collectd, it’s Exec plug-in and rrdgraph.
For example with this script we read the Transactions performance counter for MS SQL Server:
#!/bin/bash INTERVAL="${COLLECTD_INTERVAL:-60}" while sleep "$INTERVAL" do TRANSPS=$((wmic -U user%password //server "SELECT TransactionsPersec FROM Win32_PerfRawData_MSSQLSERVER_SQLServerDatabases WHERE Name='_Total'" | grep "_Total" | awk -F "|" '{ print $2; }') 2>/dev/null); if [ $? -ne 0 ] then TRANSPS="U" fi echo "PUTVAL sqlserver/exec-mssql-wmi/operations interval=$INTERVAL N:$TRANSPS" done
Note what the rrd file name (in this case operations) should start from the defined word in types.db