How can I edit a PRTG device template, to prevent auto-discovery from adding unnecessary Hyper-V network adapter sensors again after I have deleted them?


Disclaimer: This is not an officially supported feature

I have checked with development and there is an unofficial way to provide a list (similar to a response file) with one entry per interface that you want to have a sensor for, to be used with auto-discovery. Please check the following device template for reference:

<?xml version="1.0" encoding="UTF-8"?>
  <devicetemplate id="custom" name="Custom Traffic Createdata" priority="1">
    <check id="ping" meta="ping"/>
    <check id="snmp" meta="snmp" requires="ping"/>
    <create id="snmptraffic_vEthernet" kind="snmptraffic" requires="snmp" displayname="Traffic vEthernet">
      <createdata>
		<interfacenumber>901:vEthernet</interfacenumber>
      </createdata>
    </create>
	<create id="snmptraffic_vSwitch" kind="snmptraffic" requires="snmp" displayname="Traffic vSwitch">
      <createdata>
		<interfacenumber>902:vSwitch</interfacenumber>
      </createdata>
    </create>
  </devicetemplate>

The device template above will always only add two SNMP Traffic Sensors, associated with two distict interfaces named vEthernet and vSwitch. This is only practical if you have hundreds of servers which have interfaces with exactly the same name.


Usage Notes

  • The index (901, 902) should be an interface name that doesn't exist. That causes the sensor's "Interface Index Tracking" logic to kick-in and identify the correct interface index after the first scan.
  • You'll have to use multiple <create> statements, each will contain a different <createdata> with a DIFFERENT id.
  • The <interfacenumber> must contain the name of the interface that the sensor will monitor(exactly as it shows up in the sensor's settings for an existing deployed sensor)
  • This example is designed to work with the Use ifAlias Port Identification option (SNMP Compatibility Options). Adjust as necessary depending on your use case.
  • The sensors within the defined create will ALWAYS be deployed, regardless of there being an interface with the corresponding name.
  • The property provided in the </interfacenumber> should match the defined identification property from the SNMP Compatibility Options.
  • Instead of relying on the static displayname property it is also possible to enable the Automatic sensor name update if name changes in device in the device/group/probe/root settings and have PRTG automatically rename the sensors according to the defined name template.


Related

As of recent recent PRTG versions it is possible to have a "custom meta-scan", which would allow the creation of custom rules within a metascan for interfaces:

Now that you understand how this works, it's time to go one step further and automate this. Please refer to:

Support-related notes

  • Editing templates manually is not officially supported, we can't guarantee this will always work as expected
  • We can't provide Technical Support for this features
  • This feature's behavior may change without prior notice.


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.