Show module statistics using radmin

Himanshu Pandey pandey_himanshu80 at
Tue Sep 30 09:51:56 CEST 2014


To show my module statistics using radmin I referred command.c and radmin.c and added my new command 
"show module statistics <module>".

 brief you, I added an usigned array of module return codes in 
module_instance_t structure and updated the array in call_modsingle() 
function using the statement: 

modsingle *sp;
sp->modinst->rtcode[result] = sp->modinst->rtcode[result] + 1; 

I tested this and it is giving 100% correct results.

 I have written a function static int 
command_show_module_statistics(rad_listen_t *listener, int argc, char 
*argv[]) in command.c file. I have used radius methods & structures 
only in this function, so guide me which is correct/wrong or what else 
radius methods or structures should be used. The problem is that correct
 module statistics are not being diplayed rather it is displaying 0 
statistics for all modules.Please help me resolve this. Here goes the 
function code:

static int command_show_module_statistics(rad_listen_t *listener, int argc, char *argv[])
 int i;
 module_instance_t const *mi;

 if (argc != 1) {
 cprintf(listener, "ERROR: No module name was given\n");
 return 0;

 cs = cf_section_find("modules");
 if (!cs) return 0;

 mi = find_module_instance(cs, argv[0], false);
 if (!mi) {
 cprintf(listener, "ERROR: No such module \"%s\"\n", argv[0]);
 return 0;

 for (i = 0; i < RLM_MODULE_NUMCODES; i++) {
 cprintf(listener, "\nRTCODE[%d]=%ld\n",i,mi->rtcode[i]);

 return 1; /* success */

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Freeradius-Devel mailing list