Remove icinga2-enable-feature and icinga2-disable-feature

refs #7250
This commit is contained in:
Gunnar Beutner 2014-10-14 18:32:15 +02:00
parent 533ec940b8
commit d7d6d6096f
21 changed files with 73 additions and 241 deletions

View File

@ -176,7 +176,7 @@ ZONES
sed -i "s/NodeName = \"localhost\"/NodeName = \"$name\"/" /etc/icinga2/constants.conf
echo "Enabling API feature..."
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-enable-feature api
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 feature enable api
if [ ! -e "@CMAKE_INSTALL_FULL_SYSCONFDIR@/monitoring" ]; then
ln -s $ICINGA2CONFIG/conf.d/hosts/localhost @CMAKE_INSTALL_FULL_SYSCONFDIR@/monitoring
@ -184,7 +184,7 @@ ZONES
if [ "$master" = "n" ]; then
echo "Disabling notification feature..."
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-disable-feature notification
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 feature disable notification
fi
echo ""

View File

@ -37,7 +37,7 @@ is_fresh_install()
enable_features_for_classic() {
if is_fresh_install $@; then
echo "enabling icinga2 features for classicui"
icinga2-enable-feature compatlog statusdata command
icinga2 feature enable compatlog statusdata command
echo "reloading icinga2"
[ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload

View File

@ -29,7 +29,7 @@ enable_default_features() {
if is_fresh_install $@ \
|| dpkg --compare-versions "$2" lt "$FIX_VERSION"; then
echo "enabling default icinga2 features"
icinga2-enable-feature checker notification mainlog
icinga2 feature enable checker notification mainlog
fi
# handle new default features here in the future
}

View File

@ -21,7 +21,7 @@ if [ "$1" = configure ]; then
if [ -L /etc/icinga2/features-enabled/ido-mysql.conf ]
then
echo "disable ido mysql feature"
icinga2-disable-feature ido-mysql
icinga2 feature disable ido-mysql
echo "reloading icinga2"
[ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
fi
@ -29,7 +29,7 @@ if [ "$1" = configure ]; then
if [ ! -L /etc/icinga2/features-enabled/ido-mysql.conf ]
then
echo "enable ido mysql feature"
icinga2-enable-feature ido-mysql
icinga2 feature enable ido-mysql
echo "reloading icinga2"
[ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload

View File

@ -6,4 +6,4 @@ _Description: Enable icinga 2 mysql idoutils?
feature gets enabled for icinga 2.
.
If you want to disable the feature call
icinga2-disable-feature ido-mysql
icinga2 feature disable ido-mysql

View File

@ -21,7 +21,7 @@ if [ "$1" = configure ]; then
if [ -L /etc/icinga2/features-enabled/ido-pgsql.conf ]
then
echo "disable ido pgsql feature"
icinga2-disable-feature ido-pgsql
icinga2 feature disable ido-pgsql
echo "reloading icinga2"
[ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
fi
@ -29,7 +29,7 @@ if [ "$1" = configure ]; then
if [ ! -L /etc/icinga2/features-enabled/ido-pgsql.conf ]
then
echo "enable ido pgsql feature"
icinga2-enable-feature ido-pgsql
icinga2 feature enable ido-pgsql
echo "reloading icinga2"
[ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload

View File

@ -6,4 +6,4 @@ _Description: Enable icinga 2 pgsql idoutils?
feature gets enabled for icinga 2.
.
If you want to disable the feature call
icinga2-disable-feature ido-pgsql
icinga2 feature disable ido-pgsql

View File

@ -119,12 +119,12 @@ Icinga 2 installation:
* `notification` for sending notifications
* `mainlog` for writing the `icinga2.log ` file
Verify that by calling `icinga2-enable-feature` without any additional parameters
Verify that by calling `icinga2 feature enable` without any additional parameters
and enable the missing features, if any.
# icinga2-enable-feature
Syntax: icinga2-enable-feature <features separated with whitespaces>
Example: icinga2-enable-feature checker notification mainlog
# icinga2 feature enable
Syntax: icinga2 feature enable <features separated with whitespaces>
Example: icinga2 feature enable checker notification mainlog
Enables the specified feature(s).
Available features: api checker command compatlog debuglog graphite icingastatus ido-mysql ido-pgsql livestatus mainlog notification perfdata statusdata syslog
@ -276,13 +276,14 @@ The `include` directive can be used to include other files.
/**
* The features-available directory contains a number of configuration
* files for features which can be enabled and disabled using the
* icinga2-enable-feature / icinga2-disable-feature tools. These two tools work by creating
* and removing symbolic links in the features-enabled directory.
* icinga2 feature enable / icinga2 feature disable CLI commands.
* These commands work by creating and removing symbolic links in
* the features-enabled directory.
*/
include "features-enabled/*.conf"
This `include` directive takes care of including the configuration files for all
the features which have been enabled with `icinga2-enable-feature`. See
the features which have been enabled with `icinga2 feature enable`. See
[Enabling/Disabling Features](#features) for more details.
/**
@ -670,9 +671,9 @@ The package provides a new configuration file that is installed in
`/etc/icinga2/features-available/ido-mysql.conf`. You will need to update the
database credentials in this file.
You can enable the `ido-mysql` feature configuration file using `icinga2-enable-feature`:
You can enable the `ido-mysql` feature configuration file using `icinga2 feature enable`:
# icinga2-enable-feature ido-mysql
# icinga2 feature enable ido-mysql
Module 'ido-mysql' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.
@ -781,9 +782,9 @@ The package provides a new configuration file that is installed in
`/etc/icinga2/features-available/ido-pgsql.conf`. You will need to update the
database credentials in this file.
You can enable the `ido-pgsql` feature configuration file using `icinga2-enable-feature`:
You can enable the `ido-pgsql` feature configuration file using `icinga2 feature enable`:
# icinga2-enable-feature ido-pgsql
# icinga2 feature enable ido-pgsql
Module 'ido-pgsql' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.
@ -803,9 +804,9 @@ RHEL/CentOS 7 and Fedora 20:
Web interfaces and other Icinga addons are able to send commands to
Icinga 2 through the external command pipe.
You can enable the External Command Pipe using icinga2-enable-feature:
You can enable the External Command Pipe using icinga2 feature enable:
# icinga2-enable-feature command
# icinga2 feature enable command
After that you will have to restart Icinga 2:
@ -853,9 +854,9 @@ Livestatus.
Details on the available tables and attributes with Icinga 2 can be found
in the [Livestatus Schema](#schema-livestatus) section.
You can enable Livestatus using icinga2-enable-feature:
You can enable Livestatus using icinga2 feature enable:
# icinga2-enable-feature livestatus
# icinga2 feature enable livestatus
After that you will have to restart Icinga 2:
@ -884,7 +885,7 @@ In order to use the historical tables provided by the livestatus feature (for ex
are expected to be in `/var/log/icinga2/compat`. A different path can be set using the
`compat_log_path` configuration attribute.
# icinga2-enable-feature compatlog
# icinga2 feature enable compatlog
## <a id="setting-up-icinga2-user-interfaces"></a> Setting up Icinga 2 User Interfaces
@ -978,7 +979,7 @@ Icinga Classic UI requires the [StatusDataWriter](#status-data), [CompatLogger](
and [ExternalCommandListener](#external-commands) features.
Enable these features and restart Icinga 2.
# icinga2-enable-feature statusdata compatlog command
# icinga2 feature enable statusdata compatlog command
In order for commands to work you will need to [setup the external command pipe](#setting-up-external-command-pipe).
@ -1036,7 +1037,7 @@ Example for RHEL and MySQL:
Icinga Web requires the IDO feature as database backend using MySQL or PostgreSQL.
Enable that feature, e.g. for MySQL.
# icinga2-enable-feature ido-mysql
# icinga2 feature enable ido-mysql
If you've changed your default credentials you may either create a read-only user
or use the credentials defined in the IDO feature for Icinga Web backend configuration.
@ -1049,7 +1050,7 @@ found in the [Icinga Web documentation](http://docs.icinga.org/latest/en/icinga-
Additionally you need to enable the `command` feature for sending [external commands](#external-commands):
# icinga2-enable-feature command
# icinga2 feature enable command
In order for commands to work you will need to [setup the external command pipe](#setting-up-external-command-pipe).
@ -1124,12 +1125,12 @@ Icinga Web 2 will support `status.dat`, `DB IDO`, or `Livestatus` as backends.
Using DB IDO as backend, you need to install and configure the [DB IDO backend](#configuring-db-ido).
Once finished, you can enable the feature for DB IDO MySQL:
# icinga2-enable-feature ido-mysql
# icinga2 feature enable ido-mysql
Furthermore [external commands](#external-commands) are supported through the external
command pipe.
# icinga2-enable-feature command
# icinga2 feature enable command
In order for commands to work you will need to [setup the external command pipe](#setting-up-external-command-pipe).
@ -1351,33 +1352,33 @@ is returned.
Icinga 2 provides configuration files for some commonly used features. These
are installed in the `/etc/icinga2/features-available` directory and can be
enabled and disabled using the `icinga2-enable-feature` and `icinga2-disable-feature` tools,
enabled and disabled using the `icinga2 feature enable` and `icinga2 feature disable` tools,
respectively.
The `icinga2-enable-feature` tool creates symlinks in the `/etc/icinga2/features-enabled`
The `icinga2 feature enable` tool creates symlinks in the `/etc/icinga2/features-enabled`
directory which is included by default in the example configuration file.
You can view a list of available feature configuration files:
# icinga2-enable-feature
Syntax: icinga2-enable-feature <feature>
# icinga2 feature enable
Syntax: icinga2 feature enable <feature>
Enables the specified feature.
Available features: statusdata
Using the `icinga2-enable-feature` command you can enable features:
Using the `icinga2 feature enable` command you can enable features:
# icinga2-enable-feature statusdata
# icinga2 feature enable statusdata
Module 'statusdata' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.
You can disable features using the `icinga2-disable-feature` command:
You can disable features using the `icinga2 feature disable` command:
# icinga2-disable-feature statusdata
# icinga2 feature disable statusdata
Module 'statusdata' was disabled.
Make sure to restart Icinga 2 for these changes to take effect.
The `icinga2-enable-feature` and `icinga2-disable-feature` commands do not
The `icinga2 feature enable` and `icinga2 feature disable` commands do not
restart Icinga 2. You will need to restart Icinga 2 using the init script
after enabling or disabling features.

View File

@ -1734,7 +1734,7 @@ through the web interface).
In order to enable the `ExternalCommandListener` configuration use the
following command and restart Icinga 2 afterwards:
# icinga2-enable-feature command
# icinga2 feature enable command
Icinga 2 creates the command pipe file as `/var/run/icinga2/cmd/icinga2.cmd`
using the default configuration.
@ -1766,8 +1766,8 @@ Icinga 2 supports three different types of logging:
* Syslog (on *NIX-based operating systems)
* Console logging (`STDOUT` on tty)
You can enable additional loggers using the `icinga2-enable-feature`
and `icinga2-disable-feature` commands to configure loggers:
You can enable additional loggers using the `icinga2 feature enable`
and `icinga2 feature disable` commands to configure loggers:
Feature | Description
---------|------------
@ -1809,7 +1809,7 @@ runtime vars.
The default templates are already provided with the Icinga 2 feature configuration
which can be enabled using
# icinga2-enable-feature perfdata
# icinga2 feature enable perfdata
By default all performance data files are rotated in a 15 seconds interval into
the `/var/spool/icinga2/perfdata/` directory as `host-perfdata.<timestamp>` and
@ -1826,7 +1826,7 @@ write them to the defined Graphite Carbon daemon tcp socket.
You can enable the feature using
# icinga2-enable-feature graphite
# icinga2 feature enable graphite
By default the `GraphiteWriter` object expects the Graphite Carbon Cache to listen at
`127.0.0.1` on port `2003`.
@ -1893,7 +1893,7 @@ interval to its `objects.cache` and `status.dat` files. Icinga 2 provides
the `StatusDataWriter` object which dumps all configuration objects and
status updates in a regular interval.
# icinga2-enable-feature statusdata
# icinga2 feature enable statusdata
Icinga 1.x Classic UI requires this data set as part of its backend.
@ -1916,7 +1916,7 @@ historical tables.
The `CompatLogger` object can be enabled with
# icinga2-enable-feature compatlog
# icinga2 feature enable compatlog
By default, the Icinga 1.x log file called `icinga.log` is located
in `/var/log/icinga2/compat`. Rotated log files are moved into

View File

@ -330,7 +330,7 @@ A sample config looks like:
You can simply enable the `api` feature using
# icinga2-enable-feature api
# icinga2 feature enable api
Edit `/etc/icinga2/features-enabled/api.conf` if you require the configuration
synchronisation enabled for this node. Set the `accept_config` attribute to `true`.
@ -811,7 +811,7 @@ fails the other nodes will automatically take over the reamining checks.
> If a node should not check anything, disable the `checker` feature explicitely and
> reload Icinga 2.
# icinga2-disable-feature checker
# icinga2 feature disable checker
# service icinga2 reload
#### <a id="high-availability-notifications"></a> High Availability with Notifications
@ -829,7 +829,7 @@ have the DB IDO feature enabled.
Example DB IDO MySQL:
# icinga2-enable-feature ido-mysql
# icinga2 feature enable ido-mysql
The feature 'ido-mysql' is already enabled.
By default the DB IDO feature only runs on the elected zone master. All other passive

View File

@ -1624,7 +1624,7 @@ Example:
Can be enabled/disabled using
# icinga2-enable-feature checker
# icinga2 feature enable checker
### <a id="objecttype-notificationcomponent"></a> NotificationComponent
@ -1646,7 +1646,7 @@ Attributes:
Can be enabled/disabled using
# icinga2-enable-feature notification
# icinga2 feature enable notification
### <a id="objecttype-filelogger"></a> FileLogger

View File

@ -23,7 +23,7 @@ log severity as an additional parameter argument to `-x`.
Additionally you can enable the debug log using
# icinga2-enable-feature debuglog
# icinga2 feature enable debuglog
# service icinga2 restart
# tail -f /var/log/icinga2/debug.log
@ -59,7 +59,7 @@ Examples:
# sudo -u icinga /usr/lib/nagios/plugins/check_ping -4 -H 127.0.0.1 -c 5000,100% -w 3000,80%
# icinga2-enable-feature checker
# icinga2 feature enable checker
The feature 'checker' is already enabled.
@ -80,7 +80,7 @@ Verify the following configuration
Examples:
# icinga2-enable-feature notification
# icinga2 feature enable notification
The feature 'notification' is already enabled.
## <a id="feature-not-working"></a> Feature is not working

View File

@ -19,7 +19,7 @@ file(GLOB DOCSRCS "*.md")
if(UNIX OR CYGWIN)
install(
FILES icinga2.8 icinga2-enable-feature.8 icinga2-disable-feature.8 icinga2-build-ca.8 icinga2-build-key.8 icinga2-sign-key.8 icinga2-prepare-dirs.8
FILES icinga2.8 icinga2-build-ca.8 icinga2-build-key.8 icinga2-sign-key.8 icinga2-prepare-dirs.8
DESTINATION ${CMAKE_INSTALL_MANDIR}/man8
)
endif()

View File

@ -1,32 +0,0 @@
.TH ICINGA2 "8" "June 2014" "icinga2 - The Icinga 2 network monitoring daemon." "System Administration Utilities"
.SH NAME
icinga2-enable-feature \- Enable Icinga 2 features.
.SH DESCRIPTION
icinga2-enable-feature \- Enable Icinga 2 features.
.SH OPTIONS
.TP
\fB<features>\fR
Whitespace separated list of Icinga 2 features to be disable
.SH FILES
.TP
.IP /etc/icinga2/features-available
Configuration directory for available Icinga2 features
.SH AUTHOR
Icinga2 is maintained by the Icinga Project <info@icinga.org>.
.SH "REPORTING BUGS"
Report bugs at <https://dev.icinga.org/>
.br
Icinga home page: <http://www.icinga.org/>
.SH COPYRIGHT
Copyright \(co 2012\-2014 Icinga Development Team (http://www.icinga.org)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

View File

@ -1,32 +0,0 @@
.TH ICINGA2 "8" "June 2014" "icinga2 - The Icinga 2 network monitoring daemon." "System Administration Utilities"
.SH NAME
icinga2-enable-feature \- Enable Icinga 2 features.
.SH DESCRIPTION
icinga2-enable-feature \- Enable Icinga 2 features.
.SH OPTIONS
.TP
\fB<features>\fR
Whitespace separated list of Icinga 2 features to be enabled
.SH FILES
.TP
.IP /etc/icinga2/features-available
Configuration directory for available Icinga2 features
.SH AUTHOR
Icinga2 is maintained by the Icinga Project <info@icinga.org>.
.SH "REPORTING BUGS"
Report bugs at <https://dev.icinga.org/>
.br
Icinga home page: <http://www.icinga.org/>
.SH COPYRIGHT
Copyright \(co 2012\-2014 Icinga Development Team (http://www.icinga.org)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

View File

@ -29,8 +29,9 @@ include <plugins>
/**
* The features-available directory contains a number of configuration
* files for features which can be enabled and disabled using the
* icinga2-enable-feature / icinga2-disable-feature tools. These two tools work by creating
* and removing symbolic links in the features-enabled directory.
* icinga2 feature enable / icinga2 feature disable CLI commands.
* These commands work by creating and removing symbolic links in
* the features-enabled directory.
*/
include "features-enabled/*.conf"

View File

@ -295,7 +295,7 @@ exit 0
%endif
# initial installation, enable default features
%{_sbindir}/icinga2-enable-feature checker notification mainlog
%{_sbindir}/icinga2 feature enable checker notification mainlog
exit 0
@ -311,7 +311,7 @@ exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable default features
%{_sbindir}/icinga2-enable-feature checker notification mainlog
%{_sbindir}/icinga2 feature enable checker notification mainlog
fi
exit 0
@ -383,7 +383,7 @@ exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable ido-mysql feature
%{_sbindir}/icinga2-enable-feature ido-mysql
%{_sbindir}/icinga2 feature enable ido-mysql
fi
exit 0
@ -391,7 +391,7 @@ exit 0
%postun ido-mysql
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
test -x %{_sbindir}/icinga2 feature disable && %{_sbindir}/icinga2 feature disable ido-mysql
fi
exit 0
@ -400,7 +400,7 @@ exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable ido-pgsql feature
%{_sbindir}/icinga2-enable-feature ido-pgsql
%{_sbindir}/icinga2 feature enable ido-pgsql
fi
exit 0
@ -408,7 +408,7 @@ exit 0
%postun ido-pgsql
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
test -x %{_sbindir}/icinga2 feature disable && %{_sbindir}/icinga2 feature disable ido-pgsql
fi
exit 0
@ -417,7 +417,7 @@ exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable features
%{_sbindir}/icinga2-enable-feature statusdata compatlog command
%{_sbindir}/icinga2 feature enable statusdata compatlog command
fi
exit 0
@ -425,9 +425,9 @@ exit 0
%postun classicui-config
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
test -x %{_sbindir}/icinga2 feature disable && %{_sbindir}/icinga2 feature disable statusdata
test -x %{_sbindir}/icinga2 feature disable && %{_sbindir}/icinga2 feature disable compatlog
test -x %{_sbindir}/icinga2 feature disable && %{_sbindir}/icinga2 feature disable command
fi
exit 0
@ -472,8 +472,6 @@ exit 0
%{_bindir}/%{name}-build-key
%{_bindir}/%{name}-sign-key
%{_sbindir}/%{name}-list-objects
%{_sbindir}/%{name}-enable-feature
%{_sbindir}/%{name}-disable-feature
%{_sbindir}/%{name}-setup-agent
%{_sbindir}/%{name}-discover-agent
%{_sbindir}/%{name}-forget-agent
@ -485,8 +483,7 @@ exit 0
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/include
%{_mandir}/man8/%{name}.8.gz
%{_mandir}/man8/%{name}-enable-feature.8.gz
%{_mandir}/man8/%{name}-disable-feature.8.gz
%{_mandir}/man8/%{name}-feature enable.8.gz
%{_mandir}/man8/%{name}-build-ca.8.gz
%{_mandir}/man8/%{name}-build-key.8.gz
%{_mandir}/man8/%{name}-sign-key.8.gz

View File

@ -4,7 +4,7 @@ livestatus_path="/var/run/icinga2/cmd/livestatus"
if [ ! -e $livestatus_path ];
then
sudo icinga2-enable-feature livestatus 1> /dev/null
sudo icinga2-feature enable livestatus 1> /dev/null
sudo service icinga2 restart 1> /dev/null
sleep 1

View File

@ -5,7 +5,7 @@ objectscache_path="/var/cache/icinga2/objects.cache"
if [ ! -f $statusdata_path ];
then
sudo icinga2-enable-feature statusdata 1> /dev/null
sudo icinga2-feature enable statusdata 1> /dev/null
sudo service icinga2 restart 1> /dev/null
n=0

View File

@ -18,15 +18,3 @@
add_subdirectory(mkclass)
add_subdirectory(mkembedconfig)
add_subdirectory(mkunity)
if(UNIX OR CYGWIN)
configure_file(icinga2-enable-feature.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga2-enable-feature @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/icinga2-enable-feature
DESTINATION ${CMAKE_INSTALL_SBINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ./icinga2-enable-feature \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_SBINDIR}/icinga2-disable-feature\")")
endif()

View File

@ -1,91 +0,0 @@
#!/bin/sh
ICINGA2CONFDIR=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2
TOOL=$(basename -- $0)
if [ "$TOOL" != "icinga2-enable-feature" -a "$TOOL" != "icinga2-disable-feature" ]; then
echo "Invalid tool name ($TOOL). Should be 'icinga2-enable-feature' or 'icinga2-disable-feature'."
exit 1
fi
if [ -z "$1" ]; then
echo "Syntax: $TOOL <features separated with whitespaces>"
echo " Example: $TOOL checker notification mainlog"
if [ "$TOOL" = "icinga2-enable-feature" ]; then
echo "Enables the specified feature(s)."
else
echo "Disables the specified feature(s)."
fi
echo
echo -n "Available features: "
for file in $ICINGA2CONFDIR/features-available/*.conf; do
echo -n "$(basename -- $file .conf) "
done
echo
echo -n "Enabled features: "
for file in $ICINGA2CONFDIR/features-enabled/*.conf; do
echo -n "$(basename -- $file .conf) "
done
echo
exit 1
fi
FEATURES=$1
for FEATURES
do
SKIP=""
# Define array var
# Based http://blog.isonoe.net/post/2010/09/24/Pseudo-arrays-for-POSIX-shell
eval "set -- $FEATURES"
for FEATURE
do
SKIP="NOTOK"
if [ ! -e $ICINGA2CONFDIR/features-available/$FEATURE.conf ]; then
echo "Feature '$FEATURE' does not exist."
exit 1
fi
if [ "$TOOL" = "icinga2-enable-feature" ]; then
if [ -e $ICINGA2CONFDIR/features-enabled/$FEATURE.conf ]; then
echo "The feature '$FEATURE' is already enabled."
SKIP="OK"
fi
if [ "$SKIP" != "OK" ]; then
if ! ln -s ../features-available/$FEATURE.conf $ICINGA2CONFDIR/features-enabled/; then
echo "Enabling '$FEATURE' failed. Check permissions for $ICINGA2CONFDIR/features-enabled/"
exit 1
else
echo "Module '$FEATURE' has been enabled."
RELOAD="YES"
fi
fi
elif [ "$TOOL" = "icinga2-disable-feature" ]; then
if [ ! -e $ICINGA2CONFDIR/features-enabled/$FEATURE.conf ]; then
echo "The feature '$FEATURE' is already disabled."
SKIP="OK"
fi
if [ "$SKIP" != "OK" ]; then
if ! rm -f $ICINGA2CONFDIR/features-enabled/$FEATURE.conf; then
echo "Disabling '$FEATURE' failed. Check permissions for $ICINGA2CONFDIR/features-enabled/$FEATURE.conf"
exit 1
else
echo "Feature '$FEATURE' has been disabled."
RELOAD="YES"
fi
fi
fi
done
done
if [ "$RELOAD" = "YES" ]; then
echo "Make sure to restart Icinga 2 for these changes to take effect."
fi
exit 0