Inhoud
Introductie
De ProxMox VM helmstok bevat de CheckMK POC en heet zo omdat je je eraan vast kunt houden.
CheckMK Server
Installatie
Handleidingen:
michelle@helmstok:~$ sudo apt install ./check-mk-raw-2.3.0p27_0.bookworm_amd64.deb [sudo] wachtwoord voor michelle: Pakketlijsten worden ingelezen... Klaar Boom van vereisten wordt opgebouwd... Klaar De statusinformatie wordt gelezen... Klaar Let op, 'check-mk-raw-2.3.0p27' wordt geselecteerd in plaats van './check-mk-raw-2.3.0p27_0.bookworm_amd64.deb' De volgende extra pakketten zullen geïnstalleerd worden: apache2 apache2-bin apache2-data apache2-utils bc curl debugedit dialog dirmngr fontconfig fontconfig-config fonts-dejavu-core fonts-liberation2 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm graphviz libabsl20220623 libann0 libaom3 libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive13 libassuan0 libavahi-client3 libavahi-common-data libavahi-common3 libavif15 libcairo2 libcdt5 libcgraph6 libcups2 libcurl4 libdatrie1 libdav1d6 libde265-0 libdeflate0 libdw1 libestr0 libevent-2.1-7 libfastjson4 libfontconfig1 libfreeradius3 libfribidi0 libfsverity0 libgav1-1 libgd3 libgomp1 libgpgme11 libgraphite2-3 libgsf-1-114 libgsf-1-common libgts-0.7-5 libgts-bin libgvc6 libgvpr2 libharfbuzz0b libheif1 libice6 libjbig0 libjpeg62-turbo libksba8 liblab-gamut1 liblcms2-2 libldb2 liblerc4 liblognorm5 libltdl7 liblua5.3-0 libncurses6 libnl-3-200 libnpth0 libnspr4 libnss3 libopenjp2-7 libpango-1.0-0 libpango1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpangoxft-1.0-0 libpathplan4 libpcap0.8 libpcre3 libpixman-1-0 libpoppler126 libpq5 libpython3.11 librav1e0 librpm9 librpmbuild9 librpmio9 librpmsign9 libsm6 libsmbclient libsvtav1enc1 libtalloc2 libtdb1 libtevent0 libthai-data libthai0 libtiff6 libwbclient0 libwebp7 libx265-199 libxaw7 libxcb-render0 libxcb-shm0 libxft2 libxmu6 libxpm4 libxrender1 libxslt1.1 libxt6 libyuv0 php php-cgi php-common php-gd php-pear php-sqlite3 php-xml php8.2 php8.2-cgi php8.2-cli php8.2-common php8.2-gd php8.2-opcache php8.2-readline php8.2-sqlite3 php8.2-xml pinentry-curses poppler-data poppler-utils psmisc python3-gpg python3-ldb python3-samba python3-talloc python3-tdb rpcbind rpm rpm-common rpm2cpio rsync rsyslog samba-common samba-common-bin samba-dsdb-modules samba-libs smbclient ssl-cert time update-inetd x11-common xinetd Voorgestelde pakketten: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser pinentry-gnome3 tor parcimonie xloadimage scdaemon gsfonts graphviz-doc lrzip cups-common libgd-tools liblcms2-utils libpangox-1.0-0 pinentry-doc ghostscript fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum alien elfutils rpmlint rpm-i18n python3-braceexpand rsyslog-mysql | rsyslog-pgsql rsyslog-mongodb rsyslog-doc rsyslog-openssl | rsyslog-gnutls rsyslog-gssapi rsyslog-relp heimdal-clients python3-markdown python3-dnspython cifs-utils De volgende NIEUWE pakketten zullen geïnstalleerd worden: apache2 apache2-bin apache2-data apache2-utils bc check-mk-raw-2.3.0p27 curl debugedit dialog dirmngr fontconfig fontconfig-config fonts-dejavu-core fonts-liberation2 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm graphviz libabsl20220623 libann0 libaom3 libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive13 libassuan0 libavahi-client3 libavahi-common-data libavahi-common3 libavif15 libcairo2 libcdt5 libcgraph6 libcups2 libcurl4 libdatrie1 libdav1d6 libde265-0 libdeflate0 libdw1 libestr0 libevent-2.1-7 libfastjson4 libfontconfig1 libfreeradius3 libfribidi0 libfsverity0 libgav1-1 libgd3 libgomp1 libgpgme11 libgraphite2-3 libgsf-1-114 libgsf-1-common libgts-0.7-5 libgts-bin libgvc6 libgvpr2 libharfbuzz0b libheif1 libice6 libjbig0 libjpeg62-turbo libksba8 liblab-gamut1 liblcms2-2 libldb2 liblerc4 liblognorm5 libltdl7 liblua5.3-0 libncurses6 libnl-3-200 libnpth0 libnspr4 libnss3 libopenjp2-7 libpango-1.0-0 libpango1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpangoxft-1.0-0 libpathplan4 libpcap0.8 libpcre3 libpixman-1-0 libpoppler126 libpq5 libpython3.11 librav1e0 librpm9 librpmbuild9 librpmio9 librpmsign9 libsm6 libsmbclient libsvtav1enc1 libtalloc2 libtdb1 libtevent0 libthai-data libthai0 libtiff6 libwbclient0 libwebp7 libx265-199 libxaw7 libxcb-render0 libxcb-shm0 libxft2 libxmu6 libxpm4 libxrender1 libxslt1.1 libxt6 libyuv0 php php-cgi php-common php-gd php-pear php-sqlite3 php-xml php8.2 php8.2-cgi php8.2-cli php8.2-common php8.2-gd php8.2-opcache php8.2-readline php8.2-sqlite3 php8.2-xml pinentry-curses poppler-data poppler-utils psmisc python3-gpg python3-ldb python3-samba python3-talloc python3-tdb rpcbind rpm rpm-common rpm2cpio rsync rsyslog samba-common samba-common-bin samba-dsdb-modules samba-libs smbclient ssl-cert time update-inetd x11-common xinetd 0 opgewaardeerd, 165 nieuw geïnstalleerd, 0 te verwijderen en 0 niet opgewaardeerd. Er moeten 73,2 MB/279 MB aan archieven opgehaald worden. Na deze bewerking zal er 1.373 MB extra schijfruimte gebruikt worden. Wilt u doorgaan? [J/n]
Er rolt een berg output over je scherm, dit doet de package met Apache Webserver:
Instellen van apache2 (2.4.62-1~deb12u2) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling module reqtimeout. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. info: Switch to mpm prefork for package libapache2-mod-php8.2 Module mpm_event disabled. Enabling module mpm_prefork. info: Executing deferred 'a2enmod php8.2' for package libapache2-mod-php8.2 Enabling module php8.2. Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service. Instellen van libxaw7:amd64 (2:1.0.14-1) ... Instellen van php8.2 (8.2.26-1~deb12u1) ... Instellen van libgvc6 (2.42.2-7+deb12u1) ... Instellen van samba-common-bin (2:4.17.12+dfsg-0+deb12u1) ... Instellen van libpango1.0-0:amd64 (1.50.12+ds-1) ... Instellen van graphviz (2.42.2-7+deb12u1) ... Instellen van php (2:8.2+93) ... Instellen van check-mk-raw-2.3.0p27 (0.bookworm) ... update-alternatives: /omd/versions/2.3.0p27.cre wordt gebruikt om in de automatische modus in /omd/versions/default (omd) te voorzien Adding system group omd Enabling conf zzz_omd. To activate the new configuration, you need to run: systemctl reload apache2 Considering dependency proxy for proxy_http: Enabling module proxy. Enabling module proxy_http. To activate the new configuration, you need to run: systemctl restart apache2 Enabling module rewrite. To activate the new configuration, you need to run: systemctl restart apache2 New default version is 2.3.0p27.cre. Installing systemd service: omd.init Disabling startup through SysV (/etc/init.d/*) scripts Activating startup during system boot Created symlink /etc/systemd/system/multi-user.target.wants/omd.service → /etc/systemd/system/omd.service. Bezig met afhandelen van triggers voor man-db (2.11.2-2) ... Bezig met afhandelen van triggers voor dbus (1.14.10-1~deb12u1) ... Bezig met afhandelen van triggers voor libc-bin (2.36-9+deb12u9) ... Bezig met afhandelen van triggers voor php8.2-cli (8.2.26-1~deb12u1) ... Bezig met afhandelen van triggers voor libapache2-mod-php8.2 (8.2.26-1~deb12u1) ... Bezig met afhandelen van triggers voor php8.2-cgi (8.2.26-1~deb12u1) ...
Nu staat de basis en kan ik op onderzoek uit en gaan inrichten…
michelle@helmstok:~$ omd version
OMD - Open Monitoring Distribution Version 2.3.0p27.cre
Configuratie
Nu is het tijd om CheckMK aan te slingeren, dus:
michelle@helmstok:~$ sudo omd create poc [sudo] wachtwoord voor michelle: Adding /opt/omd/sites/poc/tmp to /etc/fstab. Creating temporary filesystem /omd/sites/poc/tmp...OK Updating core configuration... Generating configuration for core (type nagios)... Precompiling host checks...OK Executing post-create script "01_create-sample-config.py"...OK Executing post-create script "02_cmk-compute-api-spec"...OK Restarting Apache...OK Created new site poc with version 2.3.0p27.cre. The site can be started with omd start poc. The default web UI is available at http://helmstok/poc/ The admin user for the web applications is cmkadmin with password: *********** For command line administration of the site, log in with 'omd su poc'. After logging in, you can change the password for cmkadmin with 'cmk-passwd cmkadmin'. michelle@helmstok:~$ sudo omd start poc Temporary filesystem already mounted Starting agent-receiver...OK Starting mkeventd...OK Starting rrdcached...OK Starting npcd...OK Starting nagios...OK Starting apache...OK Starting redis...OK Initializing Crontab...OK michelle@helmstok:~$ sudo omd su poc OMD[poc]:~$ cmk-passwd cmkadmin New password: Re-type new password:
Nu kan ik inloggen op http://helmstok/poc met gebruiker cmkadmin en het voor mij bekende root-WW.
CheckMK POC
1e onderzoek: hoe ziet de server eruit?
Disk indeling
We gaan eens kijken wat die package zoal op mijn systeem heeft gedonderd:
michelle@helmstok:/etc/apache2$ ls -al /omd lrwxrwxrwx 1 root root 8 22 feb 17:49 /omd -> /opt/omd michelle@helmstok:/etc/apache2$ sudo du -hs /opt/omd 1,2G /opt/omd
Ga ik dit op de roer server parkeren moet ik dus een filesystem /opt/omd aanmaken, van 5GB of zo?
Webserver configuratie
Uit de installatie had ik al opgemaakt dat dit ding dus de Apache webserver gebruikt van de Debian GNU/Linux distributie. Hoe hebben ze dat in elkaar gestoken?
michelle@helmstok:/etc/apache2$ ls conf-available charset.conf localized-error-pages.conf other-vhosts-access-log.conf php8.2-cgi.conf security.conf serve-cgi-bin.conf zzz_omd.conf michelle@helmstok:/etc/apache2$ ls -al conf-enabled/zzz_omd.conf lrwxrwxrwx 1 root root 30 22 feb 17:49 conf-enabled/zzz_omd.conf -> ../conf-available/zzz_omd.conf michelle@helmstok:/etc/apache2$ cat conf-enabled/zzz_omd.conf Include /omd/apache/*.conf michelle@helmstok:/etc/apache2$ ls /omd/apache/*.conf /omd/apache/empty.conf /omd/apache/poc.conf michelle@helmstok:/etc/apache2$ cat /omd/apache/poc.conf # version: 2 # This file is managed by 'omd' and will automatically be overwritten. Better do not edit manually # Make sure that symlink /omd does not make problems <Directory /> Options +FollowSymlinks </Directory> <IfModule mod_proxy_http.c> ProxyRequests Off ProxyPreserveHost On <Proxy http://127.0.0.1:5000/poc> Order allow,deny allow from all </Proxy> <Location /poc> # Setting "retry=0" to prevent 60 second caching of problem states e.g. when # the site apache is down and someone tries to access the page. # "disablereuse=On" prevents the apache from keeping the connection which leads to # wrong devlivered pages sometimes ProxyPass http://127.0.0.1:5000/poc retry=0 disablereuse=On timeout=120 ProxyPassReverse http://127.0.0.1:5000/poc </Location> </IfModule> <IfModule !mod_proxy_http.c> Alias /poc /omd/sites/poc <Directory /omd/sites/poc> Deny from all ErrorDocument 403 "<h1>Checkmk: Incomplete Apache Installation</h1>You need mod_proxy and mod_proxy_http in order to run the web interface of Checkmk." </Directory> </IfModule> <Location /poc> ErrorDocument 503 "<meta http-equiv='refresh' content='60'><h1>Checkmk: Site Not Started</h1>You need to start this site in order to access the web interface.<!-- IE shows its own short useless error message otherwise: placeholder -->" </Location>
Kortom: Het heeft netjes z'n eigen config maar is wel een beetje tam met z'n HTTP en een URL die naar de site is vernoemd. Idee voor de roer server: de site tijdens configuratie checkmk noemen zodat de URL iets wordt wat ik graag wil…
Reboot proof?
Ja dus:
michelle@helmstok:~$ sudo omd status Doing 'status' on site poc: agent-receiver: running mkeventd: running rrdcached: running npcd: running nagios: running apache: running redis: running crontab: running ----------------------- Overall state: running
2e onderzoek: clients toevoegen
Ik heb de youtube video bekeken en kwam er vervolgens achter dat je aan de linkerkant kunt kiezen voor:
- Setup → Agents → Linux of Windows
En daar vervolgens een .deb, .rpm of .msi kunt downloaden. Ziet er goed uit! Dus:
wget http://helmstok/poc/check_mk/agents/check-mk-agent_2.3.0p27-1_all.deb
En dat installeren. Vervolgens kun je een agent toevoegen, laten we beginnen met de POC server itself:
- Setup → Hosts → Hosts → Add a system to the monitoring
Ik vul in host helmstok en omdat dat resolved hoef ik niks te doen qua IP-adres of zuks. Na een scan van de host komt er een waslijst tevoorschijn van te monitoren zaken en ik kies er 8 uit. Daarna rechts bovenin CheckMK klikken op “9 changes” om de boel te activeren, en nogmaals Activate om het echt te doen. Nu worden er zaken gemonitord. Binnenkort maar eens kijken wat dat doet qua grafiekjes, en de RHEL server en Windows 11 VM toevoegen…
CheckMK Client
Er worden diverse agents meegeleverd die je kunt downloaden vanuit de web-interface. Ik heb 3 smaken geprobeerd, 2 Linux versies en eentje op Windows. Voor alle versies geldt dat zij TLS kunnen maar standaard niet doen. Daarvoor moet je op de client het volgende uitvoeren:
cmk-agent-ctl register --server helmstok --site poc --user cmkadmin --hostname <host>
Debian/Ubuntu client
RHEL client
Download de RPM vanaf de CheckMK server, ik gebruik hiervoor het wget-commando:
[michelle@pettenmepper ~]$ wget http://helmstok/poc/check_mk/agents/check-mk-agent-2.3.0p27-1.noarch.rpm
Daarna installeer en configureer je het ding via de webinterface en lijkt het te werken. Maar als je de firewall opent gaat het opeens stukken beter…
[michelle@pettenmepper ~]$ sudo firewall-cmd --add-port=6556/tcp
Nu is het bijna netjes. Alleen klaagt het ding dat 'ie graag TLS wil gebruiken voor de client. Dus registreren we 'm nog even netjes vanaf de client:
[michelle@pettenmepper ~]$ sudo cmk-agent-ctl register --server helmstok --site poc --user cmkadmin --hostname pettenmepper Attempting to register at helmstok, port 8000. Server certificate details: PEM-encoded certificate: -----BEGIN CERTIFICATE----- MIIFJDCCAwygAwIBAgIUcC9vE0AdwI4rEcaydq4fiUE5x6cwDQYJKoZIhvcNAQEN BQAwOTEcMBoGA1UEAwwTU2l0ZSAncG9jJyBsb2NhbCBDQTEZMBcGA1UECgwQQ2hl Y2ttayBTaXRlIHBvYzAeFw0yNTAyMjIxNzE0MzFaFw0zNTAyMjIxNzE0MzFaMA4x DDAKBgNVBAMMA3BvYzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALVJ LTTgFiaM9zlOXkH3KCD3vRABz57ijvc6SOgf27ApnRyNAwOpXaxHTB8UCOnDBtMz 595nEjXXdmJSk9Bo1EdKHxFRpDkEtkWS6A2O316gKAO3Z7VjrGWT122TrlrIuP7i RKabtqE4Gw8+67i2ka7Ko6ajhJiMW2IIn9nc8Pbsxza6fjlr3zpLzn3sIDl2fUhY 9NsUBrvlkscQhFyzCtjzFIi3KDliU0QJi6xV1IjQHIwlu6jMp5nMQCnXFXJo+W1J YWyfLggbRgaXavyMSmNtU45D8zYB0mCfv7fE5CFpMH6H4ndU6BRWvz79rzrcgONd pQL0d+KqL8zGNFD2Nf0Q//PWp7nbjk7UcRa1muTg/cXzRniVxLZHIsPnEAkcxfe9 DZQmEmliAL2oRP8OOdBSQKG0iQj9N5k9o3Sgi+SYyLEY7/7UHfxCfqxc2yUBfPk9 dqql/VXYjCcLQdmrsZJhCIfRH0fH9rdnbLk6MdosqaE2rflq/ut4ng7lpzitXZl2 08/79rOE7AXTpwM4zC3UqSDb7mkO0QowiiCHQ0XwvZInqEIXXyxHmj9ZClF9hgY+ v18JwJnST/VUoFH3FPLdRIiK19qap/akaE9i0j/TnkwlPQwdZHiRwnLCsU7Iieiv Iqj4HI9w3cB0zDKk4GAAAEhNERYAi78uHRRS5zHlAgMBAAGjTzBNMAwGA1UdEwEB /wQCMAAwHQYDVR0OBBYEFN1+8b/0CUPufaaN5fKXzzxwEGu2MA4GA1UdDwEB/wQE AwIHgDAOBgNVHREEBzAFggNwb2MwDQYJKoZIhvcNAQENBQADggIBABUpSE3fq6Ks AcOQuY02wtYAH2E8ohzU0m4/44m7OysTrmMxNZrqvHjf23FBIVuNE8l+fox9Ys2z uuRpy6en3A3f8WFzMGaVbujyyHCe0fe6YXzGORMOVDkjSmMaqhAghNRpEmvZUV10 /1K4XsnfTVu/Y9pd1ytOUbifpriCUwsVxUUUJbLK2SG4ROVzPGAHgXAa5yi3/IwX cA1COewnGmvzr1XeA71mUr9Mf9wdD5aM/wbQBabrdplstr7mequ70H79xmq4UQYd muTMBREtTTpHsJW2Utnt4PaDZCGe83gT2upPvwRyV57VBHJqTTXlRMT3voo+7nbz ihcjcW7lzV0sdt3q9+k18JtkwErUbdi6YM4/K1JmoE+l6FfmdUJRwGhnf6OJov1+ spH8YSr2rumR/HgN5Ms7jNhCMZ+M4fKkzwuk7zwLxAp899o9lIFH7zc2M5DUTRBj Bt0KQDhXOnXYjnBIR/2Urh3xCjGMn+kCjve6YdS9HgJXtK8CEOWOcpMUjyBMWhN0 A6iceTEJ0kZTZRiJSyeeEkUmCq27cMJPCOrR3gk2S2lGkugGQ4Bk2J3adDfcwsxm S5CfJ1amjzrkp1YWg2Ny7agffzu8ijU6tHPPu3DZncHHla4gLbGFlKjV8BYWYzfZ 0YVH34Je6YabHZe58A/8XeT+s7Vc6AWN -----END CERTIFICATE----- Issued by: Site 'poc' local CA Issued to: poc Validity: From Sat, 22 Feb 2025 17:14:31 +0000 To Thu, 22 Feb 2035 17:14:31 +0000 Do you want to establish this connection? [Y/n] > y Please enter password for 'cmkadmin' > Registration complete.
Windows client
De Windows-client komt in de vorm van een MSI welke je kunt downloaden vanuit de web-interface:
- Setup → Agents → Windows → check_mk_agent.msi
Als die erop staat kun je 'm configureren. Heb erg in de volgende stappen:
- cmk-agent-ctl staat in
C:\Program Files (x86)\checkmk\service\cmk-agent-ctl.exe
en om daarbij te kunnen moet je je OpdrachtPrompt of PowerShell wel even als Administrator uitvoeren.
- ICMP echo (ping) moet je aanzetten in de Windows Defender Firewall onder Regels voor binnenkomende verbindingen en dan Bestands- en printerdeling (Echoaanvraag - ICMPv4-In) en Bestands- en printerdeling (Echoaanvraag - ICMPv6-In)