How to get the most out of PRTG auto-discovery
Originally published on April 21, 2021 by Sascha Neumeier
Last updated on April 21, 2021 • 8 minute read
Imagine you plan to add several network switches to your PRTG environment. But you only want to add sensors for interfaces that are connected. Until now, this required some manual effort. Since PRTG 21.1.65, you can now customize the PRTG auto-discovery with filter criteria. This allows you to precisely define in advance which sensors auto-discovery should add, and which it should not.
After reading this article, you will know how to create a device template, add filter criteria to the templates, and then start the auto-discovery feature using these device templates.
Sound heavy? It isn't; just read on!
First of all, let us use an example by picking up our thought from the beginning. Let's assume you have installed a large number of new switches in your network and want to monitor traffic via SNMP.
However, you only want to create sensors in PRTG for interfaces that are connected by cable and that have a speed of 100mbps.
Let's go step by step
First, add the SNMP traffic sensors. By default, each sensor shows all interfaces regardless of whether or not they are connected or their speed. So, we could just manually add the connected interfaces with speeds of more than 100mbps with a few clicks.
But, remember our example: We don't want to add just one device, but hundreds or even thousands. That's why we need to automate the creation of the sensors as much as possible.
To do this, we add just one interface to our device that fulfills our requirements, meaning the interface is connected and has a speed of 100mbps. This creates exactly one sensor in PRTG.
In the next step we create a device template out of this. We give the template a proper name – in our case, "only connected traffic interfaces".
Now we need to add the desired filter criteria to the device template. To do so, open the corresponding template file located in the \devicetemplates subfolder of the PRTG directory.
To find the correct field names for filtering, check the auto-discovery log. You can find this log, called CoreAutoDiscovery.log, in the \logs\debug subfolder of the PRTG data directory.
Just search for the name of the device template you have applied. Below the corresponding line, you can find the internal values that the sensor provides.
Now add the criteria in the <include> area. In our example, we want to add sensors with status and speed["100 MBit/s"], where status 1 means that the interface is connected. Finally, save your file.
Next, go to your device and run "Auto-Discovery with Template". Search for the template, which we called "only connected traffic interfaces" and start the auto-discovery.
Wait a few seconds and see what happens – the auto-discovery only adds sensors for connected interfaces with a speed of 100mbps.
You can watch the full setup of the sensor and the customization of the device template in this tutorial:
But this is just one of many examples for using the new device template filter option in PRTG. If you want to dive deeper, look at our knowledge base article, "How can I include and exclude sensors from device templates?”. This article describes in detail what the filters look like, what options you have and where you can find the mentioned files.
Well, that's basically everything you need to filter sensors in PRTG using the new device template filter mechanism.
If this tutorial was helpful for you, give Johannes some fame ❤️ and like his video or subscribe to our Youtube channel.
I promise this will not be the last tutorial where we show you pro-tips on how to use PRTG. For the sake of completeness, here are a few links that are good to keep in your bookmarks:
If you have questions, just ask us! In the comments section, in the Youtube video comments or simply drop us an email at firstname.lastname@example.org...we're happy to help!