mirror of https://github.com/Icinga/icinga2.git
Refactor mods-enabled/mods-available.
This commit is contained in:
parent
28236f341a
commit
2d3e639fac
|
@ -139,7 +139,7 @@ docs/Makefile
|
||||||
etc/Makefile
|
etc/Makefile
|
||||||
etc/icinga2/Makefile
|
etc/icinga2/Makefile
|
||||||
etc/icinga2/conf.d/Makefile
|
etc/icinga2/conf.d/Makefile
|
||||||
etc/icinga2/mods-available/Makefile
|
etc/icinga2/features-available/Makefile
|
||||||
etc/init.d/Makefile
|
etc/init.d/Makefile
|
||||||
icinga-app/Makefile
|
icinga-app/Makefile
|
||||||
itl/Makefile
|
itl/Makefile
|
||||||
|
@ -155,7 +155,7 @@ third-party/cJSON/Makefile
|
||||||
third-party/execvpe/Makefile
|
third-party/execvpe/Makefile
|
||||||
third-party/mmatch/Makefile
|
third-party/mmatch/Makefile
|
||||||
tools/Makefile
|
tools/Makefile
|
||||||
tools/i2modconf
|
tools/i2enfeature
|
||||||
tools/mkembedconfig/Makefile
|
tools/mkembedconfig/Makefile
|
||||||
])
|
])
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
conf.d \
|
conf.d \
|
||||||
mods-available
|
features-available
|
||||||
|
|
||||||
icinga2confdir = $(sysconfdir)/icinga2
|
icinga2confdir = $(sysconfdir)/icinga2
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ EXTRA_DIST = $(CONFIG_FILES)
|
||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
@cd $(icinga2confdir) && \
|
@cd $(icinga2confdir) && \
|
||||||
if [ ! -e mods-enabled ]; then \
|
if [ ! -e features-enabled ]; then \
|
||||||
$(MKDIR_P) mods-enabled && \
|
$(MKDIR_P) features-enabled && \
|
||||||
$(LN_S) ../mods-available/compat.conf mods-enabled/; \
|
$(LN_S) ../features-available/compat.conf features-enabled/; \
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
icinga2confdir = $(sysconfdir)/icinga2/mods-available
|
icinga2confdir = $(sysconfdir)/icinga2/features-available
|
||||||
icinga2conf_DATA = \
|
|
||||||
compat.load
|
|
||||||
|
|
||||||
CONFIG_FILES = \
|
CONFIG_FILES = \
|
||||||
compat.conf
|
compat.conf
|
||||||
|
@ -15,4 +13,4 @@ install-data-local:
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
EXTRA_DIST = $(CONFIG_FILES) $(icinga2conf_DATA)
|
EXTRA_DIST = $(CONFIG_FILES)
|
|
@ -4,7 +4,7 @@
|
||||||
* hosts and services. CompatLog writeis the Icinga 1.x icinga.log and archives.
|
* hosts and services. CompatLog writeis the Icinga 1.x icinga.log and archives.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include "compat.load"
|
library "compat"
|
||||||
|
|
||||||
object StatusDataWriter "status" { }
|
object StatusDataWriter "status" { }
|
||||||
object ExternalCommandListener "command" { }
|
object ExternalCommandListener "command" { }
|
|
@ -1,2 +0,0 @@
|
||||||
library "compat"
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
mkembedconfig
|
mkembedconfig
|
||||||
|
|
||||||
bin_SCRIPTS = i2modconf
|
bin_SCRIPTS = i2enfeature
|
||||||
CLEANFILES = $(bin_SCRIPTS)
|
CLEANFILES = $(bin_SCRIPTS)
|
||||||
|
|
||||||
EXTRA_DIST = i2modconf.in
|
EXTRA_DIST = i2enfeature.in
|
||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
$(LN_S) -f i2modconf $(bindir)/i2enmod
|
$(LN_S) -f i2enfeature $(bindir)/i2disfeature
|
||||||
$(LN_S) -f i2modconf $(bindir)/i2dismod
|
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/sh
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
sbindir=@sbindir@
|
||||||
|
bindir=@bindir@
|
||||||
|
sysconfdir=@sysconfdir@
|
||||||
|
localstatedir=@localstatedir@
|
||||||
|
|
||||||
|
ICINGA2CONFDIR=@sysconfdir@/icinga2
|
||||||
|
|
||||||
|
TOOL=$(basename -- $0)
|
||||||
|
|
||||||
|
if [ "$TOOL" != "i2enfeature" -a "$TOOL" != "i2disfeature" ]; then
|
||||||
|
echo "Invalid tool name ($TOOL). Should be 'i2enfeature' or 'i2disfeature'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Syntax: $0 <feature>"
|
||||||
|
|
||||||
|
if [ "$TOOL" = "i2enfeature" ]; then
|
||||||
|
echo "Enables the specified feature."
|
||||||
|
else
|
||||||
|
echo "Disables the specified feature."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -n "Available feature: "
|
||||||
|
|
||||||
|
for file in $ICINGA2CONFDIR/mods-available/*.conf; do
|
||||||
|
echo -n $(basename -- $file .conf)
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FEATURE=$1
|
||||||
|
|
||||||
|
if [ ! -e $ICINGA2CONFDIR/mods-available/$FEATURE.conf ]; then
|
||||||
|
echo "The feature '$FEATURE' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$TOOL" = "i2enfeature" ]; then
|
||||||
|
if [ -e $ICINGA2CONFDIR/mods-enabled/$FEATURE.conf ]; then
|
||||||
|
echo "The feature '$FEATURE' is already enabled."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -s ../mods-available/$FEATURE.conf $ICINGA2CONFDIR/mods-enabled/
|
||||||
|
|
||||||
|
echo "Module '$FEATURE' was enabled."
|
||||||
|
elif [ "$TOOL" = "i2disfeature" ]; then
|
||||||
|
if [ ! -e $ICINGA2CONFDIR/mods-enabled/$FEATURE.conf ]; then
|
||||||
|
echo "The feature '$FEATURE' is already disabled."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f $ICINGA2CONFDIR/mods-enabled/$FEATURE.conf
|
||||||
|
|
||||||
|
echo "Module '$FEATURE' was disabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Make sure to restart Icinga 2 for these changes to take effect."
|
||||||
|
exit 0
|
|
@ -1,67 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
sbindir=@sbindir@
|
|
||||||
bindir=@bindir@
|
|
||||||
sysconfdir=@sysconfdir@
|
|
||||||
localstatedir=@localstatedir@
|
|
||||||
|
|
||||||
ICINGA2CONFDIR=@sysconfdir@/icinga2
|
|
||||||
|
|
||||||
TOOL=$(basename -- $0)
|
|
||||||
|
|
||||||
if [ "$TOOL" != "i2enmod" -a "$TOOL" != "i2dismod" ]; then
|
|
||||||
echo "Invalid tool name ($TOOL). Should be 'i2enmod' or 'i2dismod'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Syntax: $0 <module>"
|
|
||||||
|
|
||||||
if [ "$TOOL" = "i2enmod" ]; then
|
|
||||||
echo "Enables the specified module."
|
|
||||||
else
|
|
||||||
echo "Disables the specified module."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo -n "Available modules: "
|
|
||||||
|
|
||||||
for file in $ICINGA2CONFDIR/mods-available/*.conf; do
|
|
||||||
echo -n $(basename -- $file .conf)
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
MOD=$1
|
|
||||||
|
|
||||||
if [ ! -e $ICINGA2CONFDIR/mods-available/$MOD.conf ]; then
|
|
||||||
echo "The module '$MOD' does not exist."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$TOOL" = "i2enmod" ]; then
|
|
||||||
if [ -e $ICINGA2CONFDIR/mods-enabled/$MOD.conf ]; then
|
|
||||||
echo "The module '$MOD' is already enabled."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
ln -s ../mods-available/$MOD.conf $ICINGA2CONFDIR/mods-enabled/
|
|
||||||
|
|
||||||
echo "Module '$MOD' was enabled."
|
|
||||||
elif [ "$TOOL" = "i2dismod" ]; then
|
|
||||||
if [ ! -e $ICINGA2CONFDIR/mods-enabled/$MOD.conf ]; then
|
|
||||||
echo "The module '$MOD' is already disabled."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f $ICINGA2CONFDIR/mods-enabled/$MOD.conf
|
|
||||||
|
|
||||||
echo "Module '$MOD' was disabled."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Make sure to restart Icinga 2 for these changes to take effect."
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue