IT

Zabbix 구축

링가링가링가링가 2025. 3. 10. 15:16

<Zabbix란?>

시스템, 네트워크를 모니터링할수 있는 솔루션

 

<공식 홈페이지 다운로드 참조>

https://www.zabbix.com/download?zabbix=7.2&os_distribution=rocky_linux&os_version=8&components=server_frontend_agent_2&db=pgsql&ws=nginx

 

Download and install Zabbix

Talk to experts Benefit from expert advice and best practices for all Zabbix-related matters Get technical advice Get instant access to a team of Zabbix experts for guaranteed professional support 24x7 Obtain knowledge Focused, comprehensive training for a

www.zabbix.com

 

 

<구축 버전>

  • Rocky Linux: 8.10
  • PostgreSQL : 13
  • Nginx : 1.14
  • PHP : 8.2
  • Zabbix-Agent2 : 7.2

 

<Zabbix 설치>

## 자빅스 관련 패키지 설치 ##
# rpm -Uvh https://repo.zabbix.com/zabbix/7.2/release/rocky/8/noarch/zabbix-release-latest-7.2.el8.noarch.rpm
# dnf clean all
# dnf module switch-to php:8.2
# dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2
# dnf install zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-mssql zabbix-agent2-plugin-postgresql

## PostgreSQL 패키지 설치 ##
# sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# sudo dnf -qy module disable postgresql
# sudo dnf install -y postgresql13-server
# sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
# sudo systemctl enable postgresql-13
# sudo systemctl start postgresql-13
# sudo systemctl status postgresql-13

## DB 계정 생성 및 테이블 가져오기 ##
# sudo -u postgres createuser --pwprompt zabbix
# sudo -u postgres createdb -O zabbix zabbix
# zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix

## 자빅스 conf 파일 위치 ##
# vi /etc/zabbix/zabbix_server.conf
## DBPassword=password (DB 패스워드 변경하여 사용)

## Nginx 포트 및 도메인 수정 ##
# vi /etc/nginx/conf.d/zabbix.conf

## Zabbix Start & Enable ##
# systemctl restart zabbix-server zabbix-agent2 nginx php-fpm
# systemctl enable zabbix-server zabbix-agent2 nginx php-fpm

 

<Zabbix 설치 후 URL 접속>

** 위의 따라 기본설치시 아래와 같음

  • Database host : localhost // DB 호스트
  • Database port : 5432  // PostgreSQL 기본 포트
  • Database name : zabbix  // DB 이름
  • Database schema : public  // DB Schema 이름

 

<첫 로그인시 Admin 계정 정보>

  • ID : Admin
  • Passwd : zabbix

 

<Nginx SSL 추가 방법>

** /etc/nginx/conf.d/zabbix.conf 기본 자빅스 파일을 신규로 복사하여 사용하거나 해당 구문에 추가해서 사용한다.

server {
        listen          443;
        server_name     zabbix-test.local; // 원하는 도메인 이름

        root    /usr/share/zabbix/ui;

        ssl on;
        ssl_certificate     // SSL PEM 파일 위치;
        ssl_certificate_key // SSL KEY 파일 위치;
        ssl_session_cache  builtin:1000;  // 입맛대로
        ssl_session_timeout 300m; // 입맛대로

        ssl_protocols  TLSv1 TLSv1.1 TLSv1.2; // 입맛대로
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;

        index   index.php;

 

<Zabbix Ldap 연동>

  • Ldap 연동 : 자빅스 메인 페이지 -> Users -> Authentication -> LDAP settings -> Servers 추가
  • User Group 생성 : 자빅스 메인 페이지 -> Users Groups -> Create user group -> Frontend access LDAP(선택) + users 추가
  • User 생성 : 자빅스 메인 페이지 -> Users -> Users -> Create user -> Groups(LDAP 선택)

 

<PostgreSQL DB 명령어 참조>

  • \l: 현재 서버에 있는 모든 데이터베이스 목록을 조회한다.
  • \c database_name: 지정한 데이터베이스로 접속한다.
  • \d: 현재 데이터베이스에 있는 모든 테이블, 뷰, 시퀀스, 인덱스 등의 목록을 조회한다.
  • \dt: 현재 데이터베이스에 있는 모든 테이블의 목록을 조회한다.
  • \dv: 현재 데이터베이스에 있는 모든 뷰의 목록을 조회한다.
  • \di: 현재 데이터베이스에 있는 모든 인덱스의 목록을 조회한다.
  • \q: psql 클라이언트를 종료하고 터미널로 빠져나간다.