@@ -191,6 +191,7 @@ def configure_callback(conf):
191191
192192 log_verbose ('Configured with host=%s, port=%s' % (ES_HOST , ES_PORT ))
193193
194+
194195def fetch_url (url ):
195196 try :
196197 result = json .load (urllib2 .urlopen (url , timeout = 10 ))
@@ -208,16 +209,25 @@ def fetch_stats():
208209 version = server_info ['version' ]['number' ]
209210
210211 if StrictVersion (version ) >= StrictVersion ('1.0.0' ):
211- ES_URL = base_url + '_nodes/_local/stats/transport,http,process,jvm,indices,breaker'
212+ ES_URL = base_url + '_nodes/_local/stats/transport,http,process,jvm,indices,breaker,thread_pool '
212213 STATS_CUR = dict (STATS .items () + STATS_ES1X .items ())
213214 if StrictVersion (version ) >= StrictVersion ('1.4.0' ):
214215 STATS_CUR = dict (STATS_CUR .items () + STATS_ES14 .items ())
215216 else :
216217 STATS_CUR = dict (STATS_CUR .items () + STATS_ES13 .items ())
217218 else :
218- ES_URL = base_url + '_cluster/nodes/_local/stats?http=true&process=true&jvm=true&transport=true'
219+ ES_URL = base_url + '_cluster/nodes/_local/stats?http=true&process=true&jvm=true&transport=true&thread_pool=true '
219220 STATS_CUR = dict (STATS .items () + STATS_ES09 .items ())
220221
222+ # add info on thread pools
223+ for pool in ['generic' , 'index' , 'get' , 'snapshot' , 'merge' , 'optimize' , 'bulk' , 'warmer' , 'flush' , 'search' , 'refresh' ]:
224+ for attr in ['threads' , 'queue' , 'active' , 'largest' ]:
225+ path = 'thread_pool.{0}.{1}' .format (pool , attr )
226+ STATS_CUR [path ] = Stat ("gauge" , 'nodes.%s.{0}' .format (path ))
227+ for attr in ['completed' , 'rejected' ]:
228+ path = 'thread_pool.{0}.{1}' .format (pool , attr )
229+ STATS_CUR [path ] = Stat ("counter" , 'nodes.%s.{0}' .format (path ))
230+
221231 result = fetch_url (ES_URL )
222232
223233 ES_CLUSTER = result ['cluster_name' ]
0 commit comments