Changeset 646e6d20498ab1b500fe30137a5541534219618b
- Timestamp:
- 02/19/08 02:40:41
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1203388841 +0000
- git-parent:
[b7510b4e0ce386e83beddeb468cdc1f35f16f7e2]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1203388841 +0000
- Message:
change the availability stuff to be characters
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r6e90b3f |
r646e6d2 |
|
| 153 | 153 | char human_buffer[256], code[4], rt[14]; |
|---|
| 154 | 154 | |
|---|
| 155 | | memset(¤t, 0, sizeof(current)); |
|---|
| | 155 | noit_check_stats_clear(¤t); |
|---|
| 156 | 156 | |
|---|
| 157 | 157 | if(noit_hash_retrieve(check->config, "code", strlen("code"), |
|---|
| … | … | |
| 193 | 193 | stats_t current; |
|---|
| 194 | 194 | |
|---|
| 195 | | memset(¤t, 0, sizeof(current)); |
|---|
| | 195 | noit_check_stats_clear(¤t); |
|---|
| 196 | 196 | current.available = NP_UNAVAILABLE; |
|---|
| 197 | 197 | current.state = NP_BAD; |
|---|
| … | … | |
| 247 | 247 | xmlXPathObjectPtr pobj = NULL; |
|---|
| 248 | 248 | |
|---|
| 249 | | memset(¤t, 0, sizeof(current)); |
|---|
| | 249 | noit_check_stats_clear(¤t); |
|---|
| 250 | 250 | |
|---|
| 251 | 251 | if(ci->body.b) resmon_results = xmlParseMemory(ci->body.b, ci->body.l); |
|---|
| r6e90b3f |
r646e6d2 |
|
| 82 | 82 | struct timeval duration; |
|---|
| 83 | 83 | |
|---|
| 84 | | memset(¤t, 0, sizeof(current)); |
|---|
| | 84 | noit_check_stats_clear(¤t); |
|---|
| 85 | 85 | |
|---|
| 86 | 86 | data = (struct check_info *)check->closure; |
|---|
| re781d1e |
r646e6d2 |
|
| 471 | 471 | } |
|---|
| 472 | 472 | |
|---|
| | 473 | void |
|---|
| | 474 | noit_check_stats_clear(stats_t *s) { |
|---|
| | 475 | memset(s, 0, sizeof(*s)); |
|---|
| | 476 | s->state = NP_UNKNOWN; |
|---|
| | 477 | s->available = NP_UNKNOWN; |
|---|
| | 478 | } |
|---|
| 473 | 479 | static void |
|---|
| 474 | 480 | __free_metric(void *vm) { |
|---|
| … | … | |
| 531 | 537 | |
|---|
| 532 | 538 | /* check for state changes */ |
|---|
| 533 | | if(check->stats.current.available != 0 && |
|---|
| 534 | | check->stats.previous.available != 0 && |
|---|
| | 539 | if(check->stats.current.available != NP_UNKNOWN && |
|---|
| | 540 | check->stats.previous.available != NP_UNKNOWN && |
|---|
| 535 | 541 | check->stats.current.available != check->stats.previous.available) |
|---|
| 536 | 542 | report_change = 1; |
|---|
| 537 | | if(check->stats.current.state != 0 && |
|---|
| 538 | | check->stats.previous.state != 0 && |
|---|
| | 543 | if(check->stats.current.state != NP_UNKNOWN && |
|---|
| | 544 | check->stats.previous.state != NP_UNKNOWN && |
|---|
| 539 | 545 | check->stats.current.state != check->stats.previous.state) |
|---|
| 540 | 546 | report_change = 1; |
|---|
| re01b3ad |
r646e6d2 |
|
| 39 | 39 | #define NP_UNCONFIG 0x00000008 |
|---|
| 40 | 40 | |
|---|
| 41 | | #define NP_UNKNOWN 0 /* stats_t.{available,state} */ |
|---|
| 42 | | #define NP_AVAILABLE 1 /* stats_t.available */ |
|---|
| 43 | | #define NP_UNAVAILABLE -1 /* stats_t.available */ |
|---|
| 44 | | #define NP_BAD 1 /* stats_t.state */ |
|---|
| 45 | | #define NP_GOOD 2 /* stats_t.state */ |
|---|
| | 41 | #define NP_UNKNOWN '0' /* stats_t.{available,state} */ |
|---|
| | 42 | #define NP_AVAILABLE 'A' /* stats_t.available */ |
|---|
| | 43 | #define NP_UNAVAILABLE 'U' /* stats_t.available */ |
|---|
| | 44 | #define NP_BAD 'B' /* stats_t.state */ |
|---|
| | 45 | #define NP_GOOD 'G' /* stats_t.state */ |
|---|
| 46 | 46 | |
|---|
| 47 | 47 | typedef struct { |
|---|
| … | … | |
| 57 | 57 | typedef struct { |
|---|
| 58 | 58 | struct timeval whence; |
|---|
| 59 | | int16_t available; |
|---|
| 60 | | int16_t state; |
|---|
| | 59 | int8_t available; |
|---|
| | 60 | int8_t state; |
|---|
| 61 | 61 | u_int32_t duration; |
|---|
| 62 | 62 | char *status; |
|---|
| … | … | |
| 143 | 143 | noit_poller_lookup_by_name(char *target, char *name); |
|---|
| 144 | 144 | |
|---|
| | 145 | API_EXPORT(void) |
|---|
| | 146 | noit_check_stats_clear(stats_t *s); |
|---|
| | 147 | |
|---|
| 145 | 148 | struct _noit_module; |
|---|
| 146 | 149 | API_EXPORT(void) |
|---|