Allow yml conf for convenience
This commit is contained in:
parent
4e67a87648
commit
cb3432bb92
@ -44,6 +44,8 @@ The `monitors` key contains a list of monitor modules to run:
|
||||
|
||||
The name of the module to run for a monitor is `type`. The `freq` option is the frequency, in seconds, that this monitor will check and report data. If the monitor being used takes any options, they can be passed as a object with the `args` option,
|
||||
|
||||
A yaml config can also be used. The data structure must be identical and the filename MUST end in `.yml`.
|
||||
|
||||
Developing Modules
|
||||
------------------
|
||||
|
||||
|
25
examples/config.yml
Normal file
25
examples/config.yml
Normal file
@ -0,0 +1,25 @@
|
||||
backend:
|
||||
url: 'http://10.0.3.15:9200/'
|
||||
monitors:
|
||||
- type: uptime
|
||||
freq: '30'
|
||||
args: {}
|
||||
- type: load
|
||||
freq: '30'
|
||||
args: {}
|
||||
- type: meminfo
|
||||
freq: '30'
|
||||
args: {}
|
||||
- type: procs
|
||||
freq: '30'
|
||||
args: {}
|
||||
- type: diskspace
|
||||
freq: '30'
|
||||
args:
|
||||
filesystems:
|
||||
- '/'
|
||||
- '/var'
|
||||
- '/home'
|
||||
- type: diskio
|
||||
freq: '30'
|
||||
args: {}
|
@ -215,7 +215,13 @@ def run_cli():
|
||||
sys.exit()
|
||||
|
||||
with open(options.config, "r") as c:
|
||||
conf = json.load(c)
|
||||
if options.config[-4:0] == 'json':
|
||||
conf = json.load(c)
|
||||
elif options.config[-4:0] == 'yml':
|
||||
from yaml import load as yaml_load
|
||||
conf = yaml_load(c)
|
||||
else:
|
||||
raise Exception("Invalid config format")
|
||||
|
||||
logger.info("starting daemon with conf: %s" % conf)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user