Difference between revisions of "Ternary Thresholds"

From Zenoss Wiki
Jump to: navigation, search
(Created page with "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% usag...")
 
Line 1: Line 1:
How to make a conditional threshold.
+
== How to make a conditional threshold. ==
  
 
Thresholds can use ternary expressions. Here is an example how to implement.
 
Thresholds can use ternary expressions. Here is an example how to implement.
 +
<br />
  
 
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:
 
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:
 +
<br />
  
 
here.getTotalBlocks() * .9
 
here.getTotalBlocks() * .9
 +
<br />
  
 
To something like this, substituting the total byte size where you'd like the threshold to bump up to 95% for 'SIZE_HERE' below:
 
To something like this, substituting the total byte size where you'd like the threshold to bump up to 95% for 'SIZE_HERE' below:
 +
<br />
  
here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9
+
here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9<br />
 
(Thanks Zack Salinas for the example and help with this.)
 
(Thanks Zack Salinas for the example and help with this.)

Revision as of 16:34, 30 October 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.)