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...")
 
 
(5 intermediate revisions by the same user not shown)
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 />
 +
<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 />
 +
<br />
 +
<syntaxhighlight lang="python">
 
here.getTotalBlocks() * .9
 
here.getTotalBlocks() * .9
 
+
</syntaxhighlight>
 +
<br />
 +
<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 />
 +
<br />
 +
<syntaxhighlight lang="python">
 
here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9
 
here.getTotalBlocks() * .98 if here.totalBytes() > SIZE_HERE else here.getTotalBlocks() * .9
(Thanks Zack Salinas for the example and help with this.)
+
</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