mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-06 06:49:35 -05:00
stats_noreset feature for unbound-control
git-svn-id: file:///svn/unbound/trunk@1478 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
e5a5749603
commit
ca09b7014b
9 changed files with 37 additions and 15 deletions
|
|
@ -846,7 +846,7 @@ print_ext(SSL* ssl, struct stats_info* s)
|
||||||
|
|
||||||
/** do the stats command */
|
/** do the stats command */
|
||||||
static void
|
static void
|
||||||
do_stats(SSL* ssl, struct daemon_remote* rc)
|
do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
|
||||||
{
|
{
|
||||||
struct daemon* daemon = rc->worker->daemon;
|
struct daemon* daemon = rc->worker->daemon;
|
||||||
struct stats_info total;
|
struct stats_info total;
|
||||||
|
|
@ -854,7 +854,7 @@ do_stats(SSL* ssl, struct daemon_remote* rc)
|
||||||
int i;
|
int i;
|
||||||
/* gather all thread statistics in one place */
|
/* gather all thread statistics in one place */
|
||||||
for(i=0; i<daemon->num; i++) {
|
for(i=0; i<daemon->num; i++) {
|
||||||
server_stats_obtain(rc->worker, daemon->workers[i], &s);
|
server_stats_obtain(rc->worker, daemon->workers[i], &s, reset);
|
||||||
if(!print_thread_stats(ssl, i, &s))
|
if(!print_thread_stats(ssl, i, &s))
|
||||||
return;
|
return;
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
|
|
@ -1387,8 +1387,11 @@ execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd,
|
||||||
} else if(strncmp(p, "reload", 6) == 0) {
|
} else if(strncmp(p, "reload", 6) == 0) {
|
||||||
do_reload(ssl, rc);
|
do_reload(ssl, rc);
|
||||||
return;
|
return;
|
||||||
|
} else if(strncmp(p, "stats_noreset", 13) == 0) {
|
||||||
|
do_stats(ssl, rc, 0);
|
||||||
|
return;
|
||||||
} else if(strncmp(p, "stats", 5) == 0) {
|
} else if(strncmp(p, "stats", 5) == 0) {
|
||||||
do_stats(ssl, rc);
|
do_stats(ssl, rc, 1);
|
||||||
return;
|
return;
|
||||||
} else if(strncmp(p, "status", 6) == 0) {
|
} else if(strncmp(p, "status", 6) == 0) {
|
||||||
do_status(ssl, worker);
|
do_status(ssl, worker);
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ get_rrset_bogus(struct worker* worker)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
server_stats_compile(struct worker* worker, struct stats_info* s)
|
server_stats_compile(struct worker* worker, struct stats_info* s, int reset)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -143,24 +143,26 @@ server_stats_compile(struct worker* worker, struct stats_info* s)
|
||||||
/* get and reset validator rrset bogus number */
|
/* get and reset validator rrset bogus number */
|
||||||
s->svr.rrset_bogus = get_rrset_bogus(worker);
|
s->svr.rrset_bogus = get_rrset_bogus(worker);
|
||||||
|
|
||||||
if(!worker->env.cfg->stat_cumulative) {
|
if(reset && !worker->env.cfg->stat_cumulative) {
|
||||||
worker_stats_clear(worker);
|
worker_stats_clear(worker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void server_stats_obtain(struct worker* worker, struct worker* who,
|
void server_stats_obtain(struct worker* worker, struct worker* who,
|
||||||
struct stats_info* s)
|
struct stats_info* s, int reset)
|
||||||
{
|
{
|
||||||
uint8_t *reply = NULL;
|
uint8_t *reply = NULL;
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
if(worker == who) {
|
if(worker == who) {
|
||||||
/* just fill it in */
|
/* just fill it in */
|
||||||
server_stats_compile(worker, s);
|
server_stats_compile(worker, s, reset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* communicate over tube */
|
/* communicate over tube */
|
||||||
verbose(VERB_ALGO, "write stats cmd");
|
verbose(VERB_ALGO, "write stats cmd");
|
||||||
worker_send_cmd(who, worker_cmd_stats);
|
if(reset)
|
||||||
|
worker_send_cmd(who, worker_cmd_stats);
|
||||||
|
else worker_send_cmd(who, worker_cmd_stats_noreset);
|
||||||
verbose(VERB_ALGO, "wait for stats reply");
|
verbose(VERB_ALGO, "wait for stats reply");
|
||||||
if(!tube_read_msg(worker->cmd, &reply, &len, 0))
|
if(!tube_read_msg(worker->cmd, &reply, &len, 0))
|
||||||
fatal_exit("failed to read stats over cmd channel");
|
fatal_exit("failed to read stats over cmd channel");
|
||||||
|
|
@ -171,10 +173,10 @@ void server_stats_obtain(struct worker* worker, struct worker* who,
|
||||||
free(reply);
|
free(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
void server_stats_reply(struct worker* worker)
|
void server_stats_reply(struct worker* worker, int reset)
|
||||||
{
|
{
|
||||||
struct stats_info s;
|
struct stats_info s;
|
||||||
server_stats_compile(worker, &s);
|
server_stats_compile(worker, &s, reset);
|
||||||
verbose(VERB_ALGO, "write stats replymsg");
|
verbose(VERB_ALGO, "write stats replymsg");
|
||||||
if(!tube_write_msg(worker->daemon->workers[0]->cmd,
|
if(!tube_write_msg(worker->daemon->workers[0]->cmd,
|
||||||
(uint8_t*)&s, sizeof(s), 0))
|
(uint8_t*)&s, sizeof(s), 0))
|
||||||
|
|
|
||||||
|
|
@ -175,23 +175,29 @@ void server_stats_log(struct server_stats* stats, struct worker* worker,
|
||||||
* @param worker: the worker that is executing (the first worker).
|
* @param worker: the worker that is executing (the first worker).
|
||||||
* @param who: on who to get the statistics info.
|
* @param who: on who to get the statistics info.
|
||||||
* @param s: the stats block to fill in.
|
* @param s: the stats block to fill in.
|
||||||
|
* @param reset: if stats can be reset.
|
||||||
*/
|
*/
|
||||||
void server_stats_obtain(struct worker* worker, struct worker* who,
|
void server_stats_obtain(struct worker* worker, struct worker* who,
|
||||||
struct stats_info* s);
|
struct stats_info* s, int reset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile stats into structure for this thread worker.
|
* Compile stats into structure for this thread worker.
|
||||||
* Also clears the statistics counters (if that is set by config file).
|
* Also clears the statistics counters (if that is set by config file).
|
||||||
* @param worker: the worker to compile stats for, also the executing worker.
|
* @param worker: the worker to compile stats for, also the executing worker.
|
||||||
* @param s: stats block.
|
* @param s: stats block.
|
||||||
|
* @param reset: if true, depending on config stats are reset.
|
||||||
|
* if false, statistics are not reset.
|
||||||
*/
|
*/
|
||||||
void server_stats_compile(struct worker* worker, struct stats_info* s);
|
void server_stats_compile(struct worker* worker, struct stats_info* s,
|
||||||
|
int reset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send stats over comm tube in reply to query cmd
|
* Send stats over comm tube in reply to query cmd
|
||||||
* @param worker: this worker.
|
* @param worker: this worker.
|
||||||
|
* @param reset: if true, depending on config stats are reset.
|
||||||
|
* if false, statistics are not reset.
|
||||||
*/
|
*/
|
||||||
void server_stats_reply(struct worker* worker);
|
void server_stats_reply(struct worker* worker, int reset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addup stat blocks.
|
* Addup stat blocks.
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,11 @@ worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube), uint8_t* msg,
|
||||||
break;
|
break;
|
||||||
case worker_cmd_stats:
|
case worker_cmd_stats:
|
||||||
verbose(VERB_ALGO, "got control cmd stats");
|
verbose(VERB_ALGO, "got control cmd stats");
|
||||||
server_stats_reply(worker);
|
server_stats_reply(worker, 1);
|
||||||
|
break;
|
||||||
|
case worker_cmd_stats_noreset:
|
||||||
|
verbose(VERB_ALGO, "got control cmd stats_noreset");
|
||||||
|
server_stats_reply(worker, 0);
|
||||||
break;
|
break;
|
||||||
case worker_cmd_remote:
|
case worker_cmd_remote:
|
||||||
verbose(VERB_ALGO, "got control cmd remote");
|
verbose(VERB_ALGO, "got control cmd remote");
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ enum worker_commands {
|
||||||
worker_cmd_quit,
|
worker_cmd_quit,
|
||||||
/** obtain statistics */
|
/** obtain statistics */
|
||||||
worker_cmd_stats,
|
worker_cmd_stats,
|
||||||
|
/** obtain statistics without statsclear */
|
||||||
|
worker_cmd_stats_noreset,
|
||||||
/** execute remote control command */
|
/** execute remote control command */
|
||||||
worker_cmd_remote
|
worker_cmd_remote
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
- call setusercontext if available (on BSD).
|
- call setusercontext if available (on BSD).
|
||||||
- small refactor of stats clearing.
|
- small refactor of stats clearing.
|
||||||
- #227: flush_stats feature for unbound-control.
|
- #227: flush_stats feature for unbound-control.
|
||||||
|
- stats_noreset feature for unbound-control.
|
||||||
|
|
||||||
10 February 2009: Wouter
|
10 February 2009: Wouter
|
||||||
- keys with rfc5011 REVOKE flag are skipped and not considered when
|
- keys with rfc5011 REVOKE flag are skipped and not considered when
|
||||||
|
|
|
||||||
1
doc/TODO
1
doc/TODO
|
|
@ -59,7 +59,6 @@ o local-zone directive with authority service, full authority server
|
||||||
o remote control read ssl information while priviledged.
|
o remote control read ssl information while priviledged.
|
||||||
|
|
||||||
o infra and lame cache: easier size config (in Mb), show usage in graphs.
|
o infra and lame cache: easier size config (in Mb), show usage in graphs.
|
||||||
o unbound_control get_stats_noreset
|
|
||||||
o unbound_control forward [addr {addr}] | [off]
|
o unbound_control forward [addr {addr}] | [off]
|
||||||
o config entry to denote that a zone is to be treated as unsigned (even if
|
o config entry to denote that a zone is to be treated as unsigned (even if
|
||||||
a DS exists to higher trust anchor).
|
a DS exists to higher trust anchor).
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,10 @@ Print statistics. Resets the internal counters to zero, this can be
|
||||||
controlled using the \fBstatistics\-cumulative\fR config statement.
|
controlled using the \fBstatistics\-cumulative\fR config statement.
|
||||||
Statistics are printed with one [name]: [value] per line.
|
Statistics are printed with one [name]: [value] per line.
|
||||||
.TP
|
.TP
|
||||||
|
.B stats_noreset
|
||||||
|
Peek at statistics. Prints them like the \fBstats\fR command does, but does not
|
||||||
|
reset the internal counters to zero.
|
||||||
|
.TP
|
||||||
.B status
|
.B status
|
||||||
Display server status. Exit code 3 if not running (the connection to the
|
Display server status. Exit code 3 if not running (the connection to the
|
||||||
port is refused), 1 on error, 0 if running.
|
port is refused), 1 on error, 0 if running.
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ usage()
|
||||||
printf(" stop stops the server\n");
|
printf(" stop stops the server\n");
|
||||||
printf(" reload reloads the server\n");
|
printf(" reload reloads the server\n");
|
||||||
printf(" stats print statistics\n");
|
printf(" stats print statistics\n");
|
||||||
|
printf(" stats_noreset peek at statistics\n");
|
||||||
printf(" status display status of server\n");
|
printf(" status display status of server\n");
|
||||||
printf(" verbosity [number] change logging detail\n");
|
printf(" verbosity [number] change logging detail\n");
|
||||||
printf(" local_zone [name] [type] add new local zone\n");
|
printf(" local_zone [name] [type] add new local zone\n");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue