check-mk install
check mk 의 설치는 끝났고 이제부터가진짜시작이다.
아주 다양한 방법으로 모니터링이 가능한데 check-mk 에서 제공 해주는 plugin 말고도 nagios 에서 제공되는 스크립트도 있으니 이것도 찾아보면 좋을 것 같다.
오늘은 check mk에서 제공하는 plugin 으로 기본적인 모니터링 요소 추가까지 함.
login 후 오른쪽에 ‘hosts’ 텝을 클릭하고 ‘New folder’ 메뉴로 들어간다.
testfolder2 라는 폴더를 만들었다. 이제 여기에 host2를 추가해 넣을거다.
‘New host’ 메뉴에서 host를 추가한다.
이 름은 host2로 추가함. 이 host2 가 check_mk가 서비스 되고 있는 서버의 hosts 파일에 등록이 되어 있던지 dns에 등록이 되어 있어야함. 정보를 받을 agent type은 check_mk agent와 snmp 둘 다 쓰기로 설정 함.
criticality는 비지니스 critical 로 설정했다.
그리고 save & test 메뉴를 클릭한다.
test를 해보면 ping test는 성공 하는데, agent와 snmp test가 실패로 나온다.
이제 agent 와 snmp 설정을 해주자.
management agents 메뉴에서 check-mk-agent rpm 을 host2 에 다운받는다.
youngju.lee@youngju:~$ ssh nagi5 -l root
Last login: Wed Dec 16 02:38:17 2015 from 192.168.21.180
[root@host2 services]# cd /usr/lib/firewalld/services/
### firewall 에 snmp와 check_mk service 를 추가 해준다.
이거 안하고 그냥 port 추가 해주면 되는데 그래도 서비스 추가를 해주자. ㅎ ###
[root@host2 services]# ls
RH-Satellite-6.xml dhcpv6.xml imaps.xml ldap.xml ms-wbt.xml pmproxy.xml radius.xml telnet.xml
amanda-client.xml dns.xml ipp-client.xml ldaps.xml mysql.xml pmwebapi.xml rpc-bind.xml tftp-client.xml
bacula-client.xml ftp.xml ipp.xml libvirt-tls.xml nfs.xml pmwebapis.xml samba-client.xml tftp.xml
bacula.xml high-availability.xml ipsec.xml libvirt.xml ntp.xml pop3s.xml samba.xml transmission-client.xml
dhcp.xml http.xml kerberos.xml mdns.xml openvpn.xml postgresql.xml smtp.xml vnc-server.xml
dhcpv6-client.xml https.xml kpasswd.xml mountd.xml pmcd.xml proxy-dhcp.xml ssh.xml wbem-https.xml
[root@host2 services]# ls -alt |grep -i snmp
[root@host2 services]# cp -av ldap.xml snmp.xml
`ldap.xml’ -> `snmp.xml’
### snmp.xml 파일을 생성 한다. ###
[root@host2 services]# cat /etc/services |grep -i snmp
### snmp service 의 포트를 검색한다. ###
snmp 161/tcp # Simple Net Mgmt Proto
snmp 161/udp # Simple Net Mgmt Proto
snmptrap 162/tcp # SNMPTRAP
snmptrap 162/udp snmp-trap # Traps for SNMP
smux 199/tcp # SNMP Unix Multiplexer
synotics-relay 391/tcp # SynOptics SNMP Relay Port
synotics-relay 391/udp # SynOptics SNMP Relay Port
snmp-tcp-port 1993/tcp # cisco SNMP TCP port
snmp-tcp-port 1993/udp # cisco SNMP TCP port
oce-snmp-trap 2697/tcp # Oce SNMP Trap Port
oce-snmp-trap 2697/udp # Oce SNMP Trap Port
websphere-snmp 3427/tcp # WebSphere SNMP
websphere-snmp 3427/udp # WebSphere SNMP
snmpssh 5161/tcp # SNMP over SSH Transport Model
snmpssh-trap 5162/tcp # SNMP Notification over SSH Transport Model
patrol-snmp 8161/tcp # Patrol SNMP
patrol-snmp 8161/udp # Patrol SNMP
snmptls 10161/tcp # SNMP-TLS
snmpdtls 10161/udp # SNMP-DTLS
snmptls-trap 10162/tcp # SNMP-Trap-TLS
snmpdtls-trap 10162/udp # SNMP-Trap-DTLS
suncacao-snmp 11161/tcp # sun cacao snmp access point
suncacao-snmp 11161/udp # sun cacao snmp access point
[root@host2 services]# vim snmp.xml
[root@host2 services]#
[root@host2 services]# cat snmp.xml
### 아래와 같이 snmp.xml 파일을 수정해준다. ###
<?xml version=”1.0″ encoding=”utf-8″?>
<service>
<short>snmp</short>
<description>Simple Network Management Protocol</description>
<port protocol=”tcp” port=”161″/>
<port protocol=”udp” port=”161″/>
</service>
[root@host2 services]#
[root@host2 services]# cp -av ldap.xml check_mk.xml
`ldap.xml’ -> `check_mk.xml’
[root@host2 services]# vim check_mk.xml
[root@host2 services]# cat check_mk.xml
### 똑같이 check_mk service 도 추가 해준다. ###
<?xml version=”1.0″ encoding=”utf-8″?>
<service>
<short>snmp</short>
<description>Check_MK Agent</description>
<port protocol=”tcp” port=”6556″/>
</service>
[root@host2 services]#
[root@host2 services]# systemctl status firewalld
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since 금 2015-12-11 15:19:16 KST; 4 days ago
Main PID: 681 (firewalld)
CGroup: /system.slice/firewalld.service
└─681 /usr/bin/python -Es /usr/sbin/firewalld –nofork –nopid
12월 11 15:19:16 host1 systemd[1]: Started firewalld – dynamic firewall daemon.
[root@host2 services]# firewall-cmd –get-services |grep -i snmp
### firewall 에 서비스가 추가 되어 있지 않다. firewalld 를 재시작 해주자. ###
[root@host2 services]# systemctl restart firewalld
[root@host2 services]# firewall-cmd –get-services |grep -i snmp
### snmp 서비스 추가 된것 확인 ###
RH-Satellite-6 amanda-client bacula bacula-client check_mk dhcp dhcpv6 dhcpv6-client dns ftp high-availability http https imaps ipp ipp-client ipsec kerberos kpasswd l
dap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba samba
-client smtp snmp ssh telnet tftp tftp-client transmission-client vnc-server wbem-https
[root@host2 services]# firewall-cmd –permanent –add-service=snmp –add-service=check_mk
success
### firewall 에 서비스를 열어주자. ###
[root@host2 services]# firewall-cmd –reload
success
root@host2 services]#
[root@host2 services]# yum install net-snmp
### net-snmp service 를 설치 해 주자. ###
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 5.3 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/6): base/7/x86_64/group_gz | 155 kB 00:00:00
(2/6): epel/x86_64/updateinfo | 434 kB 00:00:00
(3/6): extras/7/x86_64/primary_db | 90 kB 00:00:00
(4/6): base/7/x86_64/primary_db | 5.3 MB 00:00:01
(5/6): updates/7/x86_64/primary_db | 935 kB 00:00:00
(6/6): epel/x86_64/primary_db | 3.7 MB 00:00:01
Loading mirror speeds from cached hostfile
* base: mirror.premi.st
* epel: mirror.premi.st
* extras: mirror.premi.st
* updates: mirror.premi.st
Resolving Dependencies
–> Running transaction check
—> Package net-snmp.x86_64 1:5.7.2-24.el7 will be installed
–> Processing Dependency: net-snmp-libs = 1:5.7.2-24.el7 for package: 1:net-snmp-5.7.2-24.el7.x86_64
–> Processing Dependency: net-snmp-agent-libs = 1:5.7.2-24.el7 for package: 1:net-snmp-5.7.2-24.el7.x86_64
–> Processing Dependency: perl(Data::Dumper) for package: 1:net-snmp-5.7.2-24.el7.x86_64
–> Processing Dependency: libnetsnmptrapd.so.31()(64bit) for package: 1:net-snmp-5.7.2-24.el7.x86_64
–> Processing Dependency: libnetsnmpmibs.so.31()(64bit) for package: 1:net-snmp-5.7.2-24.el7.x86_64
–> Processing Dependency: libnetsnmpagent.so.31()(64bit) for package: 1:net-snmp-5.7.2-24.el7.x86_64
–> Running transaction check
—> Package net-snmp-agent-libs.x86_64 1:5.7.2-24.el7 will be installed
—> Package net-snmp-libs.x86_64 1:5.7.2-20.el7_1.1 will be updated
—> Package net-snmp-libs.x86_64 1:5.7.2-24.el7 will be an update
—> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
net-snmp x86_64 1:5.7.2-24.el7 base 321 k
Installing for dependencies:
net-snmp-agent-libs x86_64 1:5.7.2-24.el7 base 702 k
perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
Updating for dependencies:
net-snmp-libs x86_64 1:5.7.2-24.el7 base 747 k
Transaction Summary
==============================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Upgrade ( 1 Dependent package)
Total download size: 1.8 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
(1/4): net-snmp-5.7.2-24.el7.x86_64.rpm | 321 kB 00:00:00
(2/4): net-snmp-agent-libs-5.7.2-24.el7.x86_64.rpm | 702 kB 00:00:00
(3/4): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00
(4/4): net-snmp-libs-5.7.2-24.el7.x86_64.rpm | 747 kB 00:00:00
————————————————————————————————————————————————————–
Total 4.0 MB/s | 1.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:net-snmp-libs-5.7.2-24.el7.x86_64 1/5
Installing : 1:net-snmp-agent-libs-5.7.2-24.el7.x86_64 2/5
Installing : perl-Data-Dumper-2.145-3.el7.x86_64 3/5
Installing : 1:net-snmp-5.7.2-24.el7.x86_64 4/5
Cleanup : 1:net-snmp-libs-5.7.2-20.el7_1.1.x86_64 5/5
Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 1/5
Verifying : 1:net-snmp-agent-libs-5.7.2-24.el7.x86_64 2/5
Verifying : 1:net-snmp-5.7.2-24.el7.x86_64 3/5
Verifying : 1:net-snmp-libs-5.7.2-24.el7.x86_64 4/5
Verifying : 1:net-snmp-libs-5.7.2-20.el7_1.1.x86_64 5/5
Installed:
net-snmp.x86_64 1:5.7.2-24.el7
Dependency Installed:
net-snmp-agent-libs.x86_64 1:5.7.2-24.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7
Dependency Updated:
net-snmp-libs.x86_64 1:5.7.2-24.el7
Complete!
[root@host2 services]# systemctl status snmpd
snmpd.service – Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled)
Active: inactive (dead)
[root@host2 services]# systemctl restart snmpd
### snmpd 재시작 ###
[root@host2 services]# systemctl enable snmpd
ln -s ‘/usr/lib/systemd/system/snmpd.service’ ‘/etc/systemd/system/multi-user.target.wants/snmpd.service’
[root@host2 services]#
[root@host2 services]# firewall-cmd –list-all
### firewall 등록 확인 ###
public (default, active)
interfaces: eth0
sources:
services: dhcpv6-client snmp ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
[root@host2 ~]# curl http://host1/fusion/check_mk/agents/check-mk-agent-1.2.6p15-1.noarch.rpm -O
### agent 패키지를 다운 받는다. ###
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20547 100 20547 0 0 127k 0 –:–:– –:–:– –:–:– 127k
[root@host2 ~]#
[root@host2 ~]# ls
anaconda-ks.cfg check-mk-agent-1.2.6p15-1.noarch.rpm initial-setup-ks.cfg 공개 다운로드 문서 바탕화면 비디오 사진 서식 음악
[root@host2 ~]#
[root@host2 ~]#
[root@host2 ~]# yum localinstall check-mk-agent-1.2.6p15-1.noarch.rpm
### agent 설치 ###
Loaded plugins: fastestmirror, langpacks
Examining check-mk-agent-1.2.6p15-1.noarch.rpm: check-mk-agent-1.2.6p15-1.noarch
Marking check-mk-agent-1.2.6p15-1.noarch.rpm to be installed
Resolving Dependencies
–> Running transaction check
—> Package check-mk-agent.noarch 0:1.2.6p15-1 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
check-mk-agent noarch 1.2.6p15-1 /check-mk-agent-1.2.6p15-1.noarch 41 k
Transaction Summary
==============================================================================================================================================================
Install 1 Package
Total size: 41 k
Installed size: 41 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
———————————————
WARNING
This package needs xinetd to be installed.
Currently you do not have installed xinetd.
Please install and start xinetd or install
and setup another inetd manually.
It’s also possible to monitor via SSH without
an inetd.
———————————————
Installing : check-mk-agent-1.2.6p15-1.noarch 1/1
Activating startscript of xinetd
xinetd 서비스의 정보를 읽는 도중 오류가 발생했습니다: 그런 파일이나 디렉터리가 없습니다
Verifying : check-mk-agent-1.2.6p15-1.noarch 1/1
Installed:
check-mk-agent.noarch 0:1.2.6p15-1
Complete!
[root@host2 ~]# cd /etc/xinetd.d/
[root@host2 xinetd.d]# ls
check_mk
[root@host2 xinetd.d]# systemctl status xinetd
xinetd.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
[root@host2 xinetd.d]# rpm -aq |grep -i xinetd
### xinetd 서비스가 없다. 설치해주자. ###
[root@host2 xinetd.d]# yum install xinetd
### xinetd 서비스 설치 ###
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.premi.st
* epel: mirror.premi.st
* extras: mirror.premi.st
* updates: mirror.premi.st
Resolving Dependencies
–> Running transaction check
—> Package xinetd.x86_64 2:2.3.15-12.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
xinetd x86_64 2:2.3.15-12.el7 base 128 k
Transaction Summary
==============================================================================================================================================================
Install 1 Package
Total download size: 128 k
Installed size: 261 k
Is this ok [y/d/N]: y
Downloading packages:
xinetd-2.3.15-12.el7.x86_64.rpm | 128 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:xinetd-2.3.15-12.el7.x86_64 1/1
Verifying : 2:xinetd-2.3.15-12.el7.x86_64 1/1
Installed:
xinetd.x86_64 2:2.3.15-12.el7
Complete!
[root@host2 xinetd.d]# ls
chargen-dgram check_mk daytime-stream discard-stream echo-stream time-dgram
chargen-stream daytime-dgram discard-dgram echo-dgram tcpmux-server time-stream
[root@host2 xinetd.d]# systemctl restart xinetd
[root@host2 services]# firewall-cmd –list-all
public (default, active)
interfaces: eth0
sources:
services: check_mk dhcpv6-client snmp ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
[root@host2 services]# systemctl status xinetd
### xinetd 서비스 실행 ###
xinetd.service – Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled)
Active: active (running) since 수 2015-12-16 02:52:28 KST; 2min 21s ago
Process: 28971 ExecStart=/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid $EXTRAOPTIONS (code=exited, status=0/SUCCESS)
Main PID: 28972 (xinetd)
CGroup: /system.slice/xinetd.service
└─28972 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
12월 16 02:52:28 host2 xinetd[28972]: removing discard
12월 16 02:52:28 host2 xinetd[28972]: removing discard
12월 16 02:52:28 host2 xinetd[28972]: removing echo
12월 16 02:52:28 host2 xinetd[28972]: removing echo
12월 16 02:52:28 host2 xinetd[28972]: removing tcpmux
12월 16 02:52:28 host2 xinetd[28972]: removing time
12월 16 02:52:28 host2 xinetd[28972]: removing time
12월 16 02:52:28 host2 xinetd[28972]: xinetd Version 2.3.15 started with libwrap loadavg labeled-networking options compiled in.
12월 16 02:52:28 host2 xinetd[28972]: Started working: 1 available service
12월 16 02:52:28 host2 systemd[1]: Started Xinetd A Powerful Replacement For Inetd.
[root@host2 services]#
다시 돌아가서 test 를 해보자.
agent 와 snmp 서비스 정보 둘다 잘 받아오는것을 볼 수 있다.
WATO configuration 에 hosts 메뉴를 눌러서 Mail director 메뉴를 보면 ‘!’ 표시가 되어있고 ‘6 Changes’ 가 되어있다. 클릭해서 변경 확인을 해주자.
‘Activate Changes!’ 를 눌러서 바뀐 항목들을 실행 시켜주자.
Overview 에서 ‘All hosts’ 메뉴에서 host2를 들어간다.
등록된 감시 목록이 없어서 별거 안보인다. ‘WATO’ 메뉴에 들어간다.
services 에 들어간다.
‘Full Scan’ 을 클릭하고 ‘Activate missing’을 클릭하면 발견된 감시 목록들을 전부 등록한다.
다시 변경사항을 적용 시켜준다.
다시 host2 의 감시 서비스 항목을 살펴 보면 몇개가 펜딩 되어 있을 텐데 아래 사진의 리사이클 버튼을 눌러주면 다시 정보들을 가져온다.
서비스에 따라 좀 늦게 가져 오는것도 있다.
이상 check_mk 의 기본 서비스들 등록 하는방법이엇다.