Hello,

I have an advanced ssh sensor that reads in all filesystems and checks if they are readonly. however if a new filesystem is added I need to adjust the thresholds manually which defeats the entire purpose of making the sensor generic. Is there an option in the XML to set a threshhold for upper limit since anything that is not 0 should give an error? Right now I just create a new channel for each filesystem and output 0 or 1. then I need to go to edit channel> enable limits > enter 0 in the upper limit. Can this be avoided and make a fully automatic sensor?

my xml output looks like this at the moment:

<prtg>
     <result>
          <channel>FS: /</channel>
          <value>0</value>
     </result>
     <result>
           <channel>FS: /u01</channel>
           <value>0</value>
     </result>
     <result>
            <channel>FS: /u02</channel>
            <value>0</value>
     </result>
     <result>
            <channel>FS: /u03</channel>
            <value>0</value>
      </result>
      <result>
            <channel>FS: /u04</channel>
            <value>0</value>
      </result>
      <result>
             <channel>FS: /u05</channel>
             <value>0</value>
      </result>
      <result>
             <channel>FS: /u06</channel>
             <value>0</value>
      </result>
</prtg>

Article Comments

Channel limits are only applied during sensor creation, not at runtime. Any limit changes have to be done via API.

In general, this works like changing properties of any other object. To set channel properties via the API, you need to provide the ID of a sensor (parameter id), a subtype which is channel for channels, and a subid which is the ID of the channel you want to edit. For example /api/setobjectproperty.htm?id=2970&subid=0&subtype=channel&name=limitmaxerror&value=25 ...sets the upper error limit of a channel with the ID 0 of a sensor with the ID 2970 to the value 25.


Mar, 2017 - Permalink

But could this be done automatic? the API is great to make this change as easy as possible but right now it's more of an issue of not knowing when a new channel wil be added so I can't check the sensor every day to see if something new is there.


Mar, 2017 - Permalink

Well, you could call this for each channel within a sensor: <prtg hostname>/editsettings?id=<sensor-id>&limitmode_<channel-id>=1

The limits itself can be simply updated by putting them in the channel output:

<prtg>
    <result>
        <channel>Test</channel>
        <value>122</value>
    </result>
    <result>
        <channel>Test 2</channel>
        <value>13</value>
    </result>
    <result>
        <channel>Test Limits</channel>
        <value>13</value>
        <LimitMinError>15</LimitMinError>
    </result>
</prtg>

The channels can be retrieved via /api/table.xml?content=channels&output=xml&columns=name,lastvalue_,id&id=2272&noraw=1&usecaption=true

You'll have to count them, though since they lack channel IDs. They start at 2 for custom sensors :)


Mar, 2017 - Permalink