mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/selfhosting-blogposts.git
synced 2025-05-16 20:27:00 +00:00
add selfhosting tutorials
This commit is contained in:
parent
95c33c8b41
commit
cc3824e6a2
1900 changed files with 32727 additions and 0 deletions
219
checkmk/index.md
Normal file
219
checkmk/index.md
Normal file
|
@ -0,0 +1,219 @@
|
|||
# CheckMK Setup
|
||||
|
||||
![]()
|
||||
|
||||
## **Initial Setup:**
|
||||
|
||||
|
||||
root@Monitoring:~# ip a | grep inet
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
inet6 ::1/128 scope host
|
||||
inet 10.0.0.201/16 brd 10.0.255.255 scope global ens18
|
||||
inet6 fe80::dc3e:91ff:feff:21c3/64 scope link
|
||||
root@Monitoring:~# apt update -y ; apt upgrade -y
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
root@Monitoring:~# wget https://download.checkmk.com/checkmk/2.0.0p3/check-mk-raw-2.0.0p3_0.buster_amd64.deb
|
||||
--2021-04-25 16:30:48-- https://download.checkmk.com/checkmk/2.0.0p3/check-mk-raw-2.0.0p3_0.buster_amd64.deb
|
||||
Resolving download.checkmk.com (download.checkmk.com)... 116.202.64.85
|
||||
Connecting to download.checkmk.com (download.checkmk.com)|116.202.64.85|:443... connected.
|
||||
HTTP request sent, awaiting response... 200 OK
|
||||
Length: 120673662 (115M) [application/x-debian-package]
|
||||
Saving to: ‘check-mk-raw-2.0.0p3_0.buster_amd64.deb’
|
||||
|
||||
check-mk-raw-2.0.0p3_0.buster_amd64 100%[=================================================================>] 115.08M 4.60MB/s in 26s
|
||||
|
||||
2021-04-25 16:31:14 (4.50 MB/s) - ‘check-mk-raw-2.0.0p3_0.buster_amd64.deb’ saved [120673662/120673662]
|
||||
|
||||
root@Monitoring:~# dpkg -i check-mk-raw-2.0.0p3_0.buster_amd64.deb
|
||||
root@Monitoring:~# apt install -f
|
||||
root@Monitoring:~# dpkg -i check-mk-raw-2.0.0p3_0.buster_amd64.deb
|
||||
|
||||
|
||||
|
||||
|
||||
root@Monitoring:~# omd version
|
||||
OMD - Open Monitoring Distribution Version 2.0.0p3.cre
|
||||
|
||||
root@Monitoring:~# omd create -u 6100 -g 180 mysite
|
||||
Adding /opt/omd/sites/mysite/tmp to /etc/fstab.
|
||||
Creating temporary filesystem /omd/sites/mysite/tmp...OK
|
||||
Updating core configuration...
|
||||
Generating configuration for core (type nagios)...Precompiling host checks...OK
|
||||
OK
|
||||
Restarting Apache...OK
|
||||
Created new site mysite with version 2.0.0p3.cre.
|
||||
|
||||
The site can be started with omd start mysite.
|
||||
The default web UI is available at http://Monitoring/mysite/
|
||||
|
||||
The admin user for the web applications is cmkadmin with password: CVnpP7xt
|
||||
For command line administration of the site, log in with 'omd su mysite'.
|
||||
After logging in, you can change the password for cmkadmin with 'htpasswd etc/htpasswd cmkadmin'.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
root@Monitoring:~# su - mysite
|
||||
OMD[mysite]:~$ omd start
|
||||
Temporary filesystem already mounted
|
||||
Starting mkeventd...OK
|
||||
Starting rrdcached...OK
|
||||
Starting npcd...OK
|
||||
Starting nagios...OK
|
||||
Starting apache...OK
|
||||
Starting redis...OK
|
||||
Initializing Crontab...OK
|
||||
|
||||
OMD[mysite]:~$ omd status
|
||||
mkeventd: running
|
||||
rrdcached: running
|
||||
npcd: running
|
||||
nagios: running
|
||||
apache: running
|
||||
redis: running
|
||||
crontab: running
|
||||
-----------------------
|
||||
Overall state: running
|
||||
|
||||
OMD[mysite]:~$ omd config show
|
||||
ADMIN_MAIL:
|
||||
APACHE_MODE: own
|
||||
APACHE_TCP_ADDR: 127.0.0.1
|
||||
APACHE_TCP_PORT: 5000
|
||||
AUTOSTART: on
|
||||
CORE: nagios
|
||||
LIVESTATUS_TCP: off
|
||||
MKEVENTD: on
|
||||
MKEVENTD_SNMPTRAP: off
|
||||
MKEVENTD_SYSLOG: off
|
||||
MKEVENTD_SYSLOG_TCP: off
|
||||
MULTISITE_AUTHORISATION: on
|
||||
MULTISITE_COOKIE_AUTH: on
|
||||
NAGIOS_THEME: classicui
|
||||
NSCA: off
|
||||
PNP4NAGIOS: on
|
||||
TMPFS: on
|
||||
|
||||
|
||||
|
||||
  
