1 # -*- coding: utf-8 -*-
2 # Description: tomcat netdata python.d module
3 # Author: Pawel Krupa (paulfantom)
5 from base import UrlService
8 # default module values (can be overridden per job in `config`)
13 # charts order (can be overridden if you want less charts, or different order)
14 ORDER = ['accesses', 'volume', 'threads', 'jvm']
18 'options': [None, "Requests", "requests/s", "statistics", "tomcat.accesses", "area"],
20 ["requestCount", 'accesses', 'incremental']
23 'options': [None, "Volume", "KB/s", "volume", "tomcat.volume", "area"],
25 ["bytesSent", 'volume', 'incremental', 1, 1024]
28 'options': [None, "Threads", "current threads", "statistics", "tomcat.threads", "line"],
30 ["currentThreadCount", 'current', "absolute"],
31 ["currentThreadsBusy", 'busy', "absolute"]
34 'options': [None, "JVM Free Memory", "MB", "statistics", "tomcat.jvm", "area"],
36 ["free", None, "absolute", 1, 1048576]
41 class Service(UrlService):
42 def __init__(self, configuration=None, name=None):
43 UrlService.__init__(self, configuration=configuration, name=name)
44 self.url = self.configuration.get('url', "http://127.0.0.1:8080/manager/status?XML=true")
46 self.definitions = CHARTS
47 self.regex = compile(r'([\w]+)=\\?[\'\"](\d+)\\?[\'\"]')
50 if not self.url.endswith('manager/status?XML=true'):
51 self.error('Bad url(%s). Must be http://<ip.address>:<port>/manager/status?XML=true' % self.url)
54 return UrlService.check(self)
58 Format data received from http request
61 data = self._get_raw_data()
62 if data: data = dict(self.regex.findall(data))