Hi team,

I have created a powershell script that will create the following XML file:

<prtg>
   <result>
      <channel>Total Points</channel>
      <value> 43140 </value>
   </result>
   <result>
      <channel>Members</channel>
      <value> 49 </value>
   </result>
   <result>
      <channel> AfgPijnGiver.XL </channel>
      <value> 5140 </value>
   </result>
   <result> 
      <channel> Jeroen </channel>
      <value> 5019 </value>
   </result>
   <result>
      <channel> Floris I </channel>
      <value> 4976 </value>
   </result>
   <result>
      <channel> ~Dr@gonEyez~ </channel>
      <value> 4954 </value> 
   </result>
</prtg>

It works. But the default unit name for the points is # and I would like to have it changed to "Points". Is there a XML line I can add per result where I can define the unit name?


Article Comments

Yes, that's possible.
You have to include <CustomUnit>My Unit</CustomUnit> within each <result>, your script's output has to look like the following:

<prtg>
   <result>
      <channel>Total Points</channel>
      <value> 43140 </value>
      <CustomUnit>Points</CustomUnit>
   </result>
   <result>
      <channel>Members</channel>
      <value> 49 </value>
      <CustomUnit>Points</CustomUnit>
   </result>
   <result>
      <channel> AfgPijnGiver.XL </channel>
      <value> 5140 </value>
      <CustomUnit>Points</CustomUnit>
   </result>
   <result> 
      <channel> Jeroen </channel>
      <value> 5019 </value>
      <CustomUnit>Points</CustomUnit>
   </result>
   <result>
      <channel> Floris I </channel>
      <value> 4976 </value>
      <CustomUnit>Points</CustomUnit>
   </result>
   <result>
      <channel> ~Dr@gonEyez~ </channel>
      <value> 4954 </value> 
      <CustomUnit>Points</CustomUnit>
   </result>
</prtg>

PRTG's API for Custom Sensors is further documented within PRTG under Setup > PRTG API on the Custom Sensors tab.

Note: The values defined with this element will be considered only on the first sensor scan, when the channel is newly created; they are ignored on all further sensor scans (and may be omitted). If you need to you can change this initial setting in the Channel's settings of the sensor later.

Note2: Your "Total Points" don't appear to add up, the sum of all channels is 20138 whilst your total channel outputs 43140.


Feb, 2016 - Permalink

That work. Thanks :)


Feb, 2016 - Permalink