|
Lines 532-537
static int apache_read_host(user_data_t *user_data) /* {{{ */
Link Here
|
| 532 |
|
532 |
|
| 533 |
ptr = st->apache_buffer; |
533 |
ptr = st->apache_buffer; |
| 534 |
saveptr = NULL; |
534 |
saveptr = NULL; |
|
|
535 |
int apache_connections = 0, apache_idle_workers = 0; |
| 535 |
while ((line = strtok_r(ptr, "\n\r", &saveptr)) != NULL) { |
536 |
while ((line = strtok_r(ptr, "\n\r", &saveptr)) != NULL) { |
| 536 |
ptr = NULL; |
537 |
ptr = NULL; |
| 537 |
fields_num = strsplit(line, fields, STATIC_ARRAY_SIZE(fields)); |
538 |
fields_num = strsplit(line, fields, STATIC_ARRAY_SIZE(fields)); |
|
Lines 546-557
static int apache_read_host(user_data_t *user_data) /* {{{ */
Link Here
|
| 546 |
} else if (fields_num == 2) { |
547 |
} else if (fields_num == 2) { |
| 547 |
if (strcmp(fields[0], "Scoreboard:") == 0) |
548 |
if (strcmp(fields[0], "Scoreboard:") == 0) |
| 548 |
submit_scoreboard(fields[1], st); |
549 |
submit_scoreboard(fields[1], st); |
| 549 |
else if ((strcmp(fields[0], "BusyServers:") == 0) /* Apache 1.* */ |
550 |
else if (!apache_connections |
| 550 |
|| (strcmp(fields[0], "BusyWorkers:") == 0) /* Apache 2.* */) |
551 |
&& ((strcmp(fields[0], "BusyServers:") == 0) /* Apache 1.* */ |
|
|
552 |
|| (strcmp(fields[0], "BusyWorkers:") == 0)) /* Apache 2.* */) { |
| 551 |
submit_gauge("apache_connections", NULL, atol(fields[1]), st); |
553 |
submit_gauge("apache_connections", NULL, atol(fields[1]), st); |
| 552 |
else if ((strcmp(fields[0], "IdleServers:") == 0) /* Apache 1.x */ |
554 |
apache_connections++; |
| 553 |
|| (strcmp(fields[0], "IdleWorkers:") == 0) /* Apache 2.x */) |
555 |
} else if (!apache_idle_workers |
|
|
556 |
&& ((strcmp(fields[0], "IdleServers:") == 0) /* Apache 1.x */ |
| 557 |
|| (strcmp(fields[0], "IdleWorkers:") == 0)) /* Apache 2.x */) { |
| 554 |
submit_gauge("apache_idle_workers", NULL, atol(fields[1]), st); |
558 |
submit_gauge("apache_idle_workers", NULL, atol(fields[1]), st); |
|
|
559 |
apache_idle_workers++; |
| 560 |
} |
| 555 |
} |
561 |
} |
| 556 |
} |
562 |
} |
| 557 |
|
563 |
|