mirror of https://github.com/Icinga/icinga2.git
parent
f86068d5e0
commit
a49a598eef
|
@ -31,10 +31,13 @@ endif()
|
|||
file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ")
|
||||
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(ICINGA2_USER "icinga" CACHE STRING "Icinga 2 user")
|
||||
set(ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group")
|
||||
set(ICINGA2_COMMAND_USER "icinga" CACHE STRING "Icinga 2 command user")
|
||||
set(ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group")
|
||||
set(ICINGA2_RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run" CACHE STRING "/run directory")
|
||||
set(ICINGA2_PLUGIN_PATH "/usr/lib/nagios/plugins" CACHE STRING "Path for the check plugins")
|
||||
set(ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe")
|
||||
|
||||
|
@ -121,7 +124,6 @@ if(HAVE_LIBEXECINFO)
|
|||
set(HAVE_BACKTRACE_SYMBOLS TRUE)
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES)
|
||||
|
||||
install(
|
||||
|
|
1
INSTALL
1
INSTALL
|
@ -127,6 +127,7 @@ variables are supported:
|
|||
- ICINGA2_GIT_VERSION_INFO: Whether to use Git to determine the version number; defaults to "ON"
|
||||
- ICINGA2_COMMAND_GROUP: The command group Icinga 2 should use; defaults to "icingacmd"
|
||||
- ICINGA2_PLUGIN_PATH: The path for the Monitoring Plugins project binaries; defaults to "/usr/lib/nagios/plugins"
|
||||
- ICINGA2_RUNDIR: The location of the "run" directory; defaults to CMAKE_INSTALL_LOCALSTATEDIR/run
|
||||
- CMAKE_INSTALL_SYSCONFDIR: The configuration directory; defaults to CMAKE_INSTALL_PREFIX/etc
|
||||
- ICINGA2_SYSCONFIGFILE: Where to put the config file the initscript/systemd pulls it's dirs from;
|
||||
defaults to CMAKE_INSTALL_PREFIX/etc/sysconfig/icinga2
|
||||
|
|
|
@ -37,5 +37,5 @@ install(TARGETS compat RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} LIBRARY DEST
|
|||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2/compat/archives\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/icinga2\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/spool/icinga2\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/icinga2/cmd\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2/cmd\")")
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace icinga
|
|||
class ExternalCommandListener : DynamicObject
|
||||
{
|
||||
[config] String command_path {
|
||||
default {{{ return Application::GetLocalStateDir() + "/run/icinga2/cmd/icinga2.cmd"; }}}
|
||||
default {{{ return Application::GetRunDir() + "/icinga2/cmd/icinga2.cmd"; }}}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class LivestatusListener : DynamicObject {
|
|||
default {{{ return "unix"; }}}
|
||||
};
|
||||
[config] String socket_path {
|
||||
default {{{ return Application::GetLocalStateDir() + "/run/icinga2/cmd/livestatus"; }}}
|
||||
default {{{ return Application::GetRunDir() + "/icinga2/cmd/livestatus"; }}}
|
||||
};
|
||||
[config] String bind_host {
|
||||
default {{{ return "127.0.0.1"; }}}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#define ICINGA_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
||||
#define ICINGA_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
|
||||
#define ICINGA_RUNDIR "${ICINGA2_RUNDIR}"
|
||||
#define ICINGA_LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}"
|
||||
#define ICINGA_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2"
|
||||
#define ICINGA_INCLUDECONFDIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2/include"
|
||||
|
|
|
@ -22,6 +22,7 @@ override_dh_auto_configure:
|
|||
dh_auto_configure -- \
|
||||
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
|
||||
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
|
||||
-DICINGA2_RUNDIR=/run \
|
||||
-DICINGA2_USER=nagios \
|
||||
-DICINGA2_GROUP=nagios \
|
||||
-DICINGA2_COMMAND_USER=nagios \
|
||||
|
|
|
@ -934,7 +934,7 @@ information in the check output (`-o`).
|
|||
PluginDir + "/process_check_result",
|
||||
"-H", "$host.name$",
|
||||
"-S", "$service.name$",
|
||||
"-c", LocalStateDir + "/run/icinga2/cmd/icinga2.cmd",
|
||||
"-c", RunDir + "/icinga2/cmd/icinga2.cmd",
|
||||
"-r", "0",
|
||||
"-o", "Event Handler triggered in state '$service.state$' with output '$service.output$'."
|
||||
]
|
||||
|
|
|
@ -10,6 +10,7 @@ PrefixDir |**Read-only.** Contains the installation prefix that was sp
|
|||
SysconfDir |**Read-only.** Contains the path of the sysconf directory. Defaults to PrefixDir + "/etc".
|
||||
ZonesDir |**Read-only.** Contains the path of the zones.d directory. Defaults to SysconfDir + "/zones.d".
|
||||
LocalStateDir |**Read-only.** Contains the path of the local state directory. Defaults to PrefixDir + "/var".
|
||||
RunDir |**Read-only.** Contains the path of the run directory. Defaults to LocalStateDir + "/run".
|
||||
PkgDataDir |**Read-only.** Contains the path of the package data directory. Defaults to PrefixDir + "/share/icinga2".
|
||||
StatePath |**Read-write.** Contains the path of the Icinga 2 state file. Defaults to LocalStateDir + "/lib/icinga2/icinga2.state".
|
||||
PidPath |**Read-write.** Contains the path of the Icinga 2 PID file. Defaults to LocalStateDir + "/run/icinga2/icinga2.pid".
|
||||
|
@ -1435,7 +1436,7 @@ Attributes:
|
|||
socket\_type |**Optional.** Specifies the socket type. Can be either "tcp" or "unix". Defaults to "unix".
|
||||
bind\_host |**Optional.** Only valid when socket\_type is "tcp". Host address to listen on for connections. Defaults to "127.0.0.1".
|
||||
bind\_port |**Optional.** Only valid when `socket_type` is "tcp". Port to listen on for connections. Defaults to 6558.
|
||||
socket\_path |**Optional.** Only valid when `socket_type` is "unix". Specifies the path to the UNIX socket file. Defaults to LocalStateDir + "/run/icinga2/cmd/livestatus".
|
||||
socket\_path |**Optional.** Only valid when `socket_type` is "unix". Specifies the path to the UNIX socket file. Defaults to RunDir + "/icinga2/cmd/livestatus".
|
||||
compat\_log\_path |**Optional.** Required for historical table queries. Requires `CompatLogger` feature enabled. Defaults to LocalStateDir + "/log/icinga2/compat"
|
||||
|
||||
> **Note**
|
||||
|
@ -1481,7 +1482,7 @@ Attributes:
|
|||
|
||||
Name |Description
|
||||
----------------|----------------
|
||||
command\_path |**Optional.** Path to the command pipe. Defaults to LocalStateDir + "/run/icinga2/cmd/icinga2.cmd".
|
||||
command\_path |**Optional.** Path to the command pipe. Defaults to RunDir + "/icinga2/cmd/icinga2.cmd".
|
||||
|
||||
### <a id="objecttype-compatlogger"></a> CompatLogger
|
||||
|
||||
|
|
|
@ -28,6 +28,6 @@ if [ -f $ICINGA2_LOG ]; then
|
|||
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_LOG
|
||||
fi
|
||||
|
||||
mkdir -p $ICINGA2_STATE_DIR/run/icinga2/cmd
|
||||
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_STATE_DIR/run/icinga2/cmd
|
||||
chmod 2755 $ICINGA2_STATE_DIR/run/icinga2/cmd
|
||||
mkdir -p $ICINGA2_RUN_DIR/icinga2/cmd
|
||||
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_RUN_DIR/icinga2/cmd
|
||||
chmod 2755 $ICINGA2_RUN_DIR/icinga2/cmd
|
||||
|
|
|
@ -7,7 +7,7 @@ Type=forking
|
|||
EnvironmentFile=@ICINGA2_SYSCONFIGFILE@
|
||||
ExecStartPre=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-prepare-dirs @ICINGA2_SYSCONFIGFILE@
|
||||
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 -c ${ICINGA2_CONFIG_FILE} -d -e ${ICINGA2_ERROR_LOG} -u ${ICINGA2_USER} -g ${ICINGA2_GROUP}
|
||||
PIDFile=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/run/icinga2/icinga2.pid
|
||||
PIDFile=@ICINGA2_RUNDIR@/icinga2/icinga2.pid
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
DAEMON=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2
|
||||
ICINGA2_CONFIG_FILE=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2/icinga2.conf
|
||||
ICINGA2_RUN_DIR=@ICINGA2_RUNDIR@
|
||||
ICINGA2_STATE_DIR=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@
|
||||
ICINGA2_PID_FILE=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/run/icinga2/icinga2.pid
|
||||
ICINGA2_PID_FILE=$ICINGA2_RUN_DIR/icinga2/icinga2.pid
|
||||
ICINGA2_ERROR_LOG=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/error.log
|
||||
ICINGA2_STARTUP_LOG=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/startup.log
|
||||
ICINGA2_LOG=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/icinga2.log
|
||||
|
|
|
@ -40,4 +40,4 @@ install(
|
|||
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/icinga2\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/icinga2\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_RUNDIR}/icinga2\")")
|
||||
|
|
|
@ -300,6 +300,7 @@ int Main(void)
|
|||
String prefix = (char *)pvData;
|
||||
Application::DeclarePrefixDir(prefix);
|
||||
Application::DeclareSysconfDir(prefix + "\\etc");
|
||||
Application::DeclareRunDir(prefix + "\\var\\run");
|
||||
Application::DeclareLocalStateDir(prefix + "\\var");
|
||||
Application::DeclarePkgDataDir(prefix + "\\share\\icinga2");
|
||||
Application::DeclareIncludeConfDir(prefix + "\\share\\icinga2\\include");
|
||||
|
@ -316,6 +317,7 @@ int Main(void)
|
|||
#endif /* _WIN32 */
|
||||
Application::DeclarePrefixDir(ICINGA_PREFIX);
|
||||
Application::DeclareSysconfDir(ICINGA_SYSCONFDIR);
|
||||
Application::DeclareRunDir(ICINGA_RUNDIR);
|
||||
Application::DeclareLocalStateDir(ICINGA_LOCALSTATEDIR);
|
||||
Application::DeclarePkgDataDir(ICINGA_PKGDATADIR);
|
||||
Application::DeclareIncludeConfDir(ICINGA_INCLUDECONFDIR);
|
||||
|
@ -380,7 +382,7 @@ int Main(void)
|
|||
}
|
||||
|
||||
Application::DeclareStatePath(Application::GetLocalStateDir() + "/lib/icinga2/icinga2.state");
|
||||
Application::DeclarePidPath(Application::GetLocalStateDir() + "/run/icinga2/icinga2.pid");
|
||||
Application::DeclarePidPath(Application::GetRunDir() + "/icinga2/icinga2.pid");
|
||||
|
||||
#ifndef _WIN32
|
||||
if (g_AppParams.count("group")) {
|
||||
|
|
|
@ -459,6 +459,7 @@ void Application::DisplayVersionMessage(void)
|
|||
<< "* Application version: " << GetVersion() << std::endl
|
||||
<< "* Installation root: " << GetPrefixDir() << std::endl
|
||||
<< "* Sysconf directory: " << GetSysconfDir() << std::endl
|
||||
<< "* Run directory: " << GetRunDir() << std::endl
|
||||
<< "* Local state directory: " << GetLocalStateDir() << std::endl
|
||||
<< "* Package data directory: " << GetPkgDataDir() << std::endl
|
||||
<< "* State path: " << GetStatePath() << std::endl
|
||||
|
@ -841,6 +842,26 @@ void Application::DeclareSysconfDir(const String& path)
|
|||
ScriptVariable::Set("SysconfDir", path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the path for the run dir.
|
||||
*
|
||||
* @returns The path.
|
||||
*/
|
||||
String Application::GetRunDir(void)
|
||||
{
|
||||
return ScriptVariable::Get("RunDir");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the path of the run dir.
|
||||
*
|
||||
* @param path The new path.
|
||||
*/
|
||||
void Application::DeclareRunDir(const String& path)
|
||||
{
|
||||
ScriptVariable::Set("RunDir", path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the path for the local state dir.
|
||||
*
|
||||
|
@ -852,13 +873,13 @@ String Application::GetLocalStateDir(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the path of the zones dir.
|
||||
* Sets the path for the local state dir.
|
||||
*
|
||||
* @param path The new path.
|
||||
*/
|
||||
void Application::DeclareZonesDir(const String& path)
|
||||
void Application::DeclareLocalStateDir(const String& path)
|
||||
{
|
||||
ScriptVariable::Set("ZonesDir", path, false);
|
||||
ScriptVariable::Set("LocalStateDir", path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -872,13 +893,13 @@ String Application::GetZonesDir(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the path for the local state dir.
|
||||
* Sets the path of the zones dir.
|
||||
*
|
||||
* @param path The new path.
|
||||
*/
|
||||
void Application::DeclareLocalStateDir(const String& path)
|
||||
void Application::DeclareZonesDir(const String& path)
|
||||
{
|
||||
ScriptVariable::Set("LocalStateDir", path, false);
|
||||
ScriptVariable::Set("ZonesDir", path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,6 +87,9 @@ public:
|
|||
static String GetZonesDir(void);
|
||||
static void DeclareZonesDir(const String& path);
|
||||
|
||||
static String GetRunDir(void);
|
||||
static void DeclareRunDir(const String& path);
|
||||
|
||||
static String GetLocalStateDir(void);
|
||||
static void DeclareLocalStateDir(const String& path);
|
||||
|
||||
|
|
Loading…
Reference in New Issue