天天看點

Zabbix篇一:服務端安裝

安裝篇

Zabbix安裝篇一:服務端安裝教程

Zabbix安裝篇二:Linux批量安裝用戶端Zabbix-agent

Zabbix安裝篇三:windows批量安裝用戶端Zabbix-agent

Zabbix安裝篇四:釘釘機器人報警

監控篇

Zabbix監控篇一:監控SQL Server資料庫

Zabbix監控篇二:監控Mariadb資料庫

Zabbix監控篇三:監控Exchange Server

Zabbix監控篇四:監控路由器

zabbix是一個基于WEB界面的提供分布式系統監視以及網絡監視功能的企業級的開源解決方案。zabbix能監視各種網絡參數,保證伺服器系統的安全營運;并提供靈活的通知機制以讓系統管理者快速定位/解決存在的各種問題。

zabbix由2部分構成,zabbix server與可選元件zabbix agent。

zabbix server可以通過SNMP,zabbix agent,ping,端口監視等方法提供對遠端伺服器/網絡狀态的監視,資料收集等功能,它可以運作在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

最近公司部署zabbix用于監控伺服器,記錄下自己操作資訊,下面是在測試環境上安裝的一個操作步驟:

一、安裝環境:

1、系統環境:CentOS Linux release 7.5.1804 (Core) 

2、zabbix版本:zabbix-release-3.4-2.el7.noarch

3、測試環境,關閉了防火牆(生産環境不建議關閉,根據需求設定防火牆)

[root@centos78 ~]# systemctl stop firewlld.service       關閉防火牆

[root@centos78 ~]# systemctl disable firewalld.service  開機禁用防火牆啟動

4、關閉Selinux

[root@centos78 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

[root@centos78 ~]# setenforce 0

二、安裝資料庫

1、指定下載下傳最新的10.2版本,編輯安裝包路徑下載下傳路徑:

 [root@centos78 ~]# vim /etc/yum.repos.d/base.repo  (沒有base.repo可以自己建立)

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.2/centos7-amd64

gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck = 1

2、安裝10.2的mariadb

yum install mariadb-server

3、設定mariadb

[root@centos78 ~]# systemctl start mariadb  啟動

[root@centos78 ~]# systemctl enable mariadb 設定開機啟動

[root@centos78 ~]# systemctl status mariadb   檢視啟動狀态

三、Zabbix3.4安裝及配置

1、下載下傳和安裝Zabbix

[root@centos78 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm  (下載下傳Zabbix最新版本)

[root@centos78 ~]# yum install zabbix-server-mysql zabbix-web-mysql -y

2、建立資料和導入資料

[root@centos78 ~]# mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 8

Server version: 10.2.17-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)]> create database zabbix character set utf8 collate utf8_bin;     建立資料庫zabbix

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';  設定zabbix權限和密碼

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit    退出

Bye

導入資料庫

[root@centos78 ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.13/create.sql.gz  |mysql -uzabbix -pzabbix zabbix

配置資料庫使用者和密碼

[root@centos78 ~]# vim /etc/zabbix/zabbix_server.conf   修改配置檔案,設定密碼

DBPassword=zabbix

[root@centos78 ~]# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf  檢視關鍵配置資訊

38:LogFile=/var/log/zabbix/zabbix_server.log

49:LogFileSize=0

72:PidFile=/var/run/zabbix/zabbix_server.pid

82:SocketDir=/var/run/zabbix

101:DBName=zabbix                       資料庫名稱

117:DBUser=zabbix                          使用者名稱

126:DBPassword=zabbix                  資料庫密碼

330:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log

448:Timeout=4

490:AlertScriptsPath=/usr/lib/zabbix/alertscripts

500:ExternalScripts=/usr/lib/zabbix/externalscripts

536:LogSlowQueries=3000

啟動zabbix和設定開機啟動

[root@centos78 ~]# systemctl start zabbix-server

[root@centos78 ~]# systemctl enable zabbix-server

編輯Zabbix前端PHP配置,更改時區

[root@centos78 ~]# vim /etc/httpd/conf.d/zabbix.conf

    <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/Shanghai           #修改為亞洲上海

    </IfModule>

啟動http和設定開啟啟動

[root@centos78 ~]# systemctl start httpd

[root@centos78 ~]# systemctl enable httpd

四、安裝Zabbix Web

1、通過浏覽器通路,并配置資訊

Zabbix篇一:服務端安裝
Zabbix篇一:服務端安裝
Zabbix篇一:服務端安裝
Zabbix篇一:服務端安裝
Zabbix篇一:服務端安裝
Zabbix篇一:服務端安裝

[root@centos78 ~]# cat /etc/zabbix/web/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';

// Schema name. Used for IBM DB2 and PostgreSQL.

$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'localhost';

$ZBX_SERVER_PORT = '10051';

$ZBX_SERVER_NAME = 'zabbix';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

登入網站:http://192.168.1.1/zabbix

登入最新版Zabbix3.4  預設使用者Admin  預設密碼zabbix