[Monitoring] 08. Zabbix (CentOS Stream 8 기준) - 관리자 PW 변경, 모니터링 대상 설정, 이메일 알림

Date:     Updated:

카테고리:

태그:


08-1. 관리자 Password 변경



■ [Administration]-[Users]에서 [Admin]을 클릭

001


■ [Change password]을 클릭

002


■ 변경할 암호를 입력하고 [Update]를 클릭하여 암호를 변경

003


■ [Media] 탭으로 이동한 후 [Add] 링크를 클릭

004


■ [Type] 필드에 [Email] 선택, [Send to] 필드에 메일 주소를 입력한 다음 [Add] 버튼 클릭

005


■ [Update] 버튼을 클릭하면 끝

006


08-2. 모니터링 대상 설정



■ [Configuration]-[Hosts] 선택

  • Zabbix Agent가 설치된 로컬 호스트가 오른쪽 창에 표시되고 확인란을 선택한 후 [Enable] 버튼을 클릭

  • [Status]가 [enabled]로 전환되고 서버가 모니터링됨

007


■ 모니터링 데이터가 수집되고 서버 상태를 볼 수 있다.

008


08-3. 알림을 위한 SMTP 설정



■ SMTP 서버 설치 및 설정

  • 이 예제에서는 SMTP 서버가 localhost(Zabbix 서버)에서 실행되는 환경을 기반으로 한다.
{
	dnf -y install postfix
	sed -i 's/#myhostname = host.domain.tld/myhostname = dlp.test.srv/gi' /etc/postfix/main.cf
	sed -i 's/#mydomain = domain.tld/mydomain = test.srv/gi' /etc/postfix/main.cf
	sed -i 's/#myorigin = $mydomain/myorigin = $mydomain/gi' /etc/postfix/main.cf
	sed -i 's/inet_interfaces = localhost/inet_interfaces = all/gi' /etc/postfix/main.cf
	sed -i 's/inet_protocols = all/inet_protocols = ipv4/gi' /etc/postfix/main.cf
	sed -i 's/mydestination = $myhostname, localhost.$mydomain, localhost/mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain/gi' /etc/postfix/main.cf
	sed -i 's/#mynetworks = 168.100.189.0\/28, 127.0.0.0\/8/mynetworks = 127.0.0.0\/8, 192.168.219.0\/24/gi' /etc/postfix/main.cf
	sed -i 's/#home_mailbox = Maildir\//home_mailbox = Maildir\//gi' /etc/postfix/main.cf
cat <<EOF >> /etc/postfix/main.cf


# add follows to the end
# disable SMTP VRFY command
disable_vrfy_command = yes

# require HELO command to sender hosts
smtpd_helo_required = yes

# limit an email size
# example below means 10M bytes limit
message_size_limit = 10240000

# SMTP-Auth settings
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = \$myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
EOF
	systemctl enable --now postfix
	firewall-cmd --add-service=smtp
	firewall-cmd --runtime-to-permanent
	dnf -y install dovecot
	sed -i 's/#listen = \*\, \:\:/listen = \*\, \:\:/gi' /etc/dovecot/dovecot.conf
	sed -i 's/#disable_plaintext_auth = yes/disable_plaintext_auth = no/gi' /etc/dovecot/conf.d/10-auth.conf
	sed -i 's/auth_mechanisms = plain/auth_mechanisms = plain login/gi' /etc/dovecot/conf.d/10-auth.conf
	sed -i 's/#mail_location =/mail_location = maildir\:\~\/Maildir/gi' /etc/dovecot/conf.d/10-mail.conf
	sed -i 's/#unix_listener \/var\/spool\/postfix\/private\/auth {/unix_listener \/var\/spool\/postfix\/private\/auth {\n  mode = 0666\n  user = postfix\n  group = postfix\n}/' /etc/dovecot/conf.d/10-master.conf
	sed -i 's/ssl = required/ssl = yes/gi' /etc/dovecot/conf.d/10-ssl.conf
	systemctl enable --now dovecot
	firewall-cmd --add-service={pop3,imap}
	firewall-cmd --runtime-to-permanent
	dnf -y install mailx
	echo 'export MAIL=$HOME/Maildir' >> /etc/profile.d/mail.sh
	sed -i 's/SELINUX=enforcing/SELINUX=disabled/gi' /etc/selinux/config
	reboot
}


■ [Administration]-[Media Types]에서 [Email] 버튼을 클릭

009


■ SMTP 서버의 정보를 설정하고 [Update] 버튼을 클릭

010


08-4. 알림 이메일 설정



■ [Configuration]-[Actions]-[Trigger actions]

  • [Status] 섹션의 [Disabled] 클릭하여 [Enabled]으로 활성화.

011


■ 알림을 사용할 수 있으며, 기본 수신자는 Zabbix 관리자 그룹

012


■ 대상 호스트에 문제가 발생한 경우 다음 예와 같이 알림이 전송됨

# 예시
From root@dlp.test.srv  Mon Mar  7 19:16:30 2022
Return-Path: <root@dlp.test.srv>
X-Original-To: root@dlp.test.srv
Delivered-To: root@dlp.test.srv
From: <root@dlp.test.srv>
To: <root@dlp.test.srv>
Date: Mon, 07 Mar 2022 19:16:30 -0600
Subject: Problem: Zabbix agent is not available (for 3m)
Content-Type: text/plain; charset="UTF-8"
Status: R

Problem started at 19:16:26 on 2022.03.07
Problem name: Zabbix agent is not available (for 3m)
Host: Zabbix server
Severity: Average
Operational data: not available (0)
Original problem ID: 35


■ Actions 이름을 클릭하려면 Actions을 설정할 수 있다.

013


■ [Operations] 탭을 이동하려면 알림 메시지 등을 편집할 수 있다.

014

MONITORING 카테고리 내 다른 글 보러가기

댓글 남기기