]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Added timeout statistics for home servers
authorAlan T. DeKok <aland@freeradius.org>
Sat, 5 May 2012 14:43:48 +0000 (16:43 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 6 May 2012 13:37:29 +0000 (15:37 +0200)
src/main/command.c
src/main/process.c
src/main/stats.c

index 0a8798c9a91a21a3caa20e3bf874039b028587d6..1d6bc766e7cb442077ccf95d60c1c62d1c86c21a 100644 (file)
@@ -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 */
 
index 353d4587cbe4ea4f18184e80a8bd1c6fb4f0da12..6bf654daf92ac5945047ad6fb5889c4a3a48a124 100644 (file)
@@ -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
                 */
index 255850f4b696050432866189b9d5c9d595829b2b..82b54252140e2c31b45b5b7cbd64c9d02f387b48 100644 (file)
@@ -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;