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


Article Comments

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>

Sep, 2013 - Permalink

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


Sep, 2013 - Permalink

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.


Sep, 2013 - Permalink

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


Sep, 2013 - Permalink

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


Sep, 2013 - Permalink

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


Sep, 2013 - Permalink

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


Sep, 2013 - Permalink

Can you send me the script along with your logs to support@paessler.com?

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.


Sep, 2013 - Permalink

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.


Sep, 2013 - Permalink