Changeset fe3d821d356a8a6397a0ef63e64ccceee5d2430d
- Timestamp:
- 08/02/09 12:36:39
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1249216599 +0000
- git-parent:
[9cbcc9756c0f6df2e69296bfd4069ffa4ed5c42d]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1249216599 +0000
- Message:
first whack at custom threshold. refs #159
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1c53591 |
rfe3d821 |
|
| 111 | 111 | struct check_info *data; |
|---|
| 112 | 112 | double avail, min = MAXFLOAT, max = 0.0, avg = 0.0, cnt; |
|---|
| | 113 | int avail_needed = 100; |
|---|
| | 114 | const char *config_val = NULL; |
|---|
| 113 | 115 | int i, points = 0; |
|---|
| 114 | 116 | char human_buffer[256]; |
|---|
| … | … | |
| 135 | 137 | avg /= (float)points; |
|---|
| 136 | 138 | |
|---|
| | 139 | if(noit_hash_retr_str(check->config, "avail_needed", strlen("avail_needed"), |
|---|
| | 140 | &config_val)) |
|---|
| | 141 | avail_needed = atoi(config_val); |
|---|
| | 142 | |
|---|
| 137 | 143 | snprintf(human_buffer, sizeof(human_buffer), |
|---|
| 138 | 144 | "cnt=%d,avail=%0.0f,min=%0.4f,max=%0.4f,avg=%0.4f", |
|---|
| … | … | |
| 144 | 150 | current.duration = duration.tv_sec * 1000 + duration.tv_usec / 1000; |
|---|
| 145 | 151 | current.available = (avail > 0.0) ? NP_AVAILABLE : NP_UNAVAILABLE; |
|---|
| 146 | | current.state = (avail < 1.0) ? NP_BAD : NP_GOOD; |
|---|
| | 152 | current.state = (avail < ((float)avail_needed / 100.0)) ? NP_BAD : NP_GOOD; |
|---|
| 147 | 153 | current.status = human_buffer; |
|---|
| 148 | 154 | noit_stats_set_metric(¤t, "count", |
|---|
| rb289e27 |
rfe3d821 |
|
| 15 | 15 | default="5" |
|---|
| 16 | 16 | allowed="\d+">The number of ICMP requests to send during a single check.</parameter> |
|---|
| | 17 | <parameter name="avail_needed" |
|---|
| | 18 | required="optional" |
|---|
| | 19 | default="100" |
|---|
| | 20 | allowed="\d+">The percentage of ICMP available required for the check to be considered "good." By default, 100% of the ICMP requests must have responses for a good state.</parameter> |
|---|
| 17 | 21 | </checkconfig> |
|---|
| 18 | 22 | <examples> |
|---|