Changeset 9f90ba9a6093963bea2897ebb7cd4d1509a7ff31
- Timestamp:
- 11/22/11 22:21:26
(1 year ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1322000486 -0500
- git-parent:
[16ce15221b247e2c154c6c14f52a100bbe6e410e]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1322000486 -0500
- Message:
support extended_id for stratcon internal metrics
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rdb7752d |
r9f90ba9 |
|
| 63 | 63 | static char self_stratcon_hostname[256] = "\0"; |
|---|
| 64 | 64 | static struct sockaddr_in self_stratcon_ip; |
|---|
| | 65 | static noit_boolean stratcon_selfcheck_extended_id = true; |
|---|
| 65 | 66 | |
|---|
| 66 | 67 | static struct timeval DEFAULT_NOIT_PERIOD_TV = { 5UL, 0UL }; |
|---|
| … | … | |
| 1132 | 1133 | int klen, n = 0, i; |
|---|
| 1133 | 1134 | char str[1024]; |
|---|
| 1134 | | char uuid_str[UUID_STR_LEN+1]; |
|---|
| | 1135 | char uuid_str[1024], tmp_uuid_str[UUID_STR_LEN+1]; |
|---|
| 1135 | 1136 | struct timeval epoch, diff; |
|---|
| 1136 | 1137 | u_int64_t uptime = 0; |
|---|
| 1137 | | |
|---|
| 1138 | | uuid_unparse_lower(self_stratcon_id, uuid_str); |
|---|
| | 1138 | char ip_str[128]; |
|---|
| | 1139 | |
|---|
| | 1140 | inet_ntop(AF_INET, &self_stratcon_ip.sin_addr, ip_str, |
|---|
| | 1141 | sizeof(ip_str)); |
|---|
| | 1142 | |
|---|
| | 1143 | uuid_str[0] = '\0'; |
|---|
| | 1144 | uuid_unparse_lower(self_stratcon_id, tmp_uuid_str); |
|---|
| | 1145 | if(stratcon_selfcheck_extended_id) { |
|---|
| | 1146 | strlcat(uuid_str, ip_str, sizeof(uuid_str)-37); |
|---|
| | 1147 | strlcat(uuid_str, "`selfcheck`selfcheck`", sizeof(uuid_str)-37); |
|---|
| | 1148 | } |
|---|
| | 1149 | strlcat(uuid_str, tmp_uuid_str, sizeof(uuid_str)); |
|---|
| 1139 | 1150 | |
|---|
| 1140 | 1151 | #define PUSH_BOTH(type, str) do { \ |
|---|
| … | … | |
| 1149 | 1160 | if(closure == NULL) { |
|---|
| 1150 | 1161 | /* Only do this the first time we get called */ |
|---|
| 1151 | | char ip_str[128]; |
|---|
| 1152 | | inet_ntop(AF_INET, &self_stratcon_ip.sin_addr, ip_str, |
|---|
| 1153 | | sizeof(ip_str)); |
|---|
| 1154 | 1162 | snprintf(str, sizeof(str), "C\t%lu.%03lu\t%s\t%s\tstratcon\t%s\n", |
|---|
| 1155 | 1163 | (long unsigned int)now->tv_sec, |
|---|
| … | … | |
| 1627 | 1635 | uuid_parse(uuid_str, self_stratcon_id) == 0) { |
|---|
| 1628 | 1636 | int period; |
|---|
| | 1637 | noit_conf_get_boolean(NULL, "/stratcon/@extended_id", |
|---|
| | 1638 | &stratcon_selfcheck_extended_id); |
|---|
| 1629 | 1639 | /* If a UUID was provided for stratcon itself, we will report metrics |
|---|
| 1630 | 1640 | * on a large variety of things (including all noits). |
|---|