Mở đầu
Zabbix là gì?
Zabbix là một phần mềm doanh nghiệp mã nguồn mở giám sát các mạng và ứng dụng, được tạo ra bởi Alexei Vladishev và được công bố lần đầu tiên vào năm 2001. Nó được thiết kế để giúp admin mạng giám sát và theo dõi tình trạng của các dịch vụ mạng, máy chủ và phần cứng mạng khác một cách thông minh nhằm đảm bảo hệ thống luôn luôn được ổn định. – Theo Wikipedia
Các thành phần của zabbix bào gồm:
- Zabbix Server
- Zabbix frontend (chạy trên webserver LEMP hoặc LAMP)
- Zabbix agent
Nếu bạn nào đã thạo cài webserver thì có thể bỏ qua bước cài đặt này, còn trong bài viết chúng ta sẽ cài đặt mọi thứ từ đầu.
Chuẩn bị hệ thống:
Vmware image: CENTOS 6.9, IP: 192.168.32.142
Hướng dẫn cài đặt zabbix server
Cấu hình tối thiểu để cài zabbix:
Name | Platform | CPU/Memory | Database | Monitored hosts |
---|---|---|---|---|
Small | CentOS | Virtual Appliance | mysql InnoDB | 100 |
Medium | CentOS | 2 CPU cores/2GB | MySQL InnoDB | 500 |
Large | RedHat Enterprise Linux | 4 CPU cores/8GB | RAID10 MySQL InnoDB or PostgreSQL | >1000 |
Very large | RedHat Enterprise Linux | 8 CPU cores/16GB | Fast RAID10 MySQL InnoDB or PostgreSQL | >10000 |
Bước 1: cài đặt webserver.
Trong ví dụ, ta sẽ cài dặt webserver apache, PHP5.6 và MySql 5.6
Cài đặt MySql 5.6
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm rpm -ivh mysql57-community-release-el6-11.noarch.rpm rpm -ivh epel-release-latest-6.noarch.rpm
Sửa Nội dung file /etc/yum.repos.d/mysql-community.repo, dòng 27 sửa thành enable=1
[mysql-connectors-community] name=MySQL Connectors Community baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql-tools-community] name=MySQL Tools Community baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql # Enable to use MySQL 5.5 [mysql55-community] name=MySQL 5.5 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql # Enable to use MySQL 5.6 [mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql80-community] name=MySQL 8.0 Community Server baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql-tools-preview] name=MySQL Tools Preview baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/6/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql-cluster-7.5-community] name=MySQL Cluster 7.5 Community baseurl=http://repo.mysql.com/yum/mysql-cluster-7.5-community/el/6/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql-cluster-7.6-community] name=MySQL Cluster 7.6 Community baseurl=http://repo.mysql.com/yum/mysql-cluster-7.6-community/el/6/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Cài đặt MySql thông qua yum:
yum install mysql-community-server mysql-community-devel
Chạy MySQL:
service mysql start mysql_secure_installation
Cài đặt PHP 5.6
Mặc định, trên centos 6 chỉ có thể cài php5.3 qua yum, để cài php5.6 ta phải sử dụng repository khác.
wget https://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm
Sửa Nội dung: /etc/yum.repos.d/remi.repo dòng 30 sửa enable=1
# Repository: http://rpms.remirepo.net/ # Blog: http://blog.remirepo.net/ # Forum: http://forum.remirepo.net/ [remi] name=Remi's RPM repository for Enterprise Linux 6 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/ #mirrorlist=https://rpms.remirepo.net/enterprise/6/remi/httpsmirror mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-php55] name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/6/php55/$basearch/ #mirrorlist=https://rpms.remirepo.net/enterprise/6/php55/httpsmirror mirrorlist=http://rpms.remirepo.net/enterprise/6/php55/mirror # NOTICE: common dependencies are in "remi-safe" enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-php56] name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/ #mirrorlist=https://rpms.remirepo.net/enterprise/6/php56/httpsmirror mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror # NOTICE: common dependencies are in "remi-safe" enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-test] name=Remi's test RPM repository for Enterprise Linux 6 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/6/test/$basearch/ #mirrorlist=https://rpms.remirepo.net/enterprise/6/test/mirror mirrorlist=http://rpms.remirepo.net/enterprise/6/test/mirror # WARNING: If you enable this repository, you must also enable "remi" enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-debuginfo] name=Remi's RPM repository for Enterprise Linux 6 - $basearch - debuginfo baseurl=http://rpms.remirepo.net/enterprise/6/debug-remi/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-php55-debuginfo] name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch - debuginfo baseurl=http://rpms.remirepo.net/enterprise/6/debug-php55/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-php56-debuginfo] name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch - debuginfo baseurl=http://rpms.remirepo.net/enterprise/6/debug-php56/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-test-debuginfo] name=Remi's test RPM repository for Enterprise Linux 6 - $basearch - debuginfo baseurl=http://rpms.remirepo.net/enterprise/6/debug-test/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Cài đặt PHP 5.6 qua yum:
yum install php php-cli php-common php-devel php-pear php-fpm php-gd php-bcmath php-mbstring php-xml php-mysql php-xmlwriter php-ldap
Cài đặt apache HTTP server:
yum install httpd httpd-devel
Cấu hình lại thông số php trong file /etc/php.ini cho phù hợp với yêu cầu của zabbix:
sed -i 's/^max_execution_time.*/max_execution_time=300/' /etc/php.ini sed -i 's/^max_input_time.*/max_input_time=300/' /etc/php.ini sed -i 's/^post_max_size.*/post_max_size=32M/' /etc/php.ini sed -i 's/^upload_max_filesize.*/upload_max_filesize=16M/' /etc/php.ini sed -i "s/^\;date.timezone.*/date.timezone=\'Asia\/Bangkok\'/" /etc/php.ini sed -i "s/^\;always_populate_raw_post_data.*/always_populate_raw_post_data=-1/" /etc/php.ini
Đổi port mặc định của webserver để tăng bảo mật:
sed -i "s/^\Listen.*/Listen 8889/" /etc/httpd/conf/httpd.conf echo "ServerName 127.0.0.1" >> /etc/httpd/conf/httpd.conf
Khởi chạy web server:
service httpd start
Kiểm tra web server & PHP đã chạy chưa:
echo "<?php phpinfo(); ?>" > /var/www/html/info.php curl -I localhost:8889/info.php
HTTP/1.1 200 OK Date: Thu, 09 Nov 2017 09:47:57 GMT Server: Apache/2.2.15 (CentOS) X-Powered-By: PHP/5.6.31 Connection: close Content-Type: text/html; charset=UTF-8
Bước 2: Cài đặt zabbix server & zabbix agent
Tải source Zabbix:
Các phiên bản Zabbix có thể tại tại:
https://sourceforge.net/projects/zabbix/files/
Tải Bản mới nhất: 3.4.2:
https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.2/zabbix-3.4.2.tar.gz
cd /usr/local/src/ wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.2/zabbix-3.4.2.tar.gz
Xả nén bộ cài:
tar -xzvf zabbix-3.4.2.tar.gz
Cài đặt Cơ sở dữ liệu cho Zabbix
* Tạo CSDL zabbix:
# mysql -u root -p
create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by '123456'; flush privileges;
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 5.6.37 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye
* Import cấu trúc CSDL của zabbix :
cd /usr/local/src/zabbix-3.4.2/database/mysql/ mysql -u root -p -D zabbix < schema.sql mysql -u root -p -D zabbix < images.sql mysql -u root -p -D zabbix < data.sql
Build Zabbix server và cấu hình:
* Cài đặt các thư viện cần thiết để build source:
# yum install gcc make libxml2-devel net-snmp-devel libcurl-devel libssh2-devel libevent-devel pcre-devel iksemel-devel java-1.8.0-openjdk-devel openldap-devel openssl-devel
* Tiến hành build source:
groupadd zabbix useradd -g zabbix zabbix cd /usr/local/src/zabbix-3.4.2 ./configure --enable-server --enable-agent --prefix=/usr/local --sysconfdir=/etc/zabbix --enable-java --with-mysql --with-jabber --with-libcurl --with-net-snmp --with-ldap --with-iconv --with-libxml2 --with-openssl make make install chown zabbix:zabbix /var/log/zabbix/ mkdir /var/run/zabbix/ chown zabbix:zabbix /var/run/zabbix/
* Sửa file /etc/zabbix/zabbix_server.conf thành:
LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=500 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456 PidFile=/var/run/zabbix/zabbix_server.pid
* Sửa file /etc/zabbix/zabbix_agentd.conf thành:
# This is a configuration file for Zabbix agent daemon (Unix) # To get more information about Zabbix, visit http://www.zabbix.com LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=200 PidFile=/var/run/zabbix/zabbix_agent.pid Server=127.0.0.1 StartAgents=5 ServerActive=127.0.0.1 Hostname=ZabbixServer BufferSend=15 BufferSize=300 MaxLinesPerSecond=40 ############ ADVANCED PARAMETERS ################# Timeout=5 User=zabbix Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf
* Tạo file init script: /etc/init.d/zabbix-server
#!/bin/bash # # zabbix_server This shell script takes care of starting # and stopping Zabbix Server daemon # # chkconfig: 35 96 14 # description: ZABBIX is an all-in-one 24x7 monitoring system # # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 # Setting up configuration ZABBIX_NAME="zabbix_server" ZABBIX_CONF="/usr/local/etc/$ZABBIX_NAME.conf" if [ ! -f $ZABBIX_CONF ] then echo "$ZABBIX_NAME configuration file $ZABBIX_CONF does not exist. " exit 3 fi # Source config file to load configuration . $ZABBIX_CONF ZABBIX_USER="zabbix" ZABBIX_BIND="/usr/local/sbin" ZABBIX_BINF="$ZABBIX_BIND/$ZABBIX_NAME" if [ ! -x $ZABBIX_BINF ] ; then echo "$ZABBIX_BINF not installed! " exit 4 fi ZABBIX_LOGD="`dirname $LogFile`" ZABBIX_LOGF="$LogFile" if [ -z $ZABBIX_LOGF ] then echo "LogFile path is not specified in $ZABBIX_CONF" exit 5 fi ZABBIX_PIDF="$PidFile" if [ -z $ZABBIX_PIDF ] then echo "LogFile path is not specified in $ZABBIX_CONF" exit 5 fi # Functions runcheck() { [ ! -f $ZABBIX_PIDF ] && return 0 PID=`cat $ZABBIX_PIDF` checkpid $PID [ $? -ne 0 ] && rm -f $ZABBIX_PIDF } pidofzab() { pidofproc -p "$ZABBIX_PIDF" $ZABBIX_NAME } start() { # Start daemons. echo -n $"Starting $ZABBIX_NAME: " if [ -n "`pidofzab`" ]; then echo -n "$ZABBIX_NAME: already running" failure echo return 1 fi if [ ! -d $ZABBIX_LOGD ]; then mkdir -p $ZABBIX_LOGD chown $ZABBIX_USER $ZABBIX_LOGD fi runcheck daemon --user $ZABBIX_USER $ZABBIX_BINF -c $ZABBIX_CONF RETVAL=$? if [ -f $ZABBIX_PIDF ]; then chown $ZABBIX_USER $ZABBIX_PIDF fi echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$ZABBIX_NAME return $RETVAL } stop() { # Stop daemons. echo -n $"Shutting down $ZABBIX_NAME: " killproc $ZABBIX_NAME RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$ZABBIX_NAME return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop usleep 1000000 start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/$ZABBIX_NAME ]; then stop usleep 1000000 start RETVAL=$? fi ;; status) status $ZABBIX_NAME RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL
*Tạo file init script: /etc/init.d/zabbix_agentd có nội dung:
#!/bin/bash # # zabbix_agentd This shell script takes care of starting # and stopping Zabbix Agent daemon # # chkconfig: 35 95 15 # description: ZABBIX is an all-in-one 24x7 monitoring system # # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 # Setting up configuration ZABBIX_NAME="zabbix_agentd" ZABBIX_CONF="/etc/zabbix/$ZABBIX_NAME.conf" if [ ! -f $ZABBIX_CONF ] then echo "$ZABBIX_NAME configuration file $ZABBIX_CONF does not exist. " exit 3 fi # Source config file to load configuration . $ZABBIX_CONF ZABBIX_USER="zabbix" ZABBIX_BIND="/usr/local/sbin" ZABBIX_BINF="$ZABBIX_BIND/$ZABBIX_NAME" if [ ! -x $ZABBIX_BINF ] ; then echo "$ZABBIX_BINF not installed! " exit 4 fi ZABBIX_LOGD="`dirname $LogFile`" ZABBIX_LOGF="$LogFile" if [ -z $ZABBIX_LOGF ] then echo "LogFile path is not specified in $ZABBIX_CONF" exit 5 fi ZABBIX_PIDF="$PidFile" if [ -z $ZABBIX_PIDF ] then echo "LogFile path is not specified in $ZABBIX_CONF" exit 5 fi # Functions runcheck() { [ ! -f $ZABBIX_PIDF ] && return 0 PID=`cat $ZABBIX_PIDF` checkpid $PID [ $? -ne 0 ] && rm -f $ZABBIX_PIDF } pidofzab() { pidofproc -p "$ZABBIX_PIDF" $ZABBIX_NAME } start() { # Start daemons. echo -n $"Starting $ZABBIX_NAME: " if [ -n "`pidofzab`" ]; then echo -n "$ZABBIX_NAME: already running" failure echo return 1 fi if [ ! -d $ZABBIX_LOGD ]; then mkdir -p $ZABBIX_LOGD chown $ZABBIX_USER $ZABBIX_LOGD fi runcheck daemon --user $ZABBIX_USER $ZABBIX_BINF -c $ZABBIX_CONF RETVAL=$? if [ -f $ZABBIX_PIDF ]; then chown $ZABBIX_USER $ZABBIX_PIDF fi echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$ZABBIX_NAME return $RETVAL } stop() { # Stop daemons. echo -n $"Shutting down $ZABBIX_NAME: " killproc $ZABBIX_NAME RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$ZABBIX_NAME return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop usleep 1000000 start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/$ZABBIX_NAME ]; then stop usleep 1000000 start RETVAL=$? fi ;; status) status $ZABBIX_NAME RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL
* Chạy server & agent:
server zabbix_server start service zabbix_agentd start
Cài đặt zabbix web frontend:
* Copy frontend source code vào thư mục chứa website:
mkdir /var/www/html/zabbix cp -a /usr/local/src/zabbix-3.4.2/frontends/php/* /var/www/html/zabbix chown -R apache:apache /var/www/html/zabbix/
Kết thúc việc cài đặt zabbix, tiếp theo t a sẽ cấu hình zabbix frontend kết nối với zabbix_server
Bước 3: Cấu hình zabbix Frontend.
Truy cập địa chỉ http://192.168.32.142:8889/zabbix
Sử dụng đăng nhập mặc đinh:
username: Admin
Password: zabbix
Cấu hình theo hình ảnh:
Kết Luận
Qua một bài viết dài, chúng ta đã nắm được cách cài đặt zabbix server và cấu hình client bằng zabbix agent. Nếu bạn nào có nhu cầu tìm hiểu thêm có thể theo dõi thêm một số bài viết sau: cách monitor server windows/linux bằng agent, snmp, cấu hình gửi cảnh báo qua mail, sms.
Với bạn nào “lười” cài đặt từ source code, mình có build 1 script cài đặt tự động trên debian 9: các bạn có thể tham khảo.
Xem thêm ứng dụng zabbix vào: Theo dõi nhiệt độ và độ ẩm môi trường với Zabbix hoặc Giám sát máy chủ bằng zabbix server qua agent
zabbix_auto.sh
#!/bin/sh #Script Description: Auto Install Zabbix server & Zabbix Agent on debian 9 Stretch. The default Zabbiz version is 3.x, php7.0 and Mariadb 10.x #Version: 1.0.0 #Author: [email protected], redistributed from : https://www.hiroom2.com # set -e #get random string for SQL & Zabbix password and stored to variable MYSQL_VERSION=5.5 [ -z "${MYSQL_PASSWD}" ] && MYSQL_PASSWD=`date +%s | sha256sum | base64 | head -c 15 ; echo` [ -z "${ZABBIX_PASSWD}" ] && ZABBIX_PASSWD=`date +%s | md5sum | base64 | head -c 15 ; echo` # write password to file for later use cat > "/root/zbinstallpwd.txt" <<END ==MYSQL ROOT PASSWORD:== $MYSQL_PASSWD ==ZABBIX_SQL_PASSWORD:== $ZABBIX_PASSWD END zabbix_server_install() { cat <<EOF | debconf-set-selections mysql-server-${MYSQL_VERSION} mysql-server/root_password password ${MYSQL_PASSWD} mysql-server-${MYSQL_VERSION} mysql-server/root_password_again password ${MYSQL_PASSWD} EOF apt-get install -y zabbix-server-mysql zabbix-frontend-php \ php-mysql libapache2-mod-php cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf \ /etc/apache2/conf-available/zabbix-frontend-php.conf a2enconf zabbix-frontend-php timezone=$(cat /etc/timezone) sed -e 's/^post_max_size = .*/post_max_size = 16M/g' \ -e 's/^max_execution_time = .*/max_execution_time = 300/g' \ -e 's/^max_input_time = .*/max_input_time = 300/g' \ -e "s:^;date.timezone =.*:date.timezone = \"${timezone}\":g" \ -i /etc/php/7.0/apache2/php.ini cat <<EOF | mysql -uroot -p${MYSQL_PASSWD} create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by '${ZABBIX_PASSWD}'; exit EOF for sql in schema.sql.gz images.sql.gz data.sql.gz; do zcat /usr/share/zabbix-server-mysql/"${sql}" | \ mysql -uzabbix -p${ZABBIX_PASSWD} zabbix; done sed -e 's/# ListenPort=.*/ListenPort=10051/g' \ -e "s/# DBPassword=.*/DBPassword=${ZABBIX_PASSWD}/g" \ -i /etc/zabbix/zabbix_server.conf # Skip setup.php cat <<EOF | tee /etc/zabbix/zabbix.conf.php <?php // Zabbix GUI configuration file. global \$DB; \$DB['TYPE'] = 'MYSQL'; \$DB['SERVER'] = 'localhost'; \$DB['PORT'] = '0'; \$DB['DATABASE'] = 'zabbix'; \$DB['USER'] = 'zabbix'; \$DB['PASSWORD'] = '${ZABBIX_PASSWD}'; // Schema name. Used for IBM DB2 and PostgreSQL. \$DB['SCHEMA'] = ''; \$ZBX_SERVER = 'localhost'; \$ZBX_SERVER_PORT = '10051'; \$ZBX_SERVER_NAME = ''; \$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?> EOF a2enmod ssl a2ensite default-ssl systemctl enable apache2 zabbix-server systemctl restart apache2 zabbix-server } zabbix_agent_install() { # This Hostname is used for Host name in # Configuration -> Hosts -> Create Host. apt-get install -y zabbix-agent sed -e "s/^Hostname=.*/Hostname=localhost/g" \ -i /etc/zabbix/zabbix_agentd.conf } zabbix_main() { zabbix_server_install zabbix_agent_install } zabbix_main
6 comments
Pingback: Giám sát máy chủ bằng zabbix server qua agent - Blog quản trị hệ thống
Pingback: Thiết lập cảnh báo hệ thống bằng zabbix qua email - Blog quản trị hệ thống
Pingback: Thiết lập cảnh báo hệ thống bằng zabbix qua sms - Blog quản trị hệ thống
Pingback: Thiết lập cảnh báo hệ thống bằng Zabbix qua SMS | bmkhoi
Pingback: Hướng dẫn cài sms gateway với usb 3g - Blog quản trị hệ thống
Pingback: Thiết lập cảnh báo hệ thống bằng zabbix qua sms | Cong Nghe Thong Tin - Quang Tri He Thong