What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How can I include and exclude sensors from device templates?

Votes:

0

Your Vote:

Up

Down

I want to include and exclude sensors from an existing device template. How can I do that?

device-template filter prtg

Created on Dec 14, 2020 11:20:18 AM by  Florian Weik [Paessler Support]



2 Replies

Accepted Answer

Votes:

1

Your Vote:

Up

Down

This article applies as of PRTG 21

Include and exclude filters for device templates

You can use filters to define which sensors are added if you apply a device template in PRTG. You can include or exclude specific column names to filter the sensors.

Instructions

1. Find out what filters you can use

1.1 Create a device template

First, you must create a new device template. For details, see PRTG Manual: Create Device Template.

1.2 Find and open the device template

You can find the device templates in the \devicetemplates subfolder of the PRTG program directory.

Open the device template with a text editor and find the section that looks like this: <!-- Available column names for filtering: "id" "name" "volume" "comment" "supportsalignment" --> You can filter for one or more of the column names.

2. How to use filters

Enter the column names between the include or exclude tags that you can find below Available column names for filtering.

2.1 Filter rule format

Filter rules are based on the following format:

columnname[value]

Here are some examples of what a filter can look like:
volume[mysql_l0]
measurement[CPU]
64bit[1]

Important: The displayed value may differ from the internal value you have to use for the filter. At the moment you have to use a workaround. Follow the steps below to find out which value you have to use:

  • Follow steps 1.1 and 1.2
  • Enter none between the include tags and any between the exclude tags
  • Save and close the device template
  • Apply the device template in PRTG
  • Navigate to the \Logs\debug subfolder of the PRTG data directory. Find the default path below. %programdata%\Paessler\PRTG Network Monitor\Logs\debug
  • Open CoreAutoDiscovery.log
  • Search for the name of the device template you have applied. The line that you are looking for looks like this: Template Assigned; Device ID: 2661; Name: device_template_name
  • Below the corresponding line, you can find the internal values that the sensor provides. The lines you are looking for look like this, for example: Row 32 ["45:Sonicwall X1","(045) Sonicwall X1 Traffic",1,"1 GBit/s",117,1,"Sonicwall X1"] removed by filter

For comparison, the corresponding meta-scan section of the SNMP Traffic sensor: SNMP Traffic Sensor Meta Scan
Click to enlarge.

You can see that the displayed values differ from the internal values. See the table below to understand the pattern:

Column nameDisplayed valueInternal value
ID45:Sonicwall X145:Sonicwall X1
Name(045) Sonicwall X1 Traffic(045) Sonicwall X1 Traffic
StatusConnected1
Speed1 GBit/s1 GBit/s
TypeGigabit Ethernet117
64bitYes1
Internal nameSonicwall X1Sonicwall X1

Note: To filter column names that contain Yes, No, True, or False as value, always use the internal values 1 or 0.

2.2 Supported logical operators

You can use the logical operators AND, OR, AND NOT, and NOT.

2.3 Supported operational modes

You can use different optional modes. You can enter modes in the following format: columnname[value,mode]

The following modes are supported:

2.3.1 String modes:

  • substring: This mode filters for a specific substring (default)
  • exact: This mode enforces an exact match of a value

For example, to filter for any results with a name that contains the sequence SonicWall, use the filter name[SonicWall,substring].

2.3.2 Number modes: These interpret and compare values as numbers. They only support integer values without extra characters and without thousands separators. They also support hex format.

  • equal
  • greater
  • greaterorequal
  • less
  • lesslessorequal

For example, to filter for any result with the priority 1 or higher, use the filter priority[1,greaterorequal].

Basic example:

A filter can look like the following: <include> any </include> <exclude> name[test] OR name[demo] </exclude>

Advanced example:

Complex expressions can be created using parentheses and AND, OR, AND NOT, or NOT: <include> any </include> <exclude> NOT (name[/vol/vol_mysql_l0/mysql_l0/mysql_l0.lun] AND volume[mysql_l0]) </exclude>

3. Exceptions

3.1 Values with brackets or commas

If you use values with brackets or commas, you have to escape them with quotes:

  • name[Intel[R] 82574L Gigabit Network Connection] --> Leads to error "unknown token 82574L"
  • name["Intel[R] 82574L Gigabit Network Connection"] --> Works as expected

3.2 Values with quotes

If you use values with quotes, you have to escape them and the entire value with quotes:

  • Hello "World" Test --> Leads to an error
  • "Hello ""World"" Test" --> Works as expected

Important: The behavior of the SNMP Traffic sensor is different. For details, see How does auto-discovery with SNMP Traffic sensors work?


Created on Dec 17, 2020 11:25:30 AM by  Florian Weik [Paessler Support]

Last change on Jan 5, 2021 11:53:48 AM by  Florian Weik [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

This is a great improvement to the templates...

One question, for generic / Custom advanced sensors, most of them return

	<!--  Available column names for filtering: -->
	<include>any</include>
	<exclude>none</exclude>

Which indicates that no filtering is available...
Is there a field name for plain sensor name ?

If I create a Custom SNMP Table sensor, and want to apply that to a group of devices.
It may create hundreds of sensors...
I'm only interested in the ones with "fan" or "psu" in the sensor name.
What would the syntax be ?
Something like:

<include>sensorname[fan] OR sensorname[psu]</include>

Or all except "Power Sensor" and

<exlude>sensorname[Power Sensor] OR sensorname[Voltage Sensor]</exclude>

Also, Is the include/exclude required when you try to include / exclude
Thanks
JR

Created on Feb 24, 2021 9:21:54 PM by  JR Andreassen (0)

Last change on Feb 25, 2021 5:12:42 AM by  Sven Roggenhofer [Paessler Technical Support]



Please log in or register to enter your reply.


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.