What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Can I monitor DirtyBitSet via WMI with PRTG?

Votes:

0

Hi, can you please extend the "WMI: Laufwerkskapazität (mehrere Laufwerke)" with the information "DirtyBitSet" from "Win32_LogicalDisk"?

custom-sensor drive win32-logicaldisk wmi wql

Created on Dec 14, 2010 11:53:02 AM

Last change on Dec 14, 2010 1:27:56 PM by  Daniel Zobel [Product Manager]



Best Answer

Accepted Answer

Votes:

1

First of all, Although "PRTG WMI Tester" parses a query with multiple lines just fine, a query in resulting .wql file, seems, should be a one-liner: SELECT DeviceID FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=True doesn't work. SELECT DeviceID FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=True works.

Here's a Custom WMI String Sensor (.wql file) for one particular logical drive (#PH1 drive letter is set in sensor settings): SELECT VolumeDirty FROM Win32_LogicalDisk WHERE DeviceID="<#PH1>" With value 'True' set in settings as not desired/error.

I'd love to get an Overall sensor for multiple drives at once, but it's not possible using WQL-only: there's no COUNT or CASE THEN True ELSE False END in WQL language.

Here's my PowerShell 'Custom EXE' script for overall system status: Param([string] $Hostname='localhost') $Query = Get-WmiObject -ComputerName $Hostname -Query "SELECT DeviceID,VolumeDirty FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=true" | measure write-host $Query.count:OK It returns a counter of dirty drives, and values above 0 limit should be treated as errors.

Unlike WQL, PowerShell is run directly on probe device, so a parameter %host should be set in sensor settings.

Created on Mar 19, 2018 7:25:39 AM

Last change on Mar 19, 2018 7:25:39 AM



5 Replies

Votes:

0

We assume you would like to monitor the VolumeDirty counter which indicates whether Windows suggests to run chkdsk.

Please use a WMI Custom sensor with your own WQL query.

Please find more details about the Win32_LogicalDisk Class here: http://msdn.microsoft.com/en-us/library/aa394173%28v=VS.85%29.aspx

Created on Dec 14, 2010 1:27:19 PM by  Daniel Zobel [Product Manager]



Votes:

0

Then, I must generate a new sensor for every drive on every server. o-o

Created on Dec 14, 2010 1:56:40 PM



Votes:

0

To easily add a specific WMI Custom sensor to you existing devices, you can follow these steps:

  1. On a new device, create the new WMI Custom sensor.
  2. Create a Device Template. This template now only contains your WMI Custom sensor.
  3. Show a device list (menu Devices | Device List) with all of your devices you want to add this sensor to and use multi-edit to change these devices' settings all at once: In the Sensor Management section, select Automatic sensor creation using specific device template(s) and select the device template you created above. Save your settings.
  4. Back in the device tree, right-click your devices, or the group they are part of, and select Run Auto-Discovery from the context menu. During this process, the new sensor will be added to each device.

Created on Dec 16, 2010 3:17:31 PM by  Daniel Zobel [Product Manager]



Accepted Answer

Votes:

1

First of all, Although "PRTG WMI Tester" parses a query with multiple lines just fine, a query in resulting .wql file, seems, should be a one-liner: SELECT DeviceID FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=True doesn't work. SELECT DeviceID FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=True works.

Here's a Custom WMI String Sensor (.wql file) for one particular logical drive (#PH1 drive letter is set in sensor settings): SELECT VolumeDirty FROM Win32_LogicalDisk WHERE DeviceID="<#PH1>" With value 'True' set in settings as not desired/error.

I'd love to get an Overall sensor for multiple drives at once, but it's not possible using WQL-only: there's no COUNT or CASE THEN True ELSE False END in WQL language.

Here's my PowerShell 'Custom EXE' script for overall system status: Param([string] $Hostname='localhost') $Query = Get-WmiObject -ComputerName $Hostname -Query "SELECT DeviceID,VolumeDirty FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=true" | measure write-host $Query.count:OK It returns a counter of dirty drives, and values above 0 limit should be treated as errors.

Unlike WQL, PowerShell is run directly on probe device, so a parameter %host should be set in sensor settings.

Created on Mar 19, 2018 7:25:39 AM

Last change on Mar 19, 2018 7:25:39 AM



Votes:

0

Unlike WQL (WMI Custom String sensor), PowerShell is run directly on the probe device, so a parameter %host should be set in the sensor settings. Here's the PowerShell 'Custom EXE' script for overall remote system status:

Param([string] $Hostname='localhost') $Query = Get-WmiObject -ComputerName $Hostname -Query "SELECT DeviceID,VolumeDirty FROM Win32_LogicalDisk WHERE DriveType=3 and VolumeDirty=true" | measure write-host $Query.count:OK It returns a counter of dirty drives, and values above 0 limit should be treated as errors.

Created on Mar 19, 2018 3:43:40 PM

Last change on Mar 19, 2018 3:43:40 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.