web_log plugin: "all_time" option added for squid
Ilya committed
Jul 23, 2017 at 16:57 UTC
d2b18d35f4341410e918dbce3fd8290956b6220b
1 file changed
+7
-4
python.d/web_log.chart.py
+7
-4
@@ -853,6 +853,8 @@ class Squid(Mixin):
853
'chart': 'squid_mime_type',
854
'func_dim_id': lambda v: v.split('/')[0],
855
'func_dim': None}}
856
+ if not self.conf.get('all_time', True):
857
+ self.order.remove('squid_clients_all')
858
return True
859
860
def get_data(self, raw_data=None):
@@ -883,10 +885,11 @@ class Squid(Mixin):
885
886
proto = 'ipv4' if '.' in match['client_address'] else 'ipv6'
887
# unique clients ips
886
- if address_not_in_pool(pool=self.storage['unique_all_time'],
887
- address=match['client_address'],
888
- pool_size=self.data['unique_tot_ipv4'] + self.data['unique_tot_ipv6']):
889
- self.data['unique_tot_' + proto] += 1
888
+ if self.conf.get('all_time', True):
889
+ if address_not_in_pool(pool=self.storage['unique_all_time'],
890
+ address=match['client_address'],
891
+ pool_size=self.data['unique_tot_ipv4'] + self.data['unique_tot_ipv6']):
892
+ self.data['unique_tot_' + proto] += 1
893
894
if match['client_address'] not in unique_ip:
895
self.data['unique_' + proto] += 1