Show module statistics using radmin

Himanshu Pandey pandey_himanshu80 at rediffmail.com
Tue Sep 30 07:26:08 CEST 2014


Dear Alan,

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

To 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.

Now 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;
 CONF_SECTION *cs;
 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 */
}

Regards,
Sonu








 






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140930/29bf8cac/attachment.html>


More information about the Freeradius-Users mailing list