New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

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

Free PRTG
Download >>

 

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

 

Top Tags


View all Tags


Custom sensor PS

Votes:

0

Your Vote:

Up

Down

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 by  SteveDSC (3) 1



14 Replies

Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  SteveDSC (3) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

Execution Policy is unrestricted. Still doesn't work

Created on Jun 4, 2019 9:08:22 AM by  SteveDSC (3) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  SteveDSC (3) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  SteveDSC (3) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  SteveDSC (3) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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

Created on Jun 6, 2019 7:04:10 AM by  SteveDSC (3) 1



Votes:

0

Your Vote:

Up

Down

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]



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.