반응형
Zabbix?
: 수많은 종류의 네트워크 서비스, 서버 등의 네트워크 하드웨어를 감시하고 추적하여 관리자에게 장애 발생을 신속히 알리기 위해 만들어진 네트워크 관리 시스템이다.
※ 자세한 정보는 wiki page를 이용하세요. -> https://ko.wikipedia.org/wiki/Zabbix
Zabbix를 설치 하기전에 사전 설치 한다.
Zabbix 설치를 위한 repository를 설정 한다.
[root@zabbix-svr ~]# yum --enablerepo=remi-safe -y install php72-php php72-php-mysqlnd php72-php-gd php72-php-xml php72-php-bcmath php72-php-ldap
[root@zabbix-svr ~]# yum -y install http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
[root@zabbix-svr ~]# systemctl restart httpd
Zabbix PKG를 설치 한다.
[root@zabbix-svr ~]# yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent
Zabbix DB를 설정한다.
[root@zabbix-svr ~]# mysql-uroot -pPASSWD
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.2.22-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> create database zabbix;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'ZABBIX_PASSWD';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'ZABBIX_PASSWD';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
[root@zabbix-svr ~]# cd /usr/share/doc/zabbix-server-mysql-*/
[root@zabbix-svr zabbix-server-mysql-4.2.4]# pwd
/usr/share/doc/zabbix-server-mysql-4.2.4
[root@zabbix-svr zabbix-server-mysql-4.2.4]# ls -al
합계 2320
drwxr-xr-x 2 root root 100 7월 5 17:36 .
drwxr-xr-x. 314 root root 12288 7월 5 17:36 ..
-rw-r--r-- 1 root root 98 6월 27 00:22 AUTHORS
-rw-r--r-- 1 root root 17990 6월 27 00:22 COPYING
-rw-r--r-- 1 root root 1009394 6월 27 00:22 ChangeLog
-rw-r--r-- 1 root root 52 6월 27 00:22 NEWS
-rw-r--r-- 1 root root 1317 6월 27 00:22 README
-rw-r--r-- 1 root root 1312728 6월 27 00:27 create.sql.gz
[root@zabbix-svr zabbix-server-mysql-4.2.4]# gzip -d create.sql.gz
[root@zabbix-svr zabbix-server-mysql-4.2.4]# ls -al
합계 7044
drwxr-xr-x 2 root root 97 7월 8 09:07 .
drwxr-xr-x. 314 root root 12288 7월 5 17:36 ..
-rw-r--r-- 1 root root 98 6월 27 00:22 AUTHORS
-rw-r--r-- 1 root root 17990 6월 27 00:22 COPYING
-rw-r--r-- 1 root root 1009394 6월 27 00:22 ChangeLog
-rw-r--r-- 1 root root 52 6월 27 00:22 NEWS
-rw-r--r-- 1 root root 1317 6월 27 00:22 README
-rw-r--r-- 1 root root 6148564 6월 27 00:27 create.sql
[root@zabbix-svr zabbix-server-mysql-4.2.4]# mysql -uroot -proot.123 zabbix < create.sql
[root@zabbix-svr zabbix-server-mysql-4.2.4]# mysql -uroot -proot.123 zabbix -e " show tables;"
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
| application_discovery |
| application_prototype |
| application_template |
| applications |
| auditlog |
| auditlog_details |
| autoreg_host |
| conditions |
| config |
| corr_condition |
| corr_condition_group |
| corr_condition_tag |
| corr_condition_tagpair |
| corr_condition_tagvalue |
| corr_operation |
| correlation |
| dashboard |
| dashboard_user |
| dashboard_usrgrp |
| dbversion |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| event_recovery |
| event_suppress |
| event_tag |
| events |
| expressions |
| functions |
| globalmacro |
| globalvars |
| graph_discovery |
| graph_theme |
| graphs |
| graphs_items |
| group_discovery |
| group_prototype |
| history |
| history_log |
| history_str |
| history_text |
| history_uint |
| host_discovery |
| host_inventory |
| host_tag |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_templates |
| housekeeper |
| hstgrp |
| httpstep |
| httpstep_field |
| httpstepitem |
| httptest |
| httptest_field |
| httptestitem |
| icon_map |
| icon_mapping |
| ids |
| images |
| interface |
| interface_discovery |
| item_application_prototype |
| item_condition |
| item_discovery |
| item_preproc |
| items |
| items_applications |
| lld_macro_path |
| maintenance_tag |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| mappings |
| media |
| media_type |
| opcommand |
| opcommand_grp |
| opcommand_hst |
| opconditions |
| operations |
| opgroup |
| opinventory |
| opmessage |
| opmessage_grp |
| opmessage_usr |
| optemplate |
| problem |
| problem_tag |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| rights |
| screen_user |
| screen_usrgrp |
| screens |
| screens_items |
| scripts |
| service_alarms |
| services |
| services_links |
| services_times |
| sessions |
| slides |
| slideshow_user |
| slideshow_usrgrp |
| slideshows |
| sysmap_element_trigger |
| sysmap_element_url |
| sysmap_shape |
| sysmap_url |
| sysmap_user |
| sysmap_usrgrp |
| sysmaps |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| tag_filter |
| task |
| task_acknowledge |
| task_check_now |
| task_close_problem |
| task_remote_command |
| task_remote_command_result |
| timeperiods |
| trends |
| trends_uint |
| trigger_depends |
| trigger_discovery |
| trigger_tag |
| triggers |
| users |
| users_groups |
| usrgrp |
| valuemaps |
| widget |
| widget_field |
+----------------------------+
Zabbix config 변경
[root@zabbix-svr zabbix-server-mysql-4.2.4]# vi /etc/zabbix/zabbix_server.conf
~(생략)
90 # Default:
91 DBHost=localhost ## 주석 제거 또는 추가
92
93 ### Option: DBName
94 # Database name.
95 #
96 # Mandatory: yes
97 # Default:
98 # DBName=
99
100 DBName=zabbix
101
102 ### Option: DBSchema
103 # Schema name. Used for IBM DB2 and PostgreSQL.
104 #
105 # Mandatory: no
106 # Default:
107 # DBSchema=
108
109 ### Option: DBUser
110 # Database user.
111 #
112 # Mandatory: no
113 # Default:
114 # DBUser=
115
116 DBUser=zabbix
117
118 ### Option: DBPassword
119 # Database password.
120 # Comment this line if no password is used.
121 #
122 # Mandatory: no
123 # Default:
124 # DBPassword=
125 DBPassword=DB_PASSWD ## 주석 제거 또는 추가후 설정한 DB PASSWD입력
zabbix daemon재시작
[root@zabbix-svr ~]# systemctl start zabbix-server
[root@zabbix-svr ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@zabbix-svr ~]# systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
Active: active (running) since 월 2019-07-08 09:14:20 KST; 10s ago
Main PID: 18262 (zabbix_server)
CGroup: /system.slice/zabbix-server.service
├─18262 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
├─18266 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes]
├─18267 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
├─18268 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.002343 sec, idle 59 sec]
├─18269 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000765 sec, idle 5 sec]
├─18270 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.001255 sec, idle 60 sec]
├─18271 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000048 sec, idle 1 sec]
├─18273 /usr/sbin/zabbix_server: history syncer #2 [processed 0 values, 0 triggers in 0.000025 sec, idle 1 sec]
├─18275 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000024 sec, idle 1 sec]
├─18276 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000025 sec, idle 1 sec]
├─18279 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.001094 sec, idle 3 sec]
├─18280 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000022 sec, idle 5 sec]
├─18281 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000023 sec, idle 1 sec]
├─18282 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.000331 sec, idle 5 sec]
├─18286 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000032 sec, idle 2 sec]
├─18287 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000070 sec, idle 2 sec]
├─18288 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000025 sec, idle 2 sec]
├─18289 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000028 sec, idle 2 sec]
├─18290 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000016 sec, idle 2 sec]
├─18291 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000024 sec, idle 5 sec]
├─18292 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]
├─18293 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
├─18294 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
├─18295 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
├─18296 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
├─18297 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000021 sec, idle 5 sec]
├─18298 /usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.008297 sec during 5.008355 sec]
├─18299 /usr/sbin/zabbix_server: alerter #1 started
├─18302 /usr/sbin/zabbix_server: alerter #2 started
├─18303 /usr/sbin/zabbix_server: alerter #3 started
├─18304 /usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 0 values, idle 5.005554 sec during 5.005627 sec]
├─18305 /usr/sbin/zabbix_server: preprocessing worker #1 started
├─18312 /usr/sbin/zabbix_server: preprocessing worker #2 started
├─18317 /usr/sbin/zabbix_server: preprocessing worker #3 started
├─18319 /usr/sbin/zabbix_server: lld manager #1 [processed 0 LLD rules during 5.006016 sec]
├─18320 /usr/sbin/zabbix_server: lld worker #1 started
└─18322 /usr/sbin/zabbix_server: lld worker #2 started
7월 08 09:14:20 zabbix-svr systemd[1]: Starting Zabbix Server...
7월 08 09:14:20 zabbix-svr systemd[1]: Started Zabbix Server.
[root@zabbix-svr ~]#
Selinux가 설정/실행 되고 있을 경우 (optional)
[root@zabbix-svr ~]# setsebool -P zabbix_can_network on
[root@zabbix-svr ~]# setsebool -P httpd_can_connect_zabbix on
[root@zabbix-svr ~]# setsebool -P daemons_enable_cluster_mode on
[root@zabbix-svr ~]# vi zabbix_server.te
# create new
module zabbix_server 1.0;
require {
type zabbix_var_run_t;
type zabbix_t;
class sock_file { create unlink };
class unix_stream_socket connectto;
}
#============= zabbix_t ==============
allow zabbix_t self:unix_stream_socket connectto;
allow zabbix_t zabbix_var_run_t:sock_file { create unlink };
[root@zabbix-svr ~]# checkmodule -m -M -o zabbix_server.mod zabbix_server.te
checkmodule: loading policy configuration from zabbix_server.te
checkmodule: policy configuration loaded
checkmodule: writing binary representation (version 17) to zabbix_server.mod
[root@zabbix-svr ~]# semodule_package --outfile zabbix_server.pp --module zabbix_server.mod
[root@zabbix-svr ~]# semodule -i zabbix_server.pp
방화벽이 실행되고 있을 경우(optional)
[root@zabbix-svr ~]# firewall-cmd --add-service={http,https} --permanent
success
[root@zabbix-svr ~]# firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
success
[root@zabbix-svr ~]# firewall-cmd --reload
success
php time zone 변경
[root@zabbix-svr ~]# cat /etc/httpd/conf.d/zabbix.conf
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted ##특정 대역만 허용하고자 할 경우 설정 전체 대역은 all
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Seoul ### Time zone 변경
</IfModule>
</Directory>
<Directory "/usr/share/zabbix/conf">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/app">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/include">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/local">
Require all denied
</Directory>
zabbix agent 설정 및 실행
[root@zabbix-svr zabbix]# pwd
/etc/zabbix
[root@zabbix-svr zabbix]# vi zabbix_agentd.conf
~(생략)
98 Server=127.0.0.1
~(생략)
139 ServerActive=127.0.0.1
~(생략)
150 Hostname=zabbix-svr
(저장)
[root@zabbix-svr zabbix]# systemctl start zabbix-agent
[root@zabbix-svr zabbix]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@zabbix-svr zabbix]# systemctl status zabbix-agent
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: active (running) since 월 2019-07-08 09:27:46 KST; 17s ago
Main PID: 18388 (zabbix_agentd)
CGroup: /system.slice/zabbix-agent.service
├─18388 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─18389 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─18390 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─18391 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─18392 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─18393 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
7월 08 09:27:46 zabbix-svr systemd[1]: Starting Zabbix Agent...
7월 08 09:27:46 zabbix-svr systemd[1]: Started Zabbix Agent.
[root@zabbix-svr zabbix]#
Web page 접속 여부 확인
URL : http://ZABBIX_SVR_ADDRESS/zabbix
반응형
'운영체제 > Linux' 카테고리의 다른 글
[Linux - UTIL ] Zabbix admin password 변경 (0) | 2019.07.08 |
---|---|
[Linux - UTIL ] Zabbix 모니터링 tool - Initial Setup (0) | 2019.07.08 |
[Linux - UTIL] zabbix - 사전 작업 (0) | 2019.07.05 |
[Linux] DNS Server install (0) | 2019.07.02 |
[Linux] nginx 설치 (0) | 2019.06.25 |