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

How do I properly configure a WMI custom sensor?

Votes:

0

I need to monitor WMI counters that are not covered by the built-in WMI sensors set of PRTG. So I have written a few custom WQL scripts to be executed by PRTG. Are there any rules I should follow to set up custom WMI sensors?

custom-sensor help prtg wmi wmi-custom-sensor wql

Created on Feb 2, 2010 1:06:52 PM by  Dirk Paessler [Founder Paessler AG] (11,025) 3 6

Last change on Jan 4, 2022 8:34:37 AM by  Frank Hadasch [Paessler Support] (0) 1



1 Reply

Accepted Answer

Votes:

0

This article applies as of PRTG 22

How to add your own WQL queries using WMI Custom sensors

Use Windows Management Instrumentation (WMI) to monitor counters that are not included in the standard set of WMI sensors in PRTG. To do so, add your own WMI WQL queries using the WMI Custom sensor or the WMI Custom String sensor.

Relevant settings for custom WMI sensors

  • Namespace: Enter the namespace in which your WMI classes are located, beginning with root, for example, root\CIMV2.
  • WQL File: Select the WQL script files on the probe system. After sensor creation, this field is read-only.
  • Placeholders: Customize your WQL scripts with up to three placeholders that are replaced with the values you enter in the sensor settings (see below).

Basic requirements

Create a .wql file and store it in the \Custom Sensors\WMI WQL scripts subfolder of the PRTG program directory on the respective probe system. The path is usually C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\WMI WQL scripts.

Enter a WQL query with one field returning a numeric value for the WMI Custom sensor. If your query returns a string value, use the WMI Custom String sensor. Multiple fields and multiple result rows are not supported.

Example

SELECT Buildnumber FROM Win32_OperatingSystem

You can customize this query by using a placeholder system. This allows you to reuse the script for more sensors by entering different values in the sensor’s settings.

For example, myProcess.wql contains this query:

SELECT <#PH1> FROM Win32_Process WHERE Description='<#PH2>'

Now you can add one sensor that monitors the thread count of the probe by specifying ThreadCount and PRTG Probe.exe in the <#PH1> and <#PH2> setting fields.

Or you could monitor the working set size of Outlook via <#PH1> = WorkingSetSize and <#PH2> = OUTLOOK.exe.

Alternatively, if you want the number of entries in the result set to be returned to a direct value from a field, you can use the SELECT COUNT(*) statement.

Example SELECT COUNT(*) FROM Win32_Process WHERE Name='explorer.exe'

Note: Using an unrestricted query might result in a timeout error.

More

Created on Feb 2, 2010 1:08:24 PM by  Dirk Paessler [Founder Paessler AG] (11,025) 3 6

Last change on Jan 2, 2023 2:17:06 PM by  Brandy Greger [Paessler Support]




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.