plugins.d/python.d.plugin
paulfantom committed
Jun 19, 2016 at 13:56 UTC
11344c9816ecdc52ace19be9746ce3ddf86f413e
1 file changed
+12
-1
plugins.d/python.d.plugin
+12
-1
@@ -136,6 +136,14 @@ class PythonCharts(object):
136
": configuration file '" +
137
configfile +
138
"' not found. Using defaults.")
139
+ # set config if not found
140
+ if not hasattr(mod, 'config'):
141
+ mod.config = {None:{}}
142
+ for var in BASE_CONFIG:
143
+ try:
144
+ mod.config[None][var] = getattr(var, mod)
145
+ except Exception:
146
+ mod.config[None][var] = BASE_CONFIG[var]
147
return modules
148
149
def _parse_config(self,module,config):
@@ -174,7 +182,7 @@ class PythonCharts(object):
182
# return dictionary of jobs where every job has BASE_CONFIG variables
183
return config
184
177
- def _stop(self, job, reason=None): #FIXME test if Service has __name__
185
+ def _stop(self, job, reason=None):
186
# modifies self.jobs
187
self.jobs.remove(job)
188
if reason is None:
@@ -356,9 +364,11 @@ def run():
364
if config_dir[-1] != '/':
365
config_dir += '/'
366
configfile = config_dir + "python.d.conf"
367
+ print(config_dir)
368
369
try:
370
conf = read_config(configfile)
371
+ print(conf)
372
try:
373
if str(conf['enable']) is False:
374
debug("disabled in configuration file")
@@ -411,6 +421,7 @@ def run():
421
charts.check()
422
charts.create()
423
charts.update()
424
+ sys.stdout.write("DISABLE")
425
426
if __name__ == '__main__':
427
run()