Difference between revisions of "Ternary Thresholds"
From Zenoss Wiki
(→How to make a conditional threshold.) |
|||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
<br /> | <br /> | ||
<br /> | <br /> | ||
+ | <syntaxhighlight lang="python"> | ||
here.getTotalBlocks() * .9 | here.getTotalBlocks() * .9 | ||
+ | </syntaxhighlight> | ||
<br /> | <br /> | ||
<br /> | <br /> | ||
Line 13: | Line 15: | ||
<br /> | <br /> | ||
<br /> | <br /> | ||
− | here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9<br /><br /> | + | <syntaxhighlight lang="python"> |
− | + | here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9 | |
+ | </syntaxhighlight> | ||
+ | <br /><br /> | ||
+ | [[Category:Tips]] |
Latest revision as of 18:39, 30 December 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