본문 바로가기
서버 및 보안

Zabbix

by 다움위키 2023. 12. 24.

Zabbix네트워크, 서버, 가상 기계, 및 클라우드 서비스와 같은 IT 인프라를 모니터링하기 위한 오픈-소스 소프트웨어 도구입니다. Zabbix는 기본 메트릭을 수집하고 표시합니다.

Installation

이 과정과 별도로, Nginx, PHP, 및 MariaDB는 미리 설치해 두시기 바랍니다.

Install Zabbix repository

홈페이지의 설치 문서를 참고해서 설치를 진행해 봅니다.

Install Zabbix server, frontend, agent

  • sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

Create initial database

  • mysql -u root -p
MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin;
MariaDB [(none)]> create user zabbix@localhost identified by 'password';
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
MariaDB [(none)]> quit;

Zabbix 서버 호스트에서 초기 스키마와 데이터를 가져옵니다. 새로 만든 암호를 입력하라는 메시지가 표시됩니다:

  • cd /usr/share/doc/zabbix-sql-scripts/mysql/
  • zcat server.sql.gz | mysql -uzabbix -p zabbix

조금 시간이 걸립니다.

Configure database for Zabbix server

  • sudo nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

Starting Zabbix server process

  • sudo systemctl start zabbix-server zabbix-agent
  • sudo systemctl enable zabbix-server zabbix-agent

Nginx configuration

  • sudo nano /etc/nginx/site-available/zabbix
server {
	listen 4000;
	server_name  localhost;

	location / {
    	root   /usr/share/zabbix;
    	index  index.php index.html index.htm;
	}
	
	location ~ \.php$ {
		root 	/usr/share/zabbix;
		try_files $uri =404;
       	fastcgi_split_path_info ^(.+\.php)(/.+)$;
       	fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
       	fastcgi_index index.php;
       	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       	include fastcgi_params;
       	fastcgi_read_timeout 60;
	}
}
  • cd /etc/nginx/site-enabled
  • sudo ln -sf /etc/nginx/site-available/zabbix .
  • sudo systemctl restart nginx.service

php.ini

PHP 설정을 수정합니다:

  • sudo nano /etc/php/7.4/fpm/php.ini
php_value memory_limit = 128M
php_value post_max_size = 16M
php_value upload_max_filesize = 2M
php_value max_execution_time = 300
php_value max_input_time = 300
date.timezone = Asia/Seoul
  • sudo systemctl restart php7.4-fpm.service

Setup

이제 웹으로 접근해서 설정을 마무리합니다. http://localhost:4000 으로 접근을 합니다.

  • Welcome
  • Check of pre-requisites: 모두 Ok 나오도록 설정을 변경합니다.
  • Configure DB connection: 데이터베이스 접근과 관련된 사항을 입력합니다.
  • Settings:
    • Zabbix server name : 적당한 이름을 입력하십시오.
    • Default time zone : (UTC+09:00) Asia/Seoul
    • Default theme : 적당한 것을 선택하십시오.
  • Pre-installation summary: 내용을 확인하십시오.
  • Install: Configuration file "conf/zabbix.conf.php" created.

이제 웹 브라우저를 열어서, 사용자:Admin, 암호:zabbix를 입력하고 접근해서, 반드시 암호를 바꾸어 줍니다.

Server Enable

http://localhost:4000으로 접근을 합니다.

  • Configuration->Hosts를 누릅니다.
  • 아래에 호스트들에서, 끝 쪽에서 Status를 확인합니다.
  • 만약 Disabled로 되어 있으면 그것을 눌러서 Enabled로 바꾸어 줍니다.

Further reading

External links