kohler / click

The Click modular router: fast modular packet processing and analysis
Other
740 stars 321 forks source link

Question about monitoring #361

Closed peterrz closed 7 years ago

peterrz commented 7 years ago

Hi, i'm new at click ,i want monitoring performance, any available element or function ? please guide me.

bcronje commented 7 years ago

Try some of the Counters elements

If you want packets per second, bit rate and packet count type stats use Counter

Counter exposes all those stats via read handlers. You can read them via ControlSocket or proclikefs (if linux module). Or you can use a Script element to print to console. Here is an example using Script:

FromDevice(eth0) -> c1::Counter -> Queue -> ToDevice(eth1);
Script ( 
        printn "c1 Bit Rate ",
        printn c1.bit_rate,
        printn " Count ",
        printn c1.count,
        printn " Bytes ",
        print c1.byte_count,
        wait 2,
        loop
        )
tbarbette commented 7 years ago

I personnaly like AverageCounter that gives you a rate.

Beware of mutli-thread (un)safeness with all of those.

peterrz commented 7 years ago

@bcronje @tbarbette thanks to guide me, i want send information to controller floodlight and also i want dynamic period report. any solutions ? (this dynamic report time should be set on controller )

peterrz commented 7 years ago

how i can debug my code before running on my router ? any debugger available ?

ahenning commented 7 years ago

click_chatter works as a starting point

peterrz commented 7 years ago

@ahenning thank you, Please describe more,

ahenning commented 7 years ago

Look at click_chatter examples in the existing click elements

bcronje commented 7 years ago

As @ahenning said for basic help click_chatter is like printf. If you want full debugger support then just use gdb and run Click in userlevel mode. Personally I use KDevelop as my IDE for Click development and it supports gdb with a nice GUI for debugging.

peterrz commented 7 years ago

@bcronje thanks!