Difference between revisions of "Ternary Thresholds"

From Zenoss Wiki
Jump to: navigation, search
(How to make a conditional threshold.)
Line 15: Line 15:
 
here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9<br /><br />
 
here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9<br /><br />
 
(Thanks Zack Salinas for the example and help with this.)
 
(Thanks Zack Salinas for the example and help with this.)
 +
[[Category:Tips]]

Revision as of 18:07, 25 November 2014

How to make a conditional threshold.

Thresholds can use ternary expressions. Here is an example how to implement.

I've had customers mention before that the default 90% usage threshold starts losing importance as the filesystem size gets bigger. So for a 100G file system, you'd probably want to know when there are only 10Gigs left ... but on a 1 or 2 TB drive it would probably make more sense to back the threshold off to something like 98%. A ternary expression as the max value for the threshold in the filesystem template handles this pretty well, so you can modify the default 'Max' value in the threshold from:

here.getTotalBlocks() * .9

To something like this, substituting the total byte size where you'd like the threshold to bump up to 95% for 'SIZE_HERE' below:

here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9

(Thanks Zack Salinas for the example and help with this.)