From 87cead02ed529700f159d06a62b304b0215b1128 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 13 Apr 2014 17:32:38 +0200 Subject: [PATCH] Split localhost config into several files. Refs #6002 --- etc/CMakeLists.txt | 11 +++- etc/icinga2/conf.d/hosts/localhost.conf | 11 ++++ etc/icinga2/conf.d/localhost.conf | 81 ------------------------- pki/icinga2-setup-agent.cmake | 19 +++--- 4 files changed, 31 insertions(+), 91 deletions(-) create mode 100644 etc/icinga2/conf.d/hosts/localhost.conf delete mode 100644 etc/icinga2/conf.d/localhost.conf diff --git a/etc/CMakeLists.txt b/etc/CMakeLists.txt index e0ace12cf..529dddb96 100644 --- a/etc/CMakeLists.txt +++ b/etc/CMakeLists.txt @@ -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) diff --git a/etc/icinga2/conf.d/hosts/localhost.conf b/etc/icinga2/conf.d/hosts/localhost.conf new file mode 100644 index 000000000..49e192606 --- /dev/null +++ b/etc/icinga2/conf.d/hosts/localhost.conf @@ -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" +} diff --git a/etc/icinga2/conf.d/localhost.conf b/etc/icinga2/conf.d/localhost.conf deleted file mode 100644 index 8b5d9e0d1..000000000 --- a/etc/icinga2/conf.d/localhost.conf +++ /dev/null @@ -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" -} diff --git a/pki/icinga2-setup-agent.cmake b/pki/icinga2-setup-agent.cmake index cc296c9d3..ffc6b124e 100644 --- a/pki/icinga2-setup-agent.cmake +++ b/pki/icinga2-setup-agent.cmake @@ -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 <>$ICINGA2CONFIG/features-available/agent.conf <>$ICINGA2CONFIG/features-available/agent.conf <