Module: check_mk
Branch: master
Commit: 8a666cf1a394f04c0a74d3074f4a302e84b3dcae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a666cf1a394f0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 17 12:08:47 2017 +0100
Improved logging of cache file writing
Change-Id: I1dcbf452de38ae3bc56969e053fccc3e7ed8ddd2
---
cmk_base/data_sources/abstract.py | 5 +++--
cmk_base/data_sources/snmp.py | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py
index 7597d58..fb3ba09 100644
--- a/cmk_base/data_sources/abstract.py
+++ b/cmk_base/data_sources/abstract.py
@@ -178,7 +178,7 @@ class DataSource(object):
return self._from_cache_file(result)
- def _write_cache_file(self, hostname, output):
+ def _write_cache_file(self, hostname, raw_data):
cachefile = self._cache_file_path(hostname)
try:
@@ -192,8 +192,9 @@ class DataSource(object):
except Exception, e:
raise MKGeneralException("Cannot create directory %r: %s" %
(os.path.dirname(cachefile), e))
+ self._logger.verbose("[%s] Write data to cache file %s" % (self.id(),
cachefile))
try:
- store.save_file(cachefile, self._to_cache_file(output))
+ store.save_file(cachefile, self._to_cache_file(raw_data))
except Exception, e:
raise MKGeneralException("Cannot write cache file %s: %s" %
(cachefile, e))
diff --git a/cmk_base/data_sources/snmp.py b/cmk_base/data_sources/snmp.py
index d55da51..9eeef03 100644
--- a/cmk_base/data_sources/snmp.py
+++ b/cmk_base/data_sources/snmp.py
@@ -102,7 +102,7 @@ class SNMPDataSource(DataSource):
def _to_cache_file(self, info):
- return repr(info)
+ return repr(info) + "\n"
def set_ignore_check_interval(self, ignore_check_interval):