From: Alan T. DeKok Date: Sat, 5 May 2012 14:43:48 +0000 (+0200) Subject: Added timeout statistics for home servers X-Git-Tag: release_3_0_0_beta0~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=079bd9a5a3f37c2ed8dfdedf8a5c3afe0da644b3;p=thirdparty%2Ffreeradius-server.git Added timeout statistics for home servers --- diff --git a/src/main/command.c b/src/main/command.c index 0a8798c9a91..1d6bc766e7c 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -1573,7 +1573,7 @@ static const char *elapsed_names[8] = { #endif static int command_print_stats(rad_listen_t *listener, fr_stats_t *stats, - int auth) + int auth, int server) { int i; @@ -1596,6 +1596,10 @@ static int command_print_stats(rad_listen_t *listener, fr_stats_t *stats, cprintf(listener, "\tdropped\t\t" PU "\n", stats->total_packets_dropped); cprintf(listener, "\tunknown_types\t" PU "\n", stats->total_unknown_types); + if (server) { + cprintf(listener, "\ttimeouts\t" PU "\n", stats->total_timeouts); + } + cprintf(listener, "\tlast_packet\t%lu\n", stats->last_packet); for (i = 0; i < 8; i++) { cprintf(listener, "\telapsed.%s\t%u\n", @@ -1687,12 +1691,12 @@ static int command_stats_home_server(rad_listen_t *listener, int argc, char *arg #ifdef WITH_ACCOUNTING if (strcmp(argv[0], "acct") == 0) { return command_print_stats(listener, - &proxy_acct_stats, 0); + &proxy_acct_stats, 0, 1); } #endif if (strcmp(argv[0], "auth") == 0) { return command_print_stats(listener, - &proxy_auth_stats, 1); + &proxy_auth_stats, 1, 1); } cprintf(listener, "ERROR: Should specify [auth/acct]\n"); @@ -1705,7 +1709,7 @@ static int command_stats_home_server(rad_listen_t *listener, int argc, char *arg } command_print_stats(listener, &home->stats, - (home->type == HOME_TYPE_AUTH)); + (home->type == HOME_TYPE_AUTH), 1); cprintf(listener, "\toutstanding\t%d\n", home->currently_outstanding); return 1; } @@ -1789,13 +1793,13 @@ static int command_stats_client(rad_listen_t *listener, int argc, char *argv[]) #ifdef WITH_ACCOUNTING if (!auth) { return command_print_stats(listener, - &radius_acct_stats, auth); + &radius_acct_stats, auth, 0); } #endif - return command_print_stats(listener, &radius_auth_stats, auth); + return command_print_stats(listener, &radius_auth_stats, auth, 0); } - return command_print_stats(listener, stats, auth); + return command_print_stats(listener, stats, auth, 0); } @@ -1811,7 +1815,7 @@ static int command_stats_socket(rad_listen_t *listener, int argc, char *argv[]) if (sock->type != RAD_LISTEN_AUTH) auth = FALSE; - return command_print_stats(listener, &sock->stats, auth); + return command_print_stats(listener, &sock->stats, auth, 0); } #endif /* WITH_STATS */ diff --git a/src/main/process.c b/src/main/process.c index 353d4587cbe..6bf654daf92 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -2829,6 +2829,18 @@ STATE_MACHINE_DECL(proxy_wait_for_reply) return; } + FR_STATS_TYPE_INC(home->stats.total_timeouts); + if (home->type == HOME_TYPE_AUTH) { + FR_STATS_TYPE_INC(request->proxy_listener->stats.total_timeouts); + FR_STATS_TYPE_INC(proxy_auth_stats.total_timeouts); + } +#ifdef WITH_ACCT + else if (home->rtype == HOME_TYPE_ACCT) { + FR_STATS_TYPE_INC(request->proxy_listener->stats.total_timeouts); + FR_STATS_TYPE_INC(proxy_acct_stats.total_timeouts); + } +#endif + /* * FIXME: debug log no response to proxied request */ diff --git a/src/main/stats.c b/src/main/stats.c index 255850f4b69..82b54252140 100644 --- a/src/main/stats.c +++ b/src/main/stats.c @@ -38,7 +38,7 @@ RCSID("$Id$") static struct timeval start_time; static struct timeval hup_time; -#define FR_STATS_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ +#define FR_STATS_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ { 0, 0, 0, 0, 0, 0, 0, 0 }} fr_stats_t radius_auth_stats = FR_STATS_INIT;