Modifying on device templates is not officially supported!
But since it can prove useful, here's a little insight of how templates work. This is a template that will:
- Check whenever the device responds to ping
- If it responds to Ping, check whenever the device responds to SNMP (with 23 generic queries)
- If it responds to Ping, check whenever the device can be reached on TCP Port 443.
- If the previous TCP Port 443 check succeeded, it will attempt deploy an SSL Certificate Sensor configured to check port 443. All other settings will be default and the sensor will be named "SSL Certificate Sensor (Port 443)"
- Lastly, if the SNMP check succeeded, it will do a so-called portscan (More info here), and will deploy one SNMP Traffic Sensor for each "available" interface. No name is defined since it will use the "Name Template" from the SNMP Compatibility Options.
<?xml version="1.0" encoding="UTF-8" ?>
<devicetemplate id="custom" name="Custom Template" priority="1">
<check id="ping" meta="ping"/>
<check id="snmp" meta="snmp" requires="ping"/>
<check id="port443" meta="port" requires="ping"/>
<create id="sslcert443" kind="sslcertificate" requires="port443" displayname="SSL Certificate Sensor (Port 443)">
<createdata>
<port>443</port>
</createdata>
</create>
<create id="snmptraffic" kind="snmptraffic" requires="snmp" meta="portscan"/>
</devicetemplate>
To the individual parts of the template
<?xml version="1.0" encoding="UTF-8" ?>
<devicetemplate id="custom" name="Custom Template" priority="1">
Defines the template's ID (custom for custom templates) and the template's name (as displayed in PRTG). The priority defines the precedence of the template and whenever it should be included in the default discovery.
<check id="ping" meta="ping"/>
<check id="snmp" meta="snmp" requires="ping"/>
<check id="port443" meta="port" requires="ping"/>
Check statements are used to validate something. This will be used later to decide which sensors are compatible/should be deployed. The requires="" is used to define a dependency for a check statement. i.e. snmp will only be tested if ping was successful.
<create id="sslcert443" kind="sslcertificate" requires="port443" displayname="SSL Certificate Sensor (Port 443)">
<createdata>
<port>443</port>
</createdata>
</create>
The create statement is used to deploy sensors.
- kind defines the sensor type.
- requires defines the prerequisite (check) that needs to have passed for the sensor to be created.
- displayname defines the sensor's name.
For sensors that require it, the <createdata> is used to pre-configure the sensor's settings. In this case the port used by the sensor is being defined (443).
<create id="snmptraffic" kind="snmptraffic" requires="snmp" meta="portscan"/>
This is a different create statement, what makes it unique is the meta="portscan" - This defines that part the <createdata> required by this sensor is not static but will be obtained dynamically during this sensor's creation using the rules from the portscan. Metascans are used/required when the data monitored by the sensors is dynamic, which prevents the OID's or configurations from being hard-coded as it changes on a per-device basis.
Also important to note is the id= of the create. The id is used to skip a sensor's creation. This means that if a discovery is re-run and there is already an sslcertificate sensor with internal id sslcert443 and same settings, the sensor will not be re-created.
Best Regards,
Luciano Lingnau [Paessler Support]
Add comment