Icinga2 Hierarchie: Unterschied zwischen den Versionen
David (Diskussion | Beiträge) Die Seite wurde neu angelegt: „=Test Aufbau:= ==Ziehl== *2 icinga systeme (oder mehr) die verschieden bereiche getrent überwachen sollen und ihre auswertungen an den master server senden =…“ |
|||
| (9 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
=Test Aufbau:= | =Test Aufbau:= | ||
== | ==Ziel== | ||
*2 icinga | *2 icinga Systeme (oder mehr) die verschieden bereiche getrennt überwachen sollen und ihre auswertungen an den master server senden | ||
==Rechner== | ==Rechner== | ||
| Zeile 17: | Zeile 17: | ||
=Installation= | =Installation= | ||
==icinga admin installieren== | ==icinga admin installieren== | ||
===packet | ===packet Installation=== | ||
*debian | *debian | ||
unter debian repositorys hinzufügen | unter debian repositorys hinzufügen | ||
| Zeile 27: | Zeile 27: | ||
apt install software-properties-common | apt install software-properties-common | ||
add-apt-repository ppa:formorer/icinga | add-apt-repository ppa:formorer/icinga | ||
* | *installieren | ||
apt-get update | apt-get update | ||
apt-get upgrade | apt-get upgrade | ||
| Zeile 38: | Zeile 38: | ||
*beschrieben wird nur icinga right für alle zusätlichen systeme muss genauso vorgegangen werden | *beschrieben wird nur icinga right für alle zusätlichen systeme muss genauso vorgegangen werden | ||
*wir benutzen auf left Debian 8 & right Ubuntu 16.04 | *wir benutzen auf left Debian 8 & right Ubuntu 16.04 | ||
===packet | ===packet Installation=== | ||
*debian | *debian | ||
unter debian repositorys hinzufügen | unter debian repositorys hinzufügen | ||
| Zeile 57: | Zeile 57: | ||
https://xinux.net/index.php/Icinga-web_ubuntu_16.04 | https://xinux.net/index.php/Icinga-web_ubuntu_16.04 | ||
==icinga right-1 installieren== | ==icinga right-1 installieren== | ||
*beschrieben wird nur icinga right-1 für alle | *beschrieben wird nur icinga right-1 für alle zusätzliche Systeme muss genauso vorgegangen werden | ||
===packet installatieren=== | ===packet installatieren=== | ||
*debian | *debian | ||
| Zeile 68: | Zeile 68: | ||
apt install software-properties-common | apt install software-properties-common | ||
add-apt-repository ppa:formorer/icinga | add-apt-repository ppa:formorer/icinga | ||
* | *installieren | ||
apt-get update | apt-get update | ||
apt-get upgrade | apt-get upgrade | ||
apt-get install icinga2 | apt-get install icinga2 | ||
==Zertifikate== | ==Zertifikate== | ||
*nach dem alle system | *nach dem alle system installiert wurden am besten die Zertifikate direkt angehen | ||
*auf der cert authority für jeden host ein Zertifikate | *auf der cert authority für jeden host ein Zertifikate generieren | ||
*dann auf die Zertifikate auf die hosts kopieren mit scp in den ordner /etc/icinga2/pki | *dann auf die Zertifikate auf die hosts kopieren mit scp in den ordner /etc/icinga2/pki | ||
*darauf achten das die hostname & Endpoint | *darauf achten das die hostname & Endpoint Name mit den Zertifikate übereinstimmen | ||
=Konfiguration= | =Konfiguration= | ||
| Zeile 106: | Zeile 106: | ||
object Zone "icinga-admin.xinux.org" { | object Zone "icinga-admin.xinux.org" { | ||
endpoints = [ "icinga-admin.xinux.org" ] | endpoints = [ "icinga-admin.xinux.org" ] | ||
} | } | ||
</pre> | </pre> | ||
===Health-check erstellen=== | ===Health-check erstellen (optional)=== | ||
vi /etc/icinga2/cluster/icinga-admin.conf | vi /etc/icinga2/cluster/icinga-admin.conf | ||
| Zeile 182: | Zeile 173: | ||
</pre> | </pre> | ||
===Neue | ===Neue Konfiguration anwenden=== | ||
/etc/icinga2/icinga2.conf | /etc/icinga2/icinga2.conf | ||
<pre> | <pre> | ||
include_recursive "conf.d" | |||
include_recursive "cluster" | include_recursive "cluster" | ||
</pre> | </pre> | ||
===icinga state kopieren=== | |||
===icinga state | |||
scp /var/lib/icinga2/icinga2.state root@icinga-left.xinux.org:/var/lib/icinga2 | scp /var/lib/icinga2/icinga2.state root@icinga-left.xinux.org:/var/lib/icinga2 | ||
scp /var/lib/icinga2/icinga2.state root@icinga-right.xinux.org:/var/lib/icinga2 | scp /var/lib/icinga2/icinga2.state root@icinga-right.xinux.org:/var/lib/icinga2 | ||
===Icinga neue hosts übernehmen=== | ===Icinga neue hosts übernehmen=== | ||
* in der | * in der nodeliste müssten die neuen nodes schon angezeigt werden (sofern sie schon online sind) | ||
icinga2 node list | icinga2 node list | ||
* mit node update-config werden die entsprechenden | * mit node update-config werden die entsprechenden Einträge in repository.d angelegt | ||
icinga2 node update-config | icinga2 node update-config | ||
* nach einem reload werden die nodes auch im webinterface | * nach einem reload werden die nodes auch im webinterface übernommen | ||
service icinga2 reload | service icinga2 reload | ||
==icinga right konfigurieren== | ==icinga right konfigurieren== | ||
*icinga left entsprechend anpassen | *icinga left entsprechend anpassen | ||
===api anpassen=== | |||
api conf bearbeiten | |||
vi features-available/api.conf | |||
<pre> | |||
/** | |||
* The API listener is used for distributed monitoring setups. | |||
*/ | |||
object ApiListener "api" { | |||
cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt" | |||
key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key" | |||
ca_path = SysconfDir + "/icinga2/pki/ca.crt" | |||
accept_config = true | |||
accept_commands = true | |||
ticket_salt = TicketSalt | |||
} | |||
</pre> | |||
api conf aktivieren | |||
ln ./features-available/api.conf ./features-enabled/ | |||
===Zone & Namen definieren=== | ===Zone & Namen definieren=== | ||
/etc/icinga2/constants.conf | /etc/icinga2/constants.conf | ||
| Zeile 238: | Zeile 247: | ||
endpoints = [ "icinga-right.xinux.org" ] | endpoints = [ "icinga-right.xinux.org" ] | ||
parent = "master" | parent = "master" | ||
} | } | ||
</pre> | </pre> | ||
===Health-check erstellen=== | ===Health-check erstellen (optional)=== | ||
<pre> | <pre> | ||
| Zeile 269: | Zeile 269: | ||
</pre> | </pre> | ||
=== | ===Konfiguration anwenden=== | ||
sicherstellen das die neue | sicherstellen das die neue Konfiguration benutzt wird | ||
/etc/icinga2/icinga2.conf | /etc/icinga2/icinga2.conf | ||
<pre> | <pre> | ||
include_recursive "conf.d" | |||
include_recursive "cluster" | include_recursive "cluster" | ||
</pre> | </pre> | ||
===Icinga neue hosts übernehmen=== | ===Icinga neue hosts übernehmen=== | ||
* in der | * in der nodeliste müssten die neuen nodes schon angezeigt werden (sofern sie schon online sind) | ||
icinga2 node list | icinga2 node list | ||
* mit node update-config werden die entsprechenden | * mit node update-config werden die entsprechenden Einträge in repository.d angelegt | ||
icinga2 node update-config | icinga2 node update-config | ||
* nach einem reload werden die nodes auch im webinterface | * nach einem reload werden die nodes auch im webinterface übernommen | ||
service icinga2 reload | service icinga2 reload | ||
==icinga-right-1 Konfigurieren== | ==icinga-right-1 Konfigurieren== | ||
===api anpassen=== | |||
api conf bearbeiten | |||
vi features-available/api.conf | |||
<pre> | |||
/** | |||
* The API listener is used for distributed monitoring setups. | |||
*/ | |||
object ApiListener "api" { | |||
cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt" | |||
key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key" | |||
ca_path = SysconfDir + "/icinga2/pki/ca.crt" | |||
accept_config = true | |||
accept_commands = true | |||
ticket_salt = TicketSalt | |||
} | |||
</pre> | |||
api conf aktiviren | |||
ln ./features-available/api.conf ./features-enabled/ | |||
===Zone & Namen definieren=== | ===Zone & Namen definieren=== | ||
| Zeile 293: | Zeile 317: | ||
===Zone anlegen=== | ===Zone anlegen=== | ||
*die | *die Zonen anlegen | ||
/etc/icinga2/zones.conf | /etc/icinga2/zones.conf | ||
<pre> | <pre> | ||
| Zeile 327: | Zeile 351: | ||
tail -f /var/log/icinga2/icinga2.log | tail -f /var/log/icinga2/icinga2.log | ||
tail -f /var/log/icinga2/startup.log | tail -f /var/log/icinga2/startup.log | ||
*löschen des chache ordners | |||
rm -r /var/lib/icinga2/api/zones/* | |||
*debguen | |||
icinga2 feature enable debuglog | |||
service icinga2 restart | |||
tail -f /var/log/icinga2/debug.log | |||
==Troubleshooting== | |||
*Falls ein "icinga2 node list" die gewünschte Aufstellung anzeigt, die Rechner aber im Webinterface als "Down" gelistet werden müssen folgende Befehle ausgeführt werden: | |||
<pre> | |||
rm -r /etc/icinga2/repository.d/endpoints /etc/icinga2/repository.d/hosts /etc/icinga2/repository.d/zones | |||
icinga2 node update-config | |||
systemctl restart icinga2.service | |||
</pre> | |||
==links== | ==links== | ||
https://wiki.icinga.org/display/howtos/Icinga2+Distributed+Cluster+Install+with+CentOS+6 | https://wiki.icinga.org/display/howtos/Icinga2+Distributed+Cluster+Install+with+CentOS+6 | ||
Aktuelle Version vom 18. Januar 2019, 11:17 Uhr
Test Aufbau:
Ziel
- 2 icinga Systeme (oder mehr) die verschieden bereiche getrennt überwachen sollen und ihre auswertungen an den master server senden
Rechner
icinga-admin 192.168.241.161 icinga-left 192.168.241.162 icinga-right 192.168.241.163 icinga-left-1 192.168.241.164 icinga-left-2 192.168.241.165 icinga-right-1 192.168.241.166 icinga-right-2 192.168.241.167
Plan
Installation
icinga admin installieren
packet Installation
- debian
unter debian repositorys hinzufügen
wget -O - http://debmon.org/debmon/repo.key 2>/dev/null | apt-key add - echo 'deb http://debmon.org/debmon debmon-jessie main' >/etc/apt/sources.list.d/debmon.list apt-get update
- ubuntu
unter ubuntu repositorys hinzufügen
apt install software-properties-common add-apt-repository ppa:formorer/icinga
- installieren
apt-get update apt-get upgrade apt-get install icinga2
icinga2 web
- icinga2 web aufsetzen
https://xinux.net/index.php/Icinga-web_ubuntu_16.04
icinga right installieren
- beschrieben wird nur icinga right für alle zusätlichen systeme muss genauso vorgegangen werden
- wir benutzen auf left Debian 8 & right Ubuntu 16.04
packet Installation
- debian
unter debian repositorys hinzufügen
wget -O - http://debmon.org/debmon/repo.key 2>/dev/null | apt-key add - echo 'deb http://debmon.org/debmon debmon-jessie main' >/etc/apt/sources.list.d/debmon.list apt-get update
- ubuntu
unter ubuntu repositorys hinzufügen
apt install software-properties-common add-apt-repository ppa:formorer/icinga
- installiern
apt-get update apt-get upgrade apt-get install icinga2
icinga2 web
- icinga2 web aufsetzen
https://xinux.net/index.php/Icinga-web_ubuntu_16.04
icinga right-1 installieren
- beschrieben wird nur icinga right-1 für alle zusätzliche Systeme muss genauso vorgegangen werden
packet installatieren
- debian
unter debian repositorys hinzufügen
wget -O - http://debmon.org/debmon/repo.key 2>/dev/null | apt-key add - echo 'deb http://debmon.org/debmon debmon-jessie main' >/etc/apt/sources.list.d/debmon.list apt-get update
- ubuntu
unter ubuntu repositorys hinzufügen
apt install software-properties-common add-apt-repository ppa:formorer/icinga
- installieren
apt-get update apt-get upgrade apt-get install icinga2
Zertifikate
- nach dem alle system installiert wurden am besten die Zertifikate direkt angehen
- auf der cert authority für jeden host ein Zertifikate generieren
- dann auf die Zertifikate auf die hosts kopieren mit scp in den ordner /etc/icinga2/pki
- darauf achten das die hostname & Endpoint Name mit den Zertifikate übereinstimmen
Konfiguration
icinga Master Konfiguration
unser name & zone:
- Node Name = icinga-admin.xinux.org
- Zone Name = icinga-admin.xinux.org
zone name:
- icinga-admin.xinux.org = icinga-admin.xinux.org
- icinga-left.xinux.org = icinga-left.xinux.org
- icinga-right.xinux.org = icinga-right.xinux.org
Zone & Namen definieren
/etc/icinga2/constants.conf
const NodeName = "icinga-admin.xinux.org" const ZoneName = "icinga-admin.xinux.org"
Zone anlegen
- die zonen des masters anlegen
/etc/icinga2/zones.conf
object Endpoint "icinga-admin.xinux.org" {
host = "icinga-admin.xinux.org"
}
object Zone "icinga-admin.xinux.org" {
endpoints = [ "icinga-admin.xinux.org" ]
}
Health-check erstellen (optional)
vi /etc/icinga2/cluster/icinga-admin.conf
/*
* cluster health checks
* icinga-admin as master node [x]
* icinga-left as a Satellite node
* icinga-right as a Satellite node
*/
object Host "icinga-admin" {
display_name = "Health Checks on icinga-admin"
address = "icinga-admin.xinux.org"
check_command = "hostalive"
}
object Host "icinga-left" {
display_name = "icinga-left"
address = "icinga-left.xinux.org"
check_command = "hostalive"
}
object Host "icinga-right" {
display_name = "icinga-right"
address = "icinga-right.xinux.org"
check_command = "hostalive"
}
object Service "cluster" {
check_command = "cluster"
check_interval = 5s
retry_interval = 1s
host_name = "icinga-admin"
}
object Service "icinga" {
check_command = "icinga"
max_check_attempts = 3
check_interval = 60s
retry_interval = 30s
host_name = "icinga-admin"
}
/* check if checker zone is connected */
object Service "cluster-zone-checker" {
check_command = "cluster-zone"
check_interval = 5s
retry_interval = 1s
vars.cluster_zone = "icinga-left"
host_name = "icinga-admin"
}
/* check if checker zone is connected */
object Service "cluster-zone-icinga-right" {
check_command = "cluster-zone"
check_interval = 5s
retry_interval = 1s
vars.cluster_zone = "icinga-right"
host_name = "icinga-admin"
}
Neue Konfiguration anwenden
/etc/icinga2/icinga2.conf
include_recursive "conf.d" include_recursive "cluster"
icinga state kopieren
scp /var/lib/icinga2/icinga2.state root@icinga-left.xinux.org:/var/lib/icinga2 scp /var/lib/icinga2/icinga2.state root@icinga-right.xinux.org:/var/lib/icinga2
Icinga neue hosts übernehmen
- in der nodeliste müssten die neuen nodes schon angezeigt werden (sofern sie schon online sind)
icinga2 node list
- mit node update-config werden die entsprechenden Einträge in repository.d angelegt
icinga2 node update-config
- nach einem reload werden die nodes auch im webinterface übernommen
service icinga2 reload
icinga right konfigurieren
- icinga left entsprechend anpassen
api anpassen
api conf bearbeiten
vi features-available/api.conf
/**
* The API listener is used for distributed monitoring setups.
*/
object ApiListener "api" {
cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt"
key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"
ca_path = SysconfDir + "/icinga2/pki/ca.crt"
accept_config = true
accept_commands = true
ticket_salt = TicketSalt
}
api conf aktivieren
ln ./features-available/api.conf ./features-enabled/
Zone & Namen definieren
/etc/icinga2/constants.conf
const NodeName = "icinga-right.xinux.org" const ZoneName = "icinga-right.xinux.org"
Zonen anlegen
/etc/icinga2/zones.conf
/*
* Generated by Icinga 2 node setup commands
* on 2016-07-04 09:14:01 +0000
*/
object Endpoint "icinga-admin.xinux.org" {
host = "icinga-admin.xinux.org"
port = "5665"
}
object Zone "master" {
endpoints = [ "icinga-admin.xinux.org" ]
}
object Endpoint "icinga-right.xinux.org" {
}
object Zone "icinga-right.xinux.org" {
//this is the local node = "icinga-right.xinux.org"
endpoints = [ "icinga-right.xinux.org" ]
parent = "master"
}
Health-check erstellen (optional)
mkdir /etc/icinga2/cluster
vi /etc/icinga2/cluster/icinga-right.conf
object Host "icinga-right" {
display_name = "Health Checks on icinga-right"
address = "icinga-right.xinux.org"
check_command = "hostalive"
}
object Service "cluster" {
check_command = "cluster"
check_interval = 5s
retry_interval = 1s
host_name = "icinga-right"
}
Konfiguration anwenden
sicherstellen das die neue Konfiguration benutzt wird /etc/icinga2/icinga2.conf
include_recursive "conf.d" include_recursive "cluster"
Icinga neue hosts übernehmen
- in der nodeliste müssten die neuen nodes schon angezeigt werden (sofern sie schon online sind)
icinga2 node list
- mit node update-config werden die entsprechenden Einträge in repository.d angelegt
icinga2 node update-config
- nach einem reload werden die nodes auch im webinterface übernommen
service icinga2 reload
icinga-right-1 Konfigurieren
api anpassen
api conf bearbeiten
vi features-available/api.conf
/**
* The API listener is used for distributed monitoring setups.
*/
object ApiListener "api" {
cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt"
key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"
ca_path = SysconfDir + "/icinga2/pki/ca.crt"
accept_config = true
accept_commands = true
ticket_salt = TicketSalt
}
api conf aktiviren
ln ./features-available/api.conf ./features-enabled/
Zone & Namen definieren
/etc/icinga2/constants.conf
const ZoneName = "icinga-right-1.xinux.org" const NodeName = "icinga-right-1.xinux.org"
Zone anlegen
- die Zonen anlegen
/etc/icinga2/zones.conf
/*
* Generated by Icinga 2 node setup commands
* on 2016-07-04 13:28:43 +0000
*/
object Endpoint "icinga-right.xinux.org" {
host = "icinga-right.xinux.org"
port = "5665"
}
object Zone "master" {
endpoints = [ "icinga-right.xinux.org" ]
}
object Endpoint NodeName {
}
object Zone ZoneName {
endpoints = [ NodeName ]
parent = "master"
}
icinga neustarten
service icinga restart
Nütziches
Debuging
tail -f /var/log/icinga2/icinga2.log tail -f /var/log/icinga2/startup.log
- löschen des chache ordners
rm -r /var/lib/icinga2/api/zones/*
- debguen
icinga2 feature enable debuglog service icinga2 restart tail -f /var/log/icinga2/debug.log
Troubleshooting
- Falls ein "icinga2 node list" die gewünschte Aufstellung anzeigt, die Rechner aber im Webinterface als "Down" gelistet werden müssen folgende Befehle ausgeführt werden:
rm -r /etc/icinga2/repository.d/endpoints /etc/icinga2/repository.d/hosts /etc/icinga2/repository.d/zones icinga2 node update-config systemctl restart icinga2.service
links
https://wiki.icinga.org/display/howtos/Icinga2+Distributed+Cluster+Install+with+CentOS+6