Module: check_mk
Branch: master
Commit: 28064ccf5f5efce5e3dab9f3a82a348261204659
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28064ccf5f5efc…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Thu Dec 13 15:09:55 2018 +0100
mk_filestats: Add bakelet and WATO rule
Change-Id: I240ce97c3bc77a8881383241b6605eccf2327832
---
agents/cfg_examples/{mk_filestats.cfg => filestats.cfg} | 0
agents/plugins/mk_filestats.py | 7 ++++---
tests/unit/cmk/gui/test_watolib.py | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/agents/cfg_examples/mk_filestats.cfg b/agents/cfg_examples/filestats.cfg
similarity index 100%
rename from agents/cfg_examples/mk_filestats.cfg
rename to agents/cfg_examples/filestats.cfg
diff --git a/agents/plugins/mk_filestats.py b/agents/plugins/mk_filestats.py
index 9e4923d..79df6d6 100755
--- a/agents/plugins/mk_filestats.py
+++ b/agents/plugins/mk_filestats.py
@@ -34,7 +34,7 @@ Options:
-h, --help Show this help message and exit
-v, -vv Increase verbosity
-c, --config-file Read config file
- (default: $MK_CONFDIR/mk_filestats.cfg)
+ (default: $MK_CONFDIR/filestats.cfg)
Details:
@@ -111,7 +111,7 @@ try:
except NameError: # Python3
import configparser
-DEFAULT_CFG_FILE = os.path.join(os.getenv('MK_CONFDIR', ''),
"mk_filestats.cfg")
+DEFAULT_CFG_FILE = os.path.join(os.getenv('MK_CONFDIR', ''),
"filestats.cfg")
DEFAULT_CFG_SECTION = {"output": "file_stats"}
@@ -465,7 +465,6 @@ def get_output_aggregator(config):
def write_output(groups, output_aggregator):
- sys.stdout.write('<<<mk_filestats:sep(0)>>>\n')
for group_name, group_files_iter in groups:
for line in output_aggregator(group_name, group_files_iter):
sys.stdout.write("%s\n" % line)
@@ -488,6 +487,7 @@ def iter_config_section_dicts(cfg_file=None):
if cfg_file is None:
cfg_file = DEFAULT_CFG_FILE
config = configparser.ConfigParser(DEFAULT_CFG_SECTION)
+ LOGGER.debug("trying to read %r", cfg_file)
files_read = config.read(cfg_file)
LOGGER.info("read configration file(s): %r", files_read)
@@ -500,6 +500,7 @@ def main():
args = parse_arguments()
+ sys.stdout.write('<<<filestats:sep(0)>>>\n')
for section_name, config in iter_config_section_dicts(args['cfg_file']):
#1 input
diff --git a/tests/unit/cmk/gui/test_watolib.py b/tests/unit/cmk/gui/test_watolib.py
index 0cb6d36..1a71640 100644
--- a/tests/unit/cmk/gui/test_watolib.py
+++ b/tests/unit/cmk/gui/test_watolib.py
@@ -1369,6 +1369,7 @@ def test_grouped_rulespecs():
'agent_config:mk_saprouter',
'agent_config:mk_sap',
'agent_config:mk_logwatch',
+ 'agent_config:mk_filestats',
'agent_config:nginx_status',
'agent_config:apache_status',
'agent_config:mk_oracle',