Commit d84d6b8b authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: added config param monitor.workers

parent 9661e373
......@@ -40,6 +40,7 @@
#include <math.h>
#include <unistd.h>
#include <pwd.h>
#include <stdbool.h>
#include "trackrdrd.h"
#include "libvarnish.h"
......@@ -152,6 +153,24 @@ CONF_Add(const char *lval, const char *rval)
return(0);
}
if (strcmp(lval, "monitor.workers") == 0) {
if (strcasecmp(rval, "true") == 0
|| strcasecmp(rval, "on") == 0
|| strcasecmp(rval, "yes") == 0
|| strcmp(rval, "1") == 0) {
config.monitor_workers = true;
return(0);
}
if (strcasecmp(rval, "false") == 0
|| strcasecmp(rval, "off") == 0
|| strcasecmp(rval, "no") == 0
|| strcmp(rval, "0") == 0) {
config.monitor_workers = false;
return(0);
}
return(EINVAL);
}
return EINVAL;
}
......@@ -190,6 +209,7 @@ CONF_Init(void)
config.varnish_bindump[0] = '\0';
config.syslog_facility = LOG_LOCAL0;
config.monitor_interval = 30;
config.monitor_workers = false;
config.processor_log[0] = '\0';
config.maxopen_scale = 0;
config.maxdata_scale = 0;
......@@ -270,6 +290,7 @@ CONF_Dump(void)
confdump("varnish.bindump = %s", config.varnish_bindump);
confdump("syslog.facility = %s", config.syslog_facility_name);
confdump("monitor.interval = %.1f", config.monitor_interval);
confdump("monitor.workers = %s", config.monitor_workers ? "true" : "false");
confdump("processor.log = %s", config.processor_log);
confdump("maxopen.scale = %d", config.maxopen_scale);
confdump("maxdata.scale = %d", config.maxdata_scale);
......
......@@ -78,6 +78,7 @@ void
tbl.len_overflows, tbl.data_overflows, tbl.occ_hi, tbl.seen,
tbl.submitted, tbl.nodata, tbl.sent, tbl.failed, tbl.wait_qfull,
tbl.data_hi);
if (config.monitor_workers)
WRK_Stats();
}
......
......@@ -22,7 +22,7 @@ CMD="../trackrdrd -D -f varnish.binlog -l - -d -c test.conf"
# the user running it
CKSUM=$( $CMD | sed -e 's/\(initializing\) \(.*\)/\1/' | sed -e 's/\(Running as\) \([a-zA-Z0-9]*\)$/\1/' | grep -v 'Not running as root' | cksum)
if [ "$CKSUM" != '2398306240 232246' ]; then
if [ "$CKSUM" != '718198351 232285' ]; then
echo "ERROR: Regression test incorrect cksum: $CKSUM"
exit 1
fi
......
......@@ -152,6 +152,7 @@ struct config {
int syslog_facility;
char syslog_facility_name[BUFSIZ];
double monitor_interval;
bool monitor_workers;
char processor_log[BUFSIZ];
unsigned maxopen_scale;
unsigned maxdata_scale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment