diff options
author | Jim Jagielski <jim@apache.org> | 2012-09-24 22:51:00 +0200 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2012-09-24 22:51:00 +0200 |
commit | 25b64e92ed6886b2a5a831d6a8856d878e7bd827 (patch) | |
tree | 616eb372b16059d353849668aadaf0e92806c69d /modules/metadata | |
parent | Break out loadavg from Apache load.... one is quick, the other (diff) | |
download | apache2-25b64e92ed6886b2a5a831d6a8856d878e7bd827.tar.xz apache2-25b64e92ed6886b2a5a831d6a8856d878e7bd827.zip |
Allow for exposure of loadavg and server load via mod_headers
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389565 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/metadata')
-rw-r--r-- | modules/metadata/mod_headers.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index d3a155569a..229535c732 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -220,6 +220,27 @@ static const char *header_request_ssl_var(request_rec *r, char *name) } } +static const char *header_request_loadavg(request_rec *r, char *a) +{ + ap_loadavg_t t; + ap_get_loadavg(&t); + return apr_psprintf(r->pool, "l=%.2f", t.loadavg); +} + +static const char *header_request_idle(request_rec *r, char *a) +{ + ap_sload_t t; + ap_get_sload(&t); + return apr_psprintf(r->pool, "i=%d", t.idle); +} + +static const char *header_request_busy(request_rec *r, char *a) +{ + ap_sload_t t; + ap_get_sload(&t); + return apr_psprintf(r->pool, "b=%d", t.busy); +} + /* * Config routines */ @@ -905,6 +926,9 @@ static int header_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) register_format_tag_handler("t", header_request_time); register_format_tag_handler("e", header_request_env_var); register_format_tag_handler("s", header_request_ssl_var); + register_format_tag_handler("l", header_request_loadavg); + register_format_tag_handler("i", header_request_idle); + register_format_tag_handler("b", header_request_busy); return OK; } |