Re: Module Statistics in freeradius

Himanshu Pandey pandey_himanshu80 at rediffmail.com
Fri Sep 26 19:50:10 CEST 2014


Dear Alan,

I have gone through different statistics provided by radius server.

But as we discussed, the server does NOT keep track of statistics for each module return codes.

My aim is to achieve this. I want the statistics of each module return code. That is for e.g.,  Module X how many times returned OK or fail or reject etc. Now with this aim in mind I thought to modify the freeradius code:

The very first thing that I did was finding out the basic module structure in freeradius, if I am not wrong this is the basic module structure used:

typedef struct module_t {
        uint64_t         magic;                          //!< Used to validate module struct.
        char const     *name;                          //!< The name of the module (without rlm_ prefix).
        int                 type;                           //!< One or more of the RLM_TYPE_* constants.
        size_t            inst_size;                      //!< Size of the instance data
        CONF_PARSER const     *config;         //!< Configuration information
        instantiate_t    instantiate;                    //!< Function to use for instantiation.
        detach_t         detach;                         //!< Function to use to free module instance.
        packetmethod   methods[RLM_COMPONENT_COUNT];   //!< Pointers to the various section functions,                                                                                                     // ordering !< determines which function is mapped                                                                &!
 nbsp;                                //to!< which section.                             
} module_t;

Now I added an unsigned long array in this structure in which module return code act as an index. Please see the snippet below:

typedef enum module_statistics {
        RLM_MODULE_REJECT = 0, //!< 0 methods index for reject return code.
        RLM_MODULE_FAIL,     //!< 1 methods index for fail return code.
        RLM_MODULE_OK,     //!< 2 methods index for OK return code.
        RLM_MODULE_HANDLED,     //!< 3 methods index for handled return code.
        RLM_MODULE_INVALID,     //!< 4 methods index for invalid return code.
        RLM_MODULE_USERLOCK,//!< 5 methods index for userlock return code.
        RLM_MODULE_NOTFOUND, //!< 6 methods index for notfound return code.
        RLM_MODULE_NOOP,//!< 7 methods index for noop return code.

        RLM_MODULE_UPDATED, //!< 8 methods index for updated return code.
        

        RLM_RETCODE_COUNT     //!< 9 how many module return codes there are.
} module_statistics;

typedef struct module_t {
        uint64_t                magic;                          //!< Used to validate module struct.
        char const              *name;                          //!< The name of the module (without rlm_ prefix).
        int                     type;                           //!< One or more of the RLM_TYPE_* constants.
        size_t                  inst_size;                      //!< Size of the instance data
        CONF_PARSER const       *config;                        //!< Configuration information
        instantiate_t           instantiate;                    //!< Function to use for instantiation.
        detach_t                detach;                         //!< Function to use to free module instance.
        packetmethod         methods[RLM_COMPONENT_COUNT];   //!< Pointers to the various section functions,                                                                  //ordering
                                                                //!< determines which function is mapped to
                                                               //!< which section.    
    unsigned long rtcode[RLM_RETCODE_COUNT];   //Used for module return codes                  

} module_t;
  
Is this approach OK?
Please suggest me. 

Please advice me that how should I update this my unsigned long rtcode[RLM_RETCODE_COUNT] array with each module return code. 

Regards,
Sonu  


From: Alan DeKok <aland at deployingradius.com>
Sent: Thu, 25 Sep 2014 21:47:49 
To: FreeRadius users mailing list <freeradius-users at lists.freeradius.org>
Subject: Re: Module Statistics in freeradius
Himanshu Pandey wrote:

> I am a bit confused right now.



  You keep changing what you're asking for.



  The server already keeps track of total packet counts for

Access-Request, Access-Accept, etc.



  The server does NOT keep track of statistics for module return codes.



  The server already keeps track of total packet counts for clients,

listeners, and home servers.



  The server does NOT keep track of statistics (anything) per module.





> You mean to say that if suppose I want

> the number of authorize request that were OK,UPDATED,FAILED,HANDLED or

> REJECTED to be printed then I can use the radmin. Since the server DOES

> keep track of statistics per listener.  And prints them out.

> 

> Is it correct?



  No.  If you run the "help" command from radmin, you will see what it's

keepings statistics for.  If you run the appropriate statistics command,

you will see which statistics it keeps.



  It's that easy.  You should try it, rather than asking confusion

questions on the list.  All of the answers are ALREADY in front of you.



  Alan DeKok.

-

List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140926/3caea6d7/attachment-0001.html>


More information about the Freeradius-Users mailing list