@@ -200,6 +200,7 @@ def gather_metrics(self):
200
200
self .fetch_data ('TCPSummary' , 'tcp' , '_total' )
201
201
self .fetch_data ('LogTargetStatus' , 'logtarget' )
202
202
self .object_counts ()
203
+ self .fetch_document_cache_summary ()
203
204
if self .v5c :
204
205
self .fetch_data ('WSMAgentStatus' , 'wsm' )
205
206
# Needs statistics enabled:
@@ -278,6 +279,46 @@ def object_counts(self):
278
279
logger .info ("Failed to get object count: {} (Check rest-mgmt is enabled and you have network connectivity)" .format (e .strerror ))
279
280
280
281
282
+ def fetch_document_cache_summary (self , suffix = '' ):
283
+ """ fetch data from a status provider """
284
+ if self .v5c :
285
+ provider = "DocumentCachingSummary"
286
+ key = "XMLManager"
287
+ else :
288
+ provider = "APIDocumentCachingSummary"
289
+ key = "APIGateway"
290
+ try :
291
+ logger .debug ("Retrieving cache summary" )
292
+ url = "https://{}:{}/mgmt/status/{}/{}" .format (
293
+ self .ip ,
294
+ self .port ,
295
+ self .domain ,
296
+ provider )
297
+ status = requests .get (url ,
298
+ auth = (self .username , self .password ),
299
+ verify = False , timeout = 1 ).json ()
300
+ logger .debug (status )
301
+ data = status .get (provider , {})
302
+ if type (data ) is not list :
303
+ data = [data ]
304
+
305
+ for item in data :
306
+ try :
307
+ name = item [key ]['value' ]
308
+ if name in ['webapi' , 'webapi-internal' , 'apiconnect' ]:
309
+ del item [key ]
310
+ logger .debug (item )
311
+ for key in item :
312
+ self .trawler .set_gauge (
313
+ 'datapower' ,
314
+ "{}.{}.{}{}" .format ("documentcache" , name , key , suffix ), item [key ],
315
+ pod_name = self .name , labels = self .labels )
316
+ except KeyError :
317
+ logger .warning ('Failed to parse response for document cache summary' )
318
+ logger .info (item )
319
+ except requests .exceptions .RequestException as e :
320
+ logger .info ("{}: {} (Check rest-mgmt is enabled and you have network connectivity)" .format (provider , e .strerror ))
321
+
281
322
282
323
283
324
# https://localhost:5554/mgmt/status/apiconnect/GatewayPeeringStatus
0 commit comments