[bind10-dev] How to implement query counters in auth module?

Naoki Kambe kambe at jprs.co.jp
Wed Sep 15 04:07:33 UTC 2010


I committed an example code to the auth module yesterday. Please see also
r2921 in branches/trac191-rebased/src/bin/auth/.

Naoki Kambe

From: Naoki Kambe <kambe at jprs.co.jp>
Subject: [bind10-dev] How to implement query counters in auth module?
Date: Mon, 13 Sep 2010 21:36:56 +0900 (JST)

> Jinmei-san, Evan-san,
> 
> This is a question related to trac #191.  We need to add some
> implements into the auth module in order that the stats module works
> along with the auth module. Because the auth module doesn't either
> seem to have query counters nor throw counters to the stats module. So
> the stats module can't collect query counters from the auth module in
> current source files. I want to know how to implement that. Can you
> give me any suggestions? I think I may add following implements into
> auth_srv.cc and/or some source files in the auth module:
> 
>   Implement:
>     - Received Query counters
>       + They are ones over UDP and TCP.
>       + The variables of counters are shared with several auth
>       	processes(responders).
>     - Throwing the counts toward the stats module periodically
> 
>   An example code:	# This may be wrong or inefficient.
>     // a query counter over UDP
>     static int udp_queries = 0
>     // receives queries and increase counters
>     ...
>     // construct command
>     static string udp_queries_str;
>     sprintf(udp_queries_str, "%d", udp_queries);
>     static string stats_command = "{ \"command\": ["
>        		  	       	+ "  \"increase\","
>        		  	       	+ "   { \"stats_data\": {"
>        		  	       	+ "       \"auth.queries.udp\": " + udp_queries_str
>        		  	       	+ "     }"
>        		  	       	+ "   }"
>        		  	       	+ "  ]"
>        		  	       	+ "}";
>     // throw the count
>     stats_session->group_sendmsg(stats_command, "Stats", "*", "*");
>     // reset counter and return to init
>     udp_queries = 0;
> 
>       ... I think the case of TCP is almost same above.
> 
>   Please refer to the wikipage for details:
>    http://bind10.isc.org/wiki/StatsModule
> 
> Thanks,
> 
> Naoki Kambe
> _______________________________________________
> bind10-dev mailing list
> bind10-dev at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind10-dev
> 



More information about the bind10-dev mailing list