Module: check_mk
Branch: master
Commit: 5acc758e26624b9fdec7444333b07e259eade2ca
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5acc758e26624b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 31 07:48:48 2018 +0200
6517 FIX Nagios: Improved init script when tmpfs is not prepared
When using Nagios as core and executing "cmk -R" or "cmk -O"
on a totally stopped site ("omd stop" + "omd umount") without
previously executing "omd start" errors like this occured:
etc/init.d/nagios: line 72: /omd/sites/heute/tmp/nagios/nagios.cfg: No such file or directory
Nagios configuration file /omd/sites/heute/tmp/nagios/nagios.cfg not found. Terminating...
This has been replaced by a more helpful error message:
Change-Id: If442e8cdf01c752535daeaebc55a83e1438864df
ERROR: tmp directory is not ready. Use "omd start" to prepare it
---
.werks/6517 | 20 ++++++++++++++++++++
omd/packages/nagios/skel/etc/init.d/nagios | 8 ++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/.werks/6517 b/.werks/6517
new file mode 100644
index 0000000..50caf5a
--- /dev/null
+++ b/.werks/6517
@@ -0,0 +1,20 @@
+Title: Nagios: Improved init script when tmpfs is not prepared
+Level: 1
+Component: packages
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535694318
+
+When using Nagios as core and executing "cmk -R" or "cmk -O"
+on a totally stopped site ("omd stop" + "omd umount") without
+previously executing "omd start" errors like this occured:
+
+etc/init.d/nagios: line 72: /omd/sites/heute/tmp/nagios/nagios.cfg: No such file or directory
+Nagios configuration file /omd/sites/heute/tmp/nagios/nagios.cfg not found. Terminating...
+
+This has been replaced by a more helpful error message:
+
+ERROR: tmp directory is not ready. Use "omd start" to prepare it
diff --git a/omd/packages/nagios/skel/etc/init.d/nagios b/omd/packages/nagios/skel/etc/init.d/nagios
index 758f3ed..94574aa 100755
--- a/omd/packages/nagios/skel/etc/init.d/nagios
+++ b/omd/packages/nagios/skel/etc/init.d/nagios
@@ -41,11 +41,10 @@ cd ###ROOT###
[ "$CONFIG_CORE" = "nagios" ] || exit 5
BIN=###ROOT###/bin/nagios
+TMP_DIR=###ROOT###/tmp/nagios
CFG_FILE=###ROOT###/tmp/nagios/nagios.cfg
-STATUS_FILE=###ROOT###/tmp/nagios/status.dat
CMD_FILE=###ROOT###/tmp/run/nagios.cmd
PID_FILE=###ROOT###/tmp/lock/nagios.lock
-STATUS_DAT=###ROOT###/tmp/nagios/status.dat
CHECKRESULTS_DIR=###ROOT###/tmp/nagios/checkresults
USR=###SITE###
GRP=###SITE###
@@ -68,6 +67,11 @@ export CONFIG_MKEVENTD
# OMD: create configuration file out of fragments
case "$1" in start|restart|reload|checkconfig|check)
+ if [ ! -d "$TMP_DIR" ]; then
+ echo "ERROR: tmp directory is not ready. Use \"omd start\" to prepare it"
+ exit 1
+ fi
+
merge-nagios-config \
###ROOT###/etc/nagios/nagios.d/*.cfg \
###ROOT###/etc/nagios/nagios.cfg \