Ternary Thresholds

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

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