|
||||
|
||||
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/105 ] [~]
|
||||
→ ssh root@10.0.0.101
|
||||
root@10.0.0.101's password:
|
||||
Linux home 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
|
||||
|
||||
The programs included with the Debian GNU/Linux system are free software;
|
||||
the exact distribution terms for each program are described in the
|
||||
individual files in /usr/share/doc/*/copyright.
|
||||
|
||||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
permitted by applicable law.
|
||||
Last login: Sun Apr 25 17:55:05 2021 from 10.0.0.10
|
||||
root@home:~# cd /tmp
|
||||
root@home:/tmp# wget http://10.0.0.201/mysite/check_mk/agents/check-mk-agent_2.0.0p3-1_all.deb
|
||||
--2021-04-25 17:55:35-- http://10.0.0.201/mysite/check_mk/agents/check-mk-agent_2.0.0p3-1_all.deb
|
||||
Connecting to 10.0.0.201:80... connected.
|
||||
HTTP request sent, awaiting response... 200 OK
|
||||
Length: 30166 (29K) [application/x-debian-package]
|
||||
Saving to: ‘check-mk-agent_2.0.0p3-1_all.deb’
|
||||
|
||||
check-mk-agent_2.0.0p3-1_all.deb 100%[=================================================================>] 29.46K --.-KB/s in 0.001s
|
||||
|
||||
2021-04-25 17:55:35 (42.3 MB/s) - ‘check-mk-agent_2.0.0p3-1_all.deb’ saved [30166/30166]
|
||||
|
||||
root@home:/tmp# dpkg -i check-mk-agent_2.0.0p3-1_all.deb
|
||||
Selecting previously unselected package check-mk-agent.
|
||||
(Reading database ... 54845 files and directories currently installed.)
|
||||
Preparing to unpack check-mk-agent_2.0.0p3-1_all.deb ...
|
||||
Unpacking check-mk-agent (2.0.0p3-1) ...
|
||||
Setting up check-mk-agent (2.0.0p3-1) ...
|
||||
Enable Checkmk Agent in systemd...
|
||||
Created symlink /etc/systemd/system/sockets.target.wants/check_mk.socket → /etc/systemd/system/check_mk.socket.
|
||||
|
||||
|
||||
|
||||
|
||||
      
|
||||
|
||||
Adding a windows host:
|
||||
|
||||
                  
|
||||
|
||||
|
||||
root@Monitoring:~# ping 10.0.0.203
|
||||
PING 10.0.0.203 (10.0.0.203) 56(84) bytes of data.
|
||||
64 bytes from 10.0.0.203: icmp_seq=1 ttl=128 time=8.28 ms
|
||||
64 bytes from 10.0.0.203: icmp_seq=2 ttl=128 time=0.718 ms
|
||||
64 bytes from 10.0.0.203: icmp_seq=3 ttl=128 time=0.878 ms
|
||||
64 bytes from 10.0.0.203: icmp_seq=4 ttl=128 time=11.3 ms
|
||||
64 bytes from 10.0.0.203: icmp_seq=5 ttl=128 time=0.953 ms
|
||||
64 bytes from 10.0.0.203: icmp_seq=6 ttl=128 time=10.5 ms
|
||||
|
||||
|
||||
|
||||
 
|
||||
|
||||
Here you can see that my Windows 10 VM has a few problems, and now i know them thanks to my checkmk instance. Now for a non-standard linux system like Arch Linux:
|
||||
|
||||
 ![]()
|
||||
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/127 ] [~/Downloads]
|
||||
→ ls -lash | grep check
|
||||
32K -rw-r--r-- 1 nothing nothing 30K Apr 27 17:10 check-mk-agent_2.0.0p3-1_all
|
||||
56K -rw-r--r-- 1 nothing nothing 56K Apr 27 18:46 check_mk_agent.linux
|
||||
4.0K -rw-r--r-- 1 nothing nothing 256 Apr 27 18:46 check_mk@.service
|
||||
4.0K -rw-r--r-- 1 nothing nothing 510 Apr 27 18:46 check_mk.socket
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/127 ] [~/Downloads]
|
||||
→ sudo mv check_mk@.service /etc/systemd/system/
|
||||
[sudo] password for nothing:
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/127 ] [~/Downloads]
|
||||
→ sudo mv check_mk.socket /etc/systemd/system/
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/127 ] [~/Downloads]
|
||||
→ sudo systemctl daemon-reload
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/127 ] [~/Downloads]
|
||||
→ sudo mv check_mk_agent.linux /usr/bin/check_mk_agent
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/127 ] [~/Downloads]
|
||||
→ chmod +x /usr/bin/check_mk_agent
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/130 ] [/etc/systemd/system]
|
||||
→ systemctl enable --now check_mk.socket
|
||||
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
|
||||
Authentication is required to start 'check_mk.socket'.
|
||||
Authenticating as: nothing
|
||||
Password:
|
||||
==== AUTHENTICATION COMPLETE ====
|
||||
Created symlink /etc/systemd/system/sockets.target.wants/check_mk.socket → /etc/systemd/system/check_mk.socket.
|
||||
|
||||
[ 10.0.0.10/16 ] [ /dev/pts/130 ] [/etc/systemd/system]
|
||||
→ systemctl status check_mk.socket
|
||||
● check_mk.socket - Check_MK Agent Socket
|
||||
Loaded: loaded (/etc/systemd/system/check_mk.socket; disabled; vendor preset: disabled)
|
||||
Active: active (listening) since Tue 2021-04-27 18:55:53 CEST; 5s ago
|
||||
Listen: [::]:6556 (Stream)
|
||||
Accepted: 0; Connected: 0;
|
||||
Tasks: 0 (limit: 38425)
|
||||
Memory: 8.0K
|
||||
CPU: 542us
|
||||
CGroup: /system.slice/check_mk.socket
|
||||
|
||||
Apr 27 18:55:53 nowhere systemd[1]: Listening on Check_MK Agent Socket.
|
||||
|
||||
|
||||
And then simply add the host itself to your checkmk instance just like we did previously.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue