2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2016 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
26 """This module serves the path structure of the Check_MK environment
27 to all components of Check_MK."""
31 from pathlib2
import Path
34 # One bright day, when every path is really a Path, this can die... :-)
36 return str(Path(*args
))
40 return _path(omd_root
, path
)
43 def _local_path(global_path
):
44 return _path(omd_root
, "local", Path(global_path
).relative_to(omd_root
))
47 # TODO: Add piggyback_dir and active_checks_dir and use it in code
49 omd_root
= _path(os
.environ
.get("OMD_ROOT", ""))
51 default_config_dir
= _omd_path("etc/check_mk")
52 main_config_file
= _omd_path("etc/check_mk/main.mk")
53 final_config_file
= _omd_path("etc/check_mk/final.mk")
54 local_config_file
= _omd_path("etc/check_mk/local.mk")
55 check_mk_config_dir
= _omd_path("etc/check_mk/conf.d")
56 modules_dir
= _omd_path("share/check_mk/modules")
57 var_dir
= _omd_path("var/check_mk")
58 log_dir
= _omd_path("var/log")
59 precompiled_checks_dir
= _omd_path("var/check_mk/precompiled_checks")
60 autochecks_dir
= _omd_path("var/check_mk/autochecks")
61 precompiled_hostchecks_dir
= _omd_path("var/check_mk/precompiled")
62 snmpwalks_dir
= _omd_path("var/check_mk/snmpwalks")
63 counters_dir
= _omd_path("tmp/check_mk/counters")
64 tcp_cache_dir
= _omd_path("tmp/check_mk/cache")
65 data_source_cache_dir
= _omd_path("tmp/check_mk/data_source_cache")
66 snmp_scan_cache_dir
= _omd_path("tmp/check_mk/snmp_scan_cache")
67 include_cache_dir
= _omd_path("tmp/check_mk/check_includes")
68 tmp_dir
= _omd_path("tmp/check_mk")
69 logwatch_dir
= _omd_path("var/check_mk/logwatch")
70 nagios_objects_file
= _omd_path("etc/nagios/conf.d/check_mk_objects.cfg")
71 nagios_command_pipe_path
= _omd_path("tmp/run/nagios.cmd")
72 check_result_path
= _omd_path("tmp/nagios/checkresults")
73 nagios_status_file
= _omd_path("tmp/nagios/status.dat")
74 nagios_conf_dir
= _omd_path("etc/nagios/conf.d")
75 nagios_config_file
= _omd_path("tmp/nagios/nagios.cfg")
76 nagios_startscript
= _omd_path("etc/init.d/core")
77 nagios_binary
= _omd_path("bin/nagios")
78 apache_config_dir
= _omd_path("etc/apache")
79 htpasswd_file
= _omd_path("etc/htpasswd")
80 livestatus_unix_socket
= _omd_path("tmp/run/live")
81 pnp_rraconf_dir
= _omd_path("share/check_mk/pnp-rraconf")
82 livebackendsdir
= _omd_path("share/check_mk/livestatus")
83 inventory_output_dir
= _omd_path("var/check_mk/inventory")
84 inventory_archive_dir
= _omd_path("var/check_mk/inventory_archive")
85 status_data_dir
= _omd_path("tmp/check_mk/status_data")
87 share_dir
= _omd_path("share/check_mk")
88 checks_dir
= _omd_path("share/check_mk/checks")
89 notifications_dir
= _omd_path("share/check_mk/notifications")
90 inventory_dir
= _omd_path("share/check_mk/inventory")
91 check_manpages_dir
= _omd_path("share/check_mk/checkman")
92 agents_dir
= _omd_path("share/check_mk/agents")
93 mibs_dir
= _omd_path("share/check_mk/mibs")
94 web_dir
= _omd_path("share/check_mk/web")
95 pnp_templates_dir
= _omd_path("share/check_mk/pnp-templates")
96 doc_dir
= _omd_path("share/doc/check_mk")
97 locale_dir
= _omd_path("share/check_mk/locale")
98 bin_dir
= _omd_path("bin")
99 lib_dir
= _omd_path("lib")
100 mib_dir
= _omd_path("share/snmp/mibs")
102 local_share_dir
= _local_path(share_dir
)
103 local_checks_dir
= _local_path(checks_dir
)
104 local_notifications_dir
= _local_path(notifications_dir
)
105 local_inventory_dir
= _local_path(inventory_dir
)
106 local_check_manpages_dir
= _local_path(check_manpages_dir
)
107 local_agents_dir
= _local_path(agents_dir
)
108 local_mibs_dir
= _local_path(mibs_dir
)
109 local_web_dir
= _local_path(web_dir
)
110 local_pnp_templates_dir
= _local_path(pnp_templates_dir
)
111 local_doc_dir
= _local_path(doc_dir
)
112 local_locale_dir
= _local_path(locale_dir
)
113 local_bin_dir
= _local_path(bin_dir
)
114 local_lib_dir
= _local_path(lib_dir
)
115 local_mib_dir
= _local_path(mib_dir
)