Module: check_mk
Branch: master
Commit: 535bd44e3d66f07e92d3454a64689ff3cec51801
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=535bd44e3d66f0…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jan 30 10:01:35 2019 +0100
Removed even more Icinga traces.
Change-Id: Ied38bf5ecc501050c03e2d2b0e44b1480c2c1ec4
---
cmk/utils/paths.py | 61 ++++++-------------------------
cmk_base/core_nagios.py | 2 +-
cmk_base/packaging.py | 7 +---
omd/packages/check_multi/check_multi.make | 2 +-
omd/packages/omd/hooks/CORE | 2 +
5 files changed, 16 insertions(+), 58 deletions(-)
diff --git a/cmk/utils/paths.py b/cmk/utils/paths.py
index c65e878..98746c1 100644
--- a/cmk/utils/paths.py
+++ b/cmk/utils/paths.py
@@ -66,6 +66,9 @@ htpasswd_file = None
livestatus_unix_socket = None
pnp_rraconf_dir = None
livebackendsdir = None
+inventory_output_dir = ''
+inventory_archive_dir = ''
+status_data_dir = ''
share_dir = ''
checks_dir = None
@@ -97,14 +100,11 @@ local_locale_dir = ''
local_bin_dir = ''
local_lib_dir = ''
local_mib_dir = ''
-inventory_output_dir = ''
-inventory_archive_dir = ''
-status_data_dir = ''
def _set_paths():
global omd_root
- omd_root = _omd_root()
+ omd_root = os.environ.get("OMD_ROOT", "")
globals().update({
"default_config_dir": os.path.join(omd_root,
"etc/check_mk"),
@@ -126,13 +126,14 @@ def _set_paths():
"include_cache_dir": os.path.join(omd_root,
"tmp/check_mk/check_includes"),
"tmp_dir": os.path.join(omd_root, "tmp/check_mk"),
"logwatch_dir": os.path.join(omd_root,
"var/check_mk/logwatch"),
- "nagios_startscript": os.path.join(omd_root,
"etc/init.d/core"),
-
- # Switched via symlinks on icinga/nagios change
- "nagios_conf_dir": os.path.join(omd_root,
"etc/nagios/conf.d"),
"nagios_objects_file": os.path.join(omd_root,
"etc/nagios/conf.d/check_mk_objects.cfg"),
+ "nagios_command_pipe_path": os.path.join(omd_root,
"tmp/run/nagios.cmd"),
"check_result_path": os.path.join(omd_root,
"tmp/nagios/checkresults"),
"nagios_status_file": os.path.join(omd_root,
"tmp/nagios/status.dat"),
+ "nagios_conf_dir": os.path.join(omd_root,
"etc/nagios/conf.d"),
+ "nagios_config_file": os.path.join(omd_root,
"tmp/nagios/nagios.cfg"),
+ "nagios_startscript": os.path.join(omd_root,
"etc/init.d/core"),
+ "nagios_binary": os.path.join(omd_root, "bin/nagios"),
"apache_config_dir": os.path.join(omd_root, "etc/apache"),
"htpasswd_file": os.path.join(omd_root, "etc/htpasswd"),
"livestatus_unix_socket": os.path.join(omd_root,
"tmp/run/live"),
@@ -143,48 +144,6 @@ def _set_paths():
"status_data_dir": os.path.join(omd_root,
"tmp/check_mk/status_data"),
})
- _set_core_specific_paths()
- _set_overridable_paths()
- _set_overridable_paths(local=True)
-
-
-def _omd_root():
- return os.environ.get("OMD_ROOT", "")
-
-
-def _set_core_specific_paths():
- core = _get_core_name()
-
- if core == "icinga":
- globals().update({
- "nagios_binary": os.path.join(omd_root, "bin/icinga"),
- "nagios_config_file": os.path.join(omd_root,
"tmp/icinga/icinga.cfg"),
- "nagios_command_pipe_path": os.path.join(omd_root,
"tmp/run/icinga.cmd"),
- })
- else:
- globals().update({
- "nagios_binary": os.path.join(omd_root, "bin/nagios"),
- "nagios_config_file": os.path.join(omd_root,
"tmp/nagios/nagios.cfg"),
- "nagios_command_pipe_path": os.path.join(omd_root,
"tmp/run/nagios.cmd"),
- })
-
-
-# TODO: Find a better way to determine the currently configured core.
-# For example generalize the etc/check_mk/conf.d/microcore.mk which is written by the
CORE
-# hook -> Change the name to core.mk and write it for all configured cores.
-def _get_core_name():
- try:
- for l in open(os.path.join(omd_root, "etc/omd/site.conf")):
- if l.startswith("CONFIG_CORE='"):
- return l.split("'")[1]
- except IOError as e:
- # At least in test environment the file is not available. We only added this
try/except for
- # this case. This should better be solved in a cleaner way.
- if e.errno == 2:
- pass
- else:
- raise
-
def _set_overridable_paths(local=False):
rel_base = "local" if local else ""
@@ -212,3 +171,5 @@ def _set_overridable_paths(local=False):
_set_paths()
+_set_overridable_paths()
+_set_overridable_paths(local=True)
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index 20127d4..409352c 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -123,7 +123,7 @@ def create_config(outfile, hostnames):
"service_notification_periods is not longer supported. Please use
extra_service_conf['notification_period'] instead."
)
- # Map service_period to _SERVICE_PERIOD. This field das not exist in Nagios/Icinga.
+ # Map service_period to _SERVICE_PERIOD. This field das not exist in Nagios.
# The CMC has this field natively.
if "service_period" in config.extra_host_conf:
config.extra_host_conf["_SERVICE_PERIOD"] =
config.extra_host_conf["service_period"]
diff --git a/cmk_base/packaging.py b/cmk_base/packaging.py
index 6dd0709..db6e67c 100644
--- a/cmk_base/packaging.py
+++ b/cmk_base/packaging.py
@@ -132,12 +132,7 @@ config_parts = [
]
package_ignored_files = {
- "lib": [
- "nagios/plugins/README.txt",
- # it's a symlink to the nagios directory. All files would be doubled.
- # So better ignore this directory to prevent confusions.
- "icinga/plugins",
- ],
+ "lib": ["nagios/plugins/README.txt"],
}
diff --git a/omd/packages/check_multi/check_multi.make
b/omd/packages/check_multi/check_multi.make
index 856cd9b..d03d709 100644
--- a/omd/packages/check_multi/check_multi.make
+++ b/omd/packages/check_multi/check_multi.make
@@ -19,7 +19,7 @@ $(CHECK_MULTI)-install: $(CHECK_MULTI_INSTALL)
$(CHECK_MULTI)-skel:
# TODO
-#--with-nagios-name=<nagios|icinga> set nagios name (there might be some
clones ;)) (default:nagios)
+#--with-nagios-name=<nagios> set nagios name (there might be some clones ;))
(default:nagios)
#--with-action_url="$(OMD_SITE)/pnp4nagios/index.php/graph?host=\\\$$HOSTNAME\\\$$&srv=\\\$$SERVICEDESC\\\$$"
CHECK_MULTI_CONFIGUREOPTS := \
--libexecdir="$(ROOTDIR)/lib/nagios/plugins" \
diff --git a/omd/packages/omd/hooks/CORE b/omd/packages/omd/hooks/CORE
index a1ef91d..1942129 100755
--- a/omd/packages/omd/hooks/CORE
+++ b/omd/packages/omd/hooks/CORE
@@ -38,6 +38,8 @@ case "$1" in
if [ -e $OMD_ROOT/etc/apache/conf.d/nagios.conf ] ; then
rm -f $OMD_ROOT/etc/apache/conf.d/nagios.conf
fi
+ # NOTE: Although we don't ship Icinga anymore, we leave this to make
+ # sure there is no dangling symlink and keep Apache happy.
if [ -e $OMD_ROOT/etc/apache/conf.d/icinga.conf ] ; then
rm -f $OMD_ROOT/etc/apache/conf.d/icinga.conf
fi