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>
Article Comments
You're right, the last </prtg> is duplicated. I deleted it, but I still have the same error
Jun, 2019 - Permalink
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.
Jun, 2019 - Permalink
Okay. Please enable the write result to disk option in the Sensor settings and send us the Sensor logs to support@paessler.com, referring to that thread. The logs reside in PRTGs data directory. Thanks in advance!
Jun, 2019 - Permalink
Mind if I ask what the actual value is, e.g. what the actual $value is here when executing it manually?
Jun, 2019 - Permalink
Here, $value is the result of SRV query (I need only the first part, so I splitted it)
Jun, 2019 - Permalink
And what would that be, for example?
PRTGapi |
Feature Requests |
WMI Issues |
SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Jun, 2019 - Permalink
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
Jun, 2019 - Permalink
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
Jun, 2019 - Permalink
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 :)
Jun, 2019 - Permalink
The last line is wrong - you need to omit </prtg>, otherwise, it's duplicated :)
Jun, 2019 - Permalink