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

XML to PRTG sensor

Votes:

0

Hi, I have a problem. I'm trying to get results from XML file and display them in PRTG as one sensor with multiple channels. My XML file have following format:

<?xml version="1.0" encoding="UTF-8" standalone="true"?> -<RESPONSE VERSION="L100"> <COMP P="1" G="0"/> -<OBJECT format="rows" oid="1" name="controller-statistics" basetype="controller-statistics"> <PROPERTY name="durable-id" type="string">controller_1</PROPERTY> <PROPERTY name="cpu-load" type="uint32">6</PROPERTY> <PROPERTY name="write-cache-used" type="uint32">25</PROPERTY> <PROPERTY name="bytes-per-second" type="string" units="MB">35.2MB</PROPERTY> <PROPERTY name="iops" type="uint32">346</PROPERTY> </OBJECT>

<COMP P="2" G="0"/> -<OBJECT format="rows" oid="2" name="controller-statistics" basetype="controller-statistics"> <PROPERTY name="durable-id" type="string">controller_B</PROPERTY> <PROPERTY name="cpu-load" type="uint32">6</PROPERTY> <PROPERTY name="power-on-time" type="uint32">7981121</PROPERTY> <PROPERTY name="write-cache-used" type="uint32">24</PROPERTY> <PROPERTY name="bytes-per-second" type="string" units="KB">3687.4KB</PROPERTY> <PROPERTY name="iops" type="uint32">171</PROPERTY> </OBJECT>

<COMP P="3" G="0"/> -<OBJECT oid="3" name="status" basetype="status"> <PROPERTY name="response-type" type="string">Success</PROPERTY> <PROPERTY name="return-code" type="sint32">0</PROPERTY> <PROPERTY name="component-id" type="string"/> <PROPERTY name="time-stamp" type="string">2013-09-05 23:47:06</PROPERTY> </OBJECT> </RESPONSE>

I would like to create 3 sensors: 1st: will collect durable-id, cpu-load, write-cache-used, bytes-per-second, iops from Object OID1 2nd: will collect durable-id, cpu-load, write-cache-used, bytes-per-second, iops from Object OID1 3rd: will collect response-type from Object OID3

XML file is dynamic and its replaced every 60 sec and values on those PROPERTIES are changing.

I found some articles but so far I was unable to figure this out. As I'm pretty busy on daily basis I don't have time to spend much more time on this.

Can someone please help me?

Regards, Pawel

dynamic powershell prtg script xml

Created on Sep 5, 2013 11:12:02 PM



9 Replies

Votes:

0

Pawel,

To have PRTG read XML and put it into a sensor, you would need to program some sort of executable that would output this XML as a result of running it. The XML would need to be in a format like

    <prtg>
            <result>
            <channel>First channel</channel>
            <value>10</value>
            </result>
            <result>
            <channel>Second channel</channel>
            <value>20</value>
            </result>
     </prtg>

And there are other variables that you can use as well which can be found in the API documentation under Setup.

For what you are trying to get above, it would need to look something like

<prtg>
<result>
<channel>durable-id</channel> 
<value>controller_1</value>
</result>
<result>
<channel>cpu-load</channel> 
<value>6</value>
</result>
<result>
<channel>write-cache-used</channel> 
<value>25</value>
</result>
</prtg>

Created on Sep 10, 2013 8:53:08 AM by  Greg Campion [Paessler Support]



Votes:

0

Ok, I used one of the scripts and output I get is:

<prtg>

<result>

<channel>it In</channel>

<value>9</value>

</result>

<result>

<channel>it Out</channel>

<value>0</value>

</result>

<result>

<channel>data In</channel>

<value>0</value>

</result>

<result>

<channel>data Out</channel>

<value>0</value>

</result>

</prtg>

On PRTG I receive following error: Error reading response: missing /prtg

Created on Sep 13, 2013 11:10:10 AM



Votes:

0

Is this the output from running the script directly or is this an xml file that is output? Have you tried testing this with Powershell x86? PRTG only uses the 32 bit version of PS when running commands.

Created on Sep 13, 2013 11:54:47 AM by  Greg Campion [Paessler Support]



Votes:

0

This is output from running the script directly. I tested on x86 and it works fine.

Created on Sep 13, 2013 12:52:56 PM



Votes:

0

It is from running script directly and it works on Powershell x86

Created on Sep 13, 2013 1:05:07 PM



Votes:

0

Are you using the EXE/Script advanced type sensor? The normal EXE / XML will not work with this type of output.

Created on Sep 13, 2013 1:08:53 PM by  Greg Campion [Paessler Support]

Last change on Sep 13, 2013 1:09:06 PM by  Greg Campion [Paessler Support]



Votes:

0

Yes I use EXE/Script advanced with additional parameter (which I also use on powershell).

Created on Sep 13, 2013 2:02:45 PM



Votes:

0

Can you send me the script along with your logs to [email protected]?

There is an option to upload the logs to our FTP-Server, using the button "Send Logs to Paessler..." on the tab "Logs" in the "PRTG Server Administrator" tool (see Windows start menu).

Please find detailed instructions in our knowledge base: https://www.paessler.com/knowledgebase/en/topic/7983

If you want to manually collect log files in order to send them via email, you will find the log files within the data directory as defined under the "Core Server" tab of the "PRTG Server Administrator" tool, or in the following default paths:

XP/2003: C:\Documents and Settings\All Users\Application Data\Paessler\PRTG Network Monitor\Logs (System)

Vista/2008/Windows 7: C:\ProgramData\Paessler\PRTG Network Monitor\Logs (System)

Please be aware that it might also be an additional folder named 'V7' or 'V8' in which the "Logs (System)" folder resides.

Created on Sep 16, 2013 9:17:57 AM by  Greg Campion [Paessler Support]



Votes:

0

Logs has been sent. I received error messages but I also received confirmation from your website that file was sent (Tickets: PAE346306 & PAE346307). If logs are incomplete please let me know and I will manually send it.

Created on Sep 16, 2013 9:25:05 PM




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.