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

Custom sensor PS

Votes:

0

Hi,

I created a custom DNS sensor for SRV Queries. I tried my query in PS and it worked, but when I put it in PRTG I have error about structural error in XML file, but I think that XML file is correct.

My code is

$Node = Resolve-DnsName xxxxxx -Type SRV | Format-List | findstr NameTarget <prtg>

$value = $Node.split(':')[1]

$xml_txt = "<prtg> <result> <channel>DnsName</channel> <value>+$value+</value> </result> </prtg>"

Write-Host $xml_txt </prtg>

custom-sensor dns powershell

Created on Jun 4, 2019 7:51:20 AM



14 Replies

Votes:

0

The last line is wrong - you need to omit </prtg>, otherwise, it's duplicated :)

Created on Jun 4, 2019 8:11:51 AM by  Stephan Linke [Paessler Support]



Votes:

0

You're right, the last </prtg> is duplicated. I deleted it, but I still have the same error

Created on Jun 4, 2019 8:17:51 AM



Votes:

0

Hm - Try the following:

<code> $xml_txt = "<prtg><result><channel>DnsName</channel><value>$($value)</value></result></prtg>" If that doesn't work, please check if step #1 of our Guide For PowerShell based Custom Sensors is fulfilled.

Created on Jun 4, 2019 8:45:55 AM by  Stephan Linke [Paessler Support]



Votes:

0

Execution Policy is unrestricted. Still doesn't work

Created on Jun 4, 2019 9:08:22 AM



Votes:

0

Okay. Please enable the write result to disk option in the Sensor settings and send us the Sensor logs to [email protected], referring to that thread. The logs reside in PRTGs data directory. Thanks in advance!

Created on Jun 4, 2019 9:21:07 AM by  Stephan Linke [Paessler Support]



Votes:

0

Mind if I ask what the actual value is, e.g. what the actual $value is here when executing it manually?

Created on Jun 5, 2019 7:35:27 AM by  Stephan Linke [Paessler Support]



Votes:

0

Here, $value is the result of SRV query (I need only the first part, so I splitted it)

Created on Jun 5, 2019 10:33:51 AM



Votes:

0

And what would that be, for example?


PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Jun 5, 2019 10:46:44 AM by  Stephan Linke [Paessler Support]



Votes:

0

I had to use it for some DNS for Skype for Business. So I had to resolve with an SRV query _sip._tls.domain.eu and the result contained in $value is access1.domain.eu

The sensor should check the result; if there is something different from access1.domain.eu, it must go down

Created on Jun 5, 2019 10:51:05 AM



Votes:

0

Note that the content of t he <value> XML node must be numerical, as PRTG can't evaluate strings. Can you modify your script accordingly (e.g. 0 for ok and 1 for an error) and provide me with an example XML output afterwards?


PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Jun 5, 2019 11:39:16 AM by  Stephan Linke [Paessler Support]



Votes:

0

I don't manage to do this easily I think I have to change too much

Created on Jun 5, 2019 2:20:51 PM



Votes:

0

Okay - let us know if any assistance is required with that :)

Created on Jun 6, 2019 6:59:10 AM by  Stephan Linke [Paessler Support]



Votes:

0

Is it possible to add SRV option in your DNS sensor ? Maybe in future updates

Created on Jun 6, 2019 7:04:10 AM



Votes:

0

You could put a feature request into the knowledge base (like outlined here) and provide all necessary info about what specifically you'd like to monitor. If other people find that useful, they'd vote for it and we can implement it, given that there is a demand for it :)

Created on Jun 7, 2019 8:29:25 AM by  Stephan Linke [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.