Hi,

I've written a script to monitor disk space usage and it displays with a custom unit value of G for gigabytes or T for terabytes, depending on the value pulled. When a disk that was at 500 GB of free space (displayed as "500 G") was cleaned up and changed to 5.5 TB free, the newly displayed value was "5.5 G" despite my script clearly putting a "T" in the custom unit tag. Any way around this? I also have the issue where 5.5 is less space than 500 but that's my own issue to tackle. Thanks for any help.

 <result>
    <channel>Free - jbod6-lv1-p1</channel>
    <float>1</float>
    <unit>custom</unit>
    <customunit>T</customunit>
    <value>5.5</value>
  </result>

Article Comments

Dear Kyle,

the unit type is only evaluated when the channel is created. You cannot change the unit type later via the script (only manually in the channel settings.)

The reason is that channel units are not intended to be changed later as the graph / table later makes no sense when you have old values for a new unit.

You could return the bytes instead, letting the sensor scale, and form a sensor status message using G or T. The sensor status message is not stored, it can contain a string without line breaks, up to 2000 characters long.


Aug, 2017 - Permalink