1 # -*- coding: utf-8 -*-
2 # Description: apache cache netdata python.d plugin
3 # Author: Pawel Krupa (paulfantom)
5 from base import LogService
13 'options': [None, 'apache cached responses', 'percent cached', 'cached', 'apache_cache.cache', 'stacked'],
15 ["hit", 'cache', "percentage-of-absolute-row"],
16 ["miss", None, "percentage-of-absolute-row"]
21 class Service(LogService):
22 def __init__(self, configuration=None, name=None):
23 LogService.__init__(self, configuration=configuration, name=name)
24 if len(self.log_path) == 0:
25 self.log_path = "/var/log/httpd/cache.log"
27 self.definitions = CHARTS
29 def _formatted_data(self):
35 raw = self._get_data()
36 except (ValueError, AttributeError):
42 if "cache hit" in line:
44 elif "cache miss" in line:
50 return {'hit': int(hit/float(hit+miss) * 100),
51 'miss': int(miss/float(hit+miss) * 100)}