diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-01-27 08:27:39 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-01-27 08:27:39 +0300 |
commit | 673bea74d2beb8d4260355f928499230c7ff9b17 (patch) | |
tree | 4b5474b9623f0b6f5a8dbdde48f1dc906fdd322e /accel-pppd/radius/radius.c | |
parent | 7f8d3e240fe9544b22846ea05b09515922d1de57 (diff) | |
download | accel-ppp-673bea74d2beb8d4260355f928499230c7ff9b17.tar.gz accel-ppp-673bea74d2beb8d4260355f928499230c7ff9b17.zip |
radius: extended statistics calculation
Diffstat (limited to 'accel-pppd/radius/radius.c')
-rw-r--r-- | accel-pppd/radius/radius.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index f371598a..b50b5257 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -56,6 +56,21 @@ unsigned long stat_acct_lost; unsigned long stat_interim_sent; unsigned long stat_interim_lost; +struct stat_accm_t *stat_auth_lost_1m; +struct stat_accm_t *stat_auth_lost_5m; +struct stat_accm_t *stat_auth_query_1m; +struct stat_accm_t *stat_auth_query_5m; + +struct stat_accm_t *stat_acct_lost_1m; +struct stat_accm_t *stat_acct_lost_5m; +struct stat_accm_t *stat_acct_query_1m; +struct stat_accm_t *stat_acct_query_5m; + +struct stat_accm_t *stat_interim_lost_1m; +struct stat_accm_t *stat_interim_lost_5m; +struct stat_accm_t *stat_interim_query_1m; +struct stat_accm_t *stat_interim_query_5m; + static LIST_HEAD(sessions); static pthread_rwlock_t sessions_lock = PTHREAD_RWLOCK_INITIALIZER; @@ -360,11 +375,23 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt, { cli_send(client, "radius:\r\n"); cli_sendv(client, " auth sent: %lu\r\n", stat_auth_sent); - cli_sendv(client, " auth lost: %lu\r\n", stat_auth_lost); + cli_sendv(client, " auth lost(total/5m/1m): %lu/%lu/%lu\r\n", + stat_auth_lost, stat_accm_get_cnt(stat_auth_lost_5m), stat_accm_get_cnt(stat_auth_lost_1m)); + cli_sendv(client, " auth avg query time(5m/1m): %lu/%lu ms\n", + stat_accm_get_avg(stat_auth_query_5m), stat_accm_get_avg(stat_auth_query_1m)); + cli_sendv(client, " acct sent: %lu\r\n", stat_acct_sent); - cli_sendv(client, " acct lost: %lu\r\n", stat_acct_lost); + cli_sendv(client, " acct lost(total/5m/1m): %lu/%lu/%lu\r\n", + stat_acct_lost, stat_accm_get_cnt(stat_acct_lost_5m), stat_accm_get_cnt(stat_acct_lost_1m)); + cli_sendv(client, " acct avg query time(5m/1m): %lu/%lu ms\n", + stat_accm_get_avg(stat_acct_query_5m), stat_accm_get_avg(stat_acct_query_1m)); + cli_sendv(client, " interim sent: %lu\r\n", stat_interim_sent); - cli_sendv(client, " interim lost: %lu\r\n", stat_interim_lost); + cli_sendv(client, " interim lost(total/5m/1m): %lu/%lu/%lu\r\n", + stat_interim_lost, stat_accm_get_cnt(stat_interim_lost_5m), stat_accm_get_cnt(stat_interim_lost_1m)); + cli_sendv(client, " interim avg query time(5m/1m): %lu/%lu ms\n", + stat_accm_get_avg(stat_interim_query_5m), stat_accm_get_avg(stat_interim_query_1m)); + return CLI_CMD_OK; } @@ -535,4 +562,20 @@ static void __init radius_init(void) triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); cli_register_simple_cmd2(show_stat_exec, NULL, 2, "show", "stat"); + + stat_auth_lost_1m = stat_accm_create(60); + stat_auth_lost_5m = stat_accm_create(5 * 60); + stat_auth_query_1m = stat_accm_create(60); + stat_auth_query_5m = stat_accm_create(5 * 60); + + stat_acct_lost_1m = stat_accm_create(60); + stat_acct_lost_5m = stat_accm_create(5 * 60); + stat_acct_query_1m = stat_accm_create(60); + stat_acct_query_5m = stat_accm_create(5 * 60); + + stat_interim_lost_1m = stat_accm_create(60); + stat_interim_lost_5m = stat_accm_create(5 * 60); + stat_interim_query_1m = stat_accm_create(60); + stat_interim_query_5m = stat_accm_create(5 * 60); } + |