Module: check_mk
Branch: master
Commit: c313b3c3eb24cba7db742335c6d1a9cc11d1fa50
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c313b3c3eb24cb…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Mar 16 14:37:25 2018 +0100
5794 FIX diskspace cleanup: now also deletes any connected .info file when removing a rrd
file
Change-Id: I8a13f0c5b165b96c6722ec07393d2415774d6774
---
.werks/5794 | 10 ++++++++++
omd/packages/maintenance/diskspace | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/.werks/5794 b/.werks/5794
new file mode 100644
index 0000000..d809341
--- /dev/null
+++ b/.werks/5794
@@ -0,0 +1,10 @@
+Title: diskspace cleanup: now also deletes any connected .info file when removing a rrd
file
+Level: 1
+Component: packages
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1521207422
+Class: fix
+
+
diff --git a/omd/packages/maintenance/diskspace b/omd/packages/maintenance/diskspace
index a8c5459..9dd41cf 100755
--- a/omd/packages/maintenance/diskspace
+++ b/omd/packages/maintenance/diskspace
@@ -149,6 +149,14 @@ def delete_file(path, reason):
try:
log('Deleting file (%s): %s' % (reason, path))
os.unlink(path)
+
+ # Also delete any .info files which are connected to the rrd file
+ if path.endswith(".rrd"):
+ info_path = "%sinfo" % path[:-3]
+ if os.path.exists(info_path):
+ log('Deleting file (%s): %s' % (reason, info_path))
+ os.unlink(info_path)
+
return True
except Exception, e:
error('Error while deleting %s: %s' % (path, e))