728x90
반응형
  • CentOS 7.9 환경에서 Zabbix 5.0 설치 방법에 대해 설명 합니다. 

환경구성

  • Zabbix Server 설치 (Vmware) 
  • ZAbbix Agent 리눅스(Centos 7.9)  데스크탑

Zabbix 5.0 Server 설치

PostgreSQL 설치 

rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum -y install postgresql12-server postgresql12-contrib
/usr/pgsql-12/bin/postgresql-12-setup initdb

 

  • PostgreSQL 환경 설정 
    • vi /var/lib/pgsql/12/data/postgresql.conf 
#listen_addresses = 'localhost' # what IP address(es) to listen on;
listen_addresses = '*'
  • vi /var/lib/pgsql/12/data/pg_hba.conf 
vi /var/lib/pgsql/12/data/pg_hba.conf    
#추가 
host    all             postgres        0.0.0.0/0               trust

 

  • PostgreSQL 기동
systemctl restart postgresql-12
systemctl enable postgresql-12

 

  • PostgreSQL Zabbix Metadata Create 
sudo -u postgres createuser --pwprompt zabbix

sudo -u postgres createdb -O zabbix zabbix

zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix

Zabbix 5.0 sever 설치 

https://www.zabbix.com/download?zabbix=5.0&os_distribution=centos&os_version=7&components=server_frontend_agent&db=pgsql&ws=apache

 

Download and install Zabbix

 

www.zabbix.com

  •  Install Zabbix repository & Install Zabbix server, frontend, agent
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

yum clean all
yum install zabbix-server-pgsql zabbix-agent
yum install centos-release-scl

 

  •  /etc/yum.repos.d/zabbix.repo 수정
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

 

  • Zabbix frontend packages 설치
yum install zabbix-web-pgsql-scl zabbix-apache-conf-scl
  • /etc/zabbix/zabbix_server.conf DBPassword 수정
vi /etc/zabbix/zabbix_server.conf

  • PHP for Zabbix frontend 설정 파일 수정 
vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Seoul

 

  •  Zabbix server and agent 시작 
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

# zabbix 중지 
#systemctl stop zabbix-server zabbix-agent httpd rh-php72-php-fpm
  • SELinux httpd 활성화
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on

setsebool -P zabbix_can_network on
service httpd restart

 

  • zabbix 로그 확인
tail -f /var/log/zabbix/zabbix_server.log

Zabbix Web 연결 설정

정상적으로 설치가 완료 되면 zabbix 웹 에 접속 하여 추가 환경 설정을 셋팅 한다.

접속  Url 은 http://[서버ip]/zabbix/ 이다 

  • Zabbix 접속 화면 

  •  zabbix install 정보 확인 

  • PostgreSQL 접속 정보 셋팅 

  • Zabbix 서버 접속 정보 설정

  • Zabbix 셋팅 정보 요약

Zabbix 설치 완료

  • /etc/zabbix/web/zabbix.conf.php

 

  • 설치가 완료되면 Zabbix 웹 페이지에 접속 해서 모니터링 셋팅을 진행 한다. 
  • 최초 접속 비밀 번호는 Admin/zabbix 이다 .

  • 로그인 후 DashBord 화면 

 

Zabbix 5.0 모니터링 설정 

  • 정상적으로 설치 및 셋팅이 완료 되었다면 Zabbix 가 설치된 리눅스 서버의 리소스를 모니터링 할수 있다 
  • Monitoring -> Hosts -> Zabbix server -> Graphs 

  • 조회기간 변경 검색 조회

 

 

Zabbix 5.0 Agent 설치

  • 원격 서버의 시스템 자원을 모니터링하기 위해 agent 를 설치하는 방법에 대한 설명한다.

Zabbix repository  및 Agent 설치 

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all

yum install zabbix-agent

 

Zabbix Agent Config 수정

vi /etc/zabbix/zabbix_agentd.conf

 

  • Zabbix Server IP  수정 
  • Zabbix  Agent Port 설정 
### Option: Server
#       List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
#       Incoming connections will be accepted only from the hosts listed here.
#       If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
#       and '::/0' will allow any IPv4 or IPv6 address.
#       '0.0.0.0/0' can be used to allow any IPv4 address.
#       Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=

Server=192.168.116.200

### Option: ListenPort
#       Agent will listen on this port for connections from the server.
#
# Mandatory: no
# Range: 1024-32767
# Default:
ListenPort=10050

 

Zabbix Agent 재시작 

systemctl restart zabbix-agent 
systemctl enable zabbix-agent
systemctl status zabbix-agent

 

Zabbix  Web Host 추가 

  • 모니터링할 서버에 Zabbix Agent 를 성공적으로 설치 완료 하였다면 Zabbix Webpage 에 접속하여 
  • 호스트를 작성하여 설치한 리모트 서버의 Zabbix Agent 를 등록해 줍니다. 

 

  • Host name : 모티너링 대상 서버 별칭 
  • Agent : Zabbix Agent 를 설치한 서버 IP 
  • Port : Zabbix Agent Port (default : 10050)

  • 템플릿-> Template OS Linux by Zabbix agent 선택

 

  • 정상적으로  호스트 등록이 완료 되면 ZBX 박스가 녹색으로 표시된다.

 

 

Zabbix  Web DashBord 설정

  • Zabbix 기능중에는 Dash Bord 작성기능이 있습니다. 
  • 원하는 지표를 사용자 정의에 따라 구성하여 모니터링을 할수 있습니다. 
  • 신규로 DashBoard 를 생성 하고 원하는 위젯을 추가 하여 원하는 지표를 생성 합니다. 
  • 매뉴-> 대시보드 ->대시보드 작성 클릭 

 

 

  • DashBoard 구성이 완료 되면 변경사항 저장합니다. 

 

Zabbix  Agent Disk 사용량 항목 추가 

  • Zabbix Agent를 설치시 Disk 모니터링 지표는 기본적으로 설치 되지 않습니다. 
  • Template Import 기능을 사용해서 Disk 부가 정보를 모니터링 하기위한 지표를 추가 합니다. 

Disk 지표 추가 관련 설정 

mkdir -p /etc/zabbix/zabbix_agentd.d/
wget https://raw.githubusercontent.com/grundic/zabbix-disk-performance/master/userparameter_diskstats.conf -O /etc/zabbix/zabbix_agentd.d/userparameter_diskstats.conf

# Scripts download 
wget https://raw.githubusercontent.com/grundic/zabbix-disk-performance/master/lld-disks.py -O /usr/local/bin/lld-disks.py
chmod +x /usr/local/bin/lld-disks.py

 

Disk 지표 템플릿 파일 다운로드

Template Disk Performance.xml
0.05MB

 

  • 매뉴 -> 설정 -> 템플릿 ->가져오기 클릭후 다운로드 받은 템플릿을 Import 시켜 줍니다. 

  • 앞서 등록한 호스트 정보 클릭 후 추가한 Templage Disk Performance 를 추가 합니다. 

 

  • Disk 관련 정보가 보이지 않는다면 Host 그룹에 Zabbix Sservers 도 추가 합니다.

 

  • Disk 지표가 추가 작업이 정상적으로 완료 되었다면 원형 그래프로 디스크 사용량을 확인할수 있습니다. 

728x90
반응형

+ Recent posts