if os.path.isfile(configfile):
debug(mod.__name__ + ": loading module configuration: '" + configfile + "'")
try:
+ if not hasattr(mod, 'config'):
+ mod.config = {}
setattr(mod,
'config',
self._parse_config(mod, read_config(configfile)))
try:
# get defaults from module source code
defaults[key] = getattr(module, key)
- except (KeyError, ValueError):
+ except (KeyError, ValueError, AttributeError):
# if above failed, get defaults from global dict
defaults[key] = BASE_CONFIG[key]
", ONLY_MODULES=" + str(modules))
# run plugins
- modules = ['apache', 'nginx']
charts = PythonCharts(modules, MODULES_DIR, CONFIG_DIR + "python.d/", disabled)
charts.check()
charts.create()
"options": "'' absolute 8 1000000000"}
]},
'requests': {
- 'options': "''' 'apache Requests' 'requests/s' requests apache.requests line",
+ 'options': "'' 'apache Requests' 'requests/s' requests apache.requests line",
'lines': [
{"name": "requests",
"options": "'' incremental 1 1"}
class Service(UrlService):
- # url = "http://localhost/server-status?auto"
- url = "http://www.apache.org/server-status?auto"
- order = ORDER
- charts = CHARTS
- assignment = {"BytesPerReq": 'size_req',
- "IdleWorkers": 'idle',
- "BusyWorkers": 'busy',
- "ReqPerSec": 'requests_sec',
- "BytesPerSec": 'size_sec',
- "Total Accesses": 'requests',
- "Total kBytes": 'sent',
- "ConnsTotal": 'connections',
- "ConnsAsyncKeepAlive": 'keepalive',
- "ConnsAsyncClosing": 'closing',
- "ConnsAsyncWriting": 'writing'}
+ def __init__(self, configuration=None, name=None):
+ UrlService.__init__(self, configuration=configuration, name=name)
+ if len(self.url) == 0:
+ # url = "http://localhost/server-status?auto" # FIXME
+ self.url = "http://www.apache.org/server-status?auto"
+ self.order = ORDER
+ self.charts = CHARTS
+ self.assignment = {"BytesPerReq": 'size_req',
+ "IdleWorkers": 'idle',
+ "BusyWorkers": 'busy',
+ "ReqPerSec": 'requests_sec',
+ "BytesPerSec": 'size_sec',
+ "Total Accesses": 'requests',
+ "Total kBytes": 'sent',
+ "ConnsTotal": 'connections',
+ "ConnsAsyncKeepAlive": 'keepalive',
+ "ConnsAsyncClosing": 'closing',
+ "ConnsAsyncWriting": 'writing'}
def _formatted_data(self):
"""
'options': "'' 'nginx Active Connections' 'connections' nginx nginx.connections line",
'lines': [
{"name": "active",
- "options": "'' absolute 1 1"},
+ "options": "'' absolute 1 1"}
]},
'requests': {
'options': "'' 'nginx Requests' 'requests/s' nginx nginx.requests line",
class Service(UrlService):
- # url = "http://localhost/stub_status"
- url = "http://toothless.dragon/stub_status"
- order = ORDER
- charts = CHARTS
+ def __init__(self, configuration=None, name=None):
+ UrlService.__init__(self, configuration=configuration, name=name)
+ if len(self.url) == 0:
+ self.url = "http://toothless.dragon/stub_status"
+ # self.url = "http://localhost/stub_status" # FIXME
+ self.order = ORDER
+ self.charts = CHARTS
def _formatted_data(self):
"""
class Service(UrlService):
- url = "http://localhost/status"
- order = ORDER
- charts = CHARTS
- assignment = {"active processes": 'active',
- "max active processes": 'maxActive',
- "idle processes": 'idle',
- "accepted conn": 'requests',
- "max children reached": 'reached',
- "slow requests": 'slow'}
+ def __init__(self, configuration=None, name=None):
+ UrlService.__init__(self, configuration=configuration, name=name)
+ if len(self.url) == 0:
+ self.url = "http://localhost/status"
+ self.order = ORDER
+ self.charts = CHARTS
+ self.assignment = {"active processes": 'active',
+ "max active processes": 'maxActive',
+ "idle processes": 'idle',
+ "accepted conn": 'requests',
+ "max children reached": 'reached',
+ "slow requests": 'slow'}
def _formatted_data(self):
"""
class UrlService(BaseService):
- charts = {}
- # charts definitions in format:
- # charts = {
- # 'chart_name_in_netdata': {
- # 'options': "parameters defining chart (passed to CHART statement)",
- # 'lines': [
- # { 'name': 'dimension_name',
- # 'options': 'dimension parameters (passed to DIMENSION statement)"
- # }
- # ]}
- # }
- order = []
- definitions = {}
- # definitions are created dynamically in create() method based on 'charts' dictionary. format:
- # definitions = {
- # 'chart_name_in_netdata' : [ charts['chart_name_in_netdata']['lines']['name'] ]
- # }
- url = ""
+ def __init__(self, configuration=None, name=None):
+ self.charts = {}
+ # charts definitions in format:
+ # charts = {
+ # 'chart_name_in_netdata': {
+ # 'options': "parameters defining chart (passed to CHART statement)",
+ # 'lines': [
+ # { 'name': 'dimension_name',
+ # 'options': 'dimension parameters (passed to DIMENSION statement)"
+ # }
+ # ]}
+ # }
+ self.order = []
+ self.definitions = {}
+ # definitions are created dynamically in create() method based on 'charts' dictionary. format:
+ # definitions = {
+ # 'chart_name_in_netdata' : [ charts['chart_name_in_netdata']['lines']['name'] ]
+ # }
+ self.url = ""
+ BaseService.__init__(self, configuration=configuration, name=name)
+
def _get_data(self):
"""
info: undefined,
},
+ 'nginx': {
+ title: 'nginx',
+ info: undefined,
+ },
+
+ 'apache': {
+ title: 'Apache',
+ info: undefined,
+ },
+
'named': {
title: 'named',
info: undefined
case 'mysql':
case 'phpfpm':
+ case 'nginx':
+ case 'apache':
case 'named':
case 'cgroup':
chart.menu = chart.type;