Split localhost config into several files.

Refs #6002
This commit is contained in:
Gunnar Beutner 2014-04-13 17:32:38 +02:00
parent 44193f341e
commit 87cead02ed
4 changed files with 31 additions and 91 deletions

View File

@ -27,7 +27,16 @@ install_if_not_exists(icinga2/conf.d/generic-host.conf ${CMAKE_INSTALL_SYSCONFDI
install_if_not_exists(icinga2/conf.d/generic-service.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/generic-user.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/groups.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/localhost.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/hosts/localhost.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts)
install_if_not_exists(icinga2/conf.d/hosts/localhost/disk.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/http.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/icinga.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/kernel.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/load.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/processes.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/ssh.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/swap.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/hosts/localhost/users.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d/hosts/localhost)
install_if_not_exists(icinga2/conf.d/notifications.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/timeperiods.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)
install_if_not_exists(icinga2/conf.d/users.conf ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/conf.d)

View File

@ -0,0 +1,11 @@
/**
* A host definition. You can create your own configuration files
* in the conf.d directory (e.g. one per host). By default all *.conf
* files in this directory are included.
*/
object Host "localhost" {
import "linux-server"
address = "127.0.0.1"
address6 = "::1"
}

View File

@ -1,81 +0,0 @@
/**
* A host definition. You can create your own configuration files
* in the conf.d directory (e.g. one per host). By default all *.conf
* files in this directory are included.
*/
object Host "localhost" {
import "linux-server"
address = "127.0.0.1"
address6 = "::1"
}
object Service "icinga" {
import "generic-service"
host_name = "localhost"
check_command = "icinga"
}
object Service "http" {
import "generic-service"
host_name = "localhost"
check_command = "http_ip"
}
object Service "ssh" {
import "generic-service"
host_name = "localhost"
check_command = "ssh"
}
object Service "load" {
import "generic-service"
host_name = "localhost"
check_command = "load"
}
object ScheduledDowntime "backup-downtime" {
import "backup-downtime"
host_name = "localhost"
service_name = "load"
}
object Service "processes" {
import "generic-service"
host_name = "localhost"
check_command = "processes"
}
object Service "users" {
import "generic-service"
host_name = "localhost"
check_command = "users"
}
object Service "disk" {
import "generic-service"
host_name = "localhost"
check_command = "disk"
}
object Service "swap" {
import "generic-service"
host_name = "localhost"
check_command = "swap"
}
object Service "kernel" {
import "generic-service"
host_name = "localhost"
check_command = "kernel"
}

View File

@ -40,7 +40,7 @@ if [ -n "$1" ]; then
if [ "$master" = "n" ]; then
while true; do
echo -n "Upstream Icinga instance name: "
echo -n "Master Icinga instance name: "
if ! read upstream_name; then
exit 1
fi
@ -91,7 +91,7 @@ if [ -n "$1" ]; then
if [ "$master" = "n" ]; then
while true; do
echo -n "Do you want this agent instance to connect to the upstream instance? [y] "
echo -n "Do you want this agent instance to connect to the master instance? [y] "
if ! read upstream_connect; then
exit 1
fi
@ -109,7 +109,7 @@ if [ -n "$1" ]; then
if [ "$upstream_connect" = "y" ]; then
while true; do
echo -n "Upstream IP address/hostname: "
echo -n "Master instance IP address/hostname: "
if ! read upstream_host; then
exit 1
fi
@ -118,11 +118,11 @@ if [ -n "$1" ]; then
break
fi
echo "Please enter the upstream instance's hostname."
echo "Please enter the master instance's hostname."
done
while true; do
echo -n "Upstream port: "
echo -n "Master instace port: "
if ! read upstream_port; then
exit 1
fi
@ -131,7 +131,7 @@ if [ -n "$1" ]; then
break
fi
echo "Please enter the upstream instance's port."
echo "Please enter the master instance's port."
done
fi
fi
@ -157,14 +157,12 @@ AGENT
if [ "$master" = "n" ]; then
cat >>$ICINGA2CONFIG/features-available/agent.conf <<AGENT
upstream_name = "$upstream_name"
AGENT
fi
if [ "$listener" = "y" ]; then
cat >>$ICINGA2CONFIG/features-available/agent.conf <<AGENT
bind_port = "$listener_port"
AGENT
fi
@ -172,7 +170,6 @@ AGENT
cat >>$ICINGA2CONFIG/features-available/agent.conf <<AGENT
upstream_host = "$upstream_host"
upstream_port = "$upstream_port"
AGENT
fi
@ -183,6 +180,10 @@ AGENT
echo "Enabling agent feature..."
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-enable-feature agent
if [ ! -e "@CMAKE_INSTALL_FULL_SYSCONFDIR@/monitoring" ]; then
ln -s $ICINGA2CONFIG/conf.d/hosts/localhost @CMAKE_INSTALL_FULL_SYSCONFDIR@/monitoring
fi
if [ "$master" = "n" ]; then
echo "Disabling notification feature..."
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-disable-feature notification