搭建Zabbix監控環境

2022-05-04 02:12:12 字數 4414 閱讀 8772

以下步驟,參考了 zabbix官方手冊

在搭建步驟之前,還是整理一下本次的監控需求。

以上,身為主流監控工具的zabbix完全可以滿足。而且,有良好的擴充套件性,可以滿足日益增長的需求。

安裝ubuntu16.04系統

見ubuntu16.04安裝說明

更新系統源

執行 sudo vi /etc/apt/sources.list,修改為:

# deb cdrom:[ubuntu 16.04 lts _xenial xerus_ - release amd64 (20160420.1)]/ xenial main restricted

deb-src xenial main restricted #added by software-properties

deb xenial main restricted

deb-src xenial main restricted multiverse universe #added by software-properties

deb xenial-updates main restricted

deb-src xenial-updates main restricted multiverse universe #added by software-properties

deb xenial universe

deb xenial-updates universe

deb xenial multiverse

deb xenial-updates multiverse

deb xenial-backports main restricted universe multiverse

deb-src xenial-backports main restricted universe multiverse #added by software-properties

deb xenial partner

deb-src xenial partner

deb xenial-security main restricted

deb-src xenial-security main restricted multiverse universe #added by software-properties

deb xenial-security universe

deb xenial-security multiverse

首先更新下apt。

執行 sudo apt-get update

然後安裝zabbix所有依賴環境(可以不帶版本號,但源裡目前使用7.0,所以就指定一下7.0 ; mysql環境設定密碼為root就可以)

sudo apt-get install apache2 mysql-server php7.0 php7.0-gd libapache2-mod-php7.0 php7.0-mysql php7.0-bcmath php7.0-mbstring php7.0-xml php7.0-ldap

dpkg -i zabbix-release_3.4-1+xenial_all.deb

sudo apt-get update

安裝zabbix的web環境(客戶機只需要安裝zabbix-agent)

sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent

sudo vim /etc/zabbix/zabbix_server.conf

修改相關

dbhost=localhost

dbname=zabbix

dbuser=zabbix

dbpassword=zabbix

#非必需,但推薦

startdiscoverers=5

mysql -u root -p

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

mysql> flush privileges;

mysql> exit;

(password是剛才設定的zabbix)

cd /usr/share/zabbix-server-mysql/

sudo gunzip *.gz

mysql -u zabbix -p zabbix < create.sql

sudo vi /etc/apache2/conf-enabled/zabbix.conf

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

(輸入系統密碼)

service zabbix-server start

sudo service apache2 restart

http://host_ip/zabbix/
(填寫mysql的密碼zabbix
填寫server_name為zabbix server)

狂點下一步。

預設登入賬號密碼 admin/zabbix

sudo vi /usr/share/zabbix/include/locales.inc.php 

第55行,'zh_cn' => ['name' => _('chinese (zh_cn)'),     'display' => true],

把display改為true,重新整理頁面即可。

如果還是不行,參考這裡

然後執行(由於koala中缺少乙個庫,需要聯網安裝)

預設配置的伺服器位址是192.168.1.200

zabbix-agent.sh

#!/bin/bash

sudoapt-getinstalllibcurl3

sudodpkg -i ~/zabbix-agent_3.4.10-1+xenial_amd64.deb

sudosed-i'97s/127.0.0.1/192.168.1.200/g'/etc/zabbix/zabbix_agentd.conf

sudosed-i'138s/127.0.0.1/192.168.1.200/g'/etc/zabbix/zabbix_agentd.conf

sudosed-i'105s/# //g'/etc/zabbix/zabbix_agentd.conf

sudosed-n'/^server=/p'/etc/zabbix/zabbix_agentd.conf

sudosed-n'/^serveractive=/p'/etc/zabbix/zabbix_agentd.conf

sudosed-n'/^listenport=/p'/etc/zabbix/zabbix_agentd.conf

sudo/etc/init.d/zabbix-agentstart

zabbix監控環境的搭建

zabbix是乙個基於web介面的提供分布式系統監視以及網路監視功能的企業級的開源解決方案。zabbix能監視各種網路引數,保證伺服器系統的安全運營 並提供柔軟的通知機制以讓系統管理員快速定位 解決存在的各種問題。zabbix是完全開源的工具,整合了cacti和nagios等特性 udp埠161,u...

zabbix監控平台搭建

zabbix服務端 1 安裝yum源配置檔案 rpm uvh yum clean all2 安裝服務端 前端和客戶端 yum y install zabbix server mysql zabbix web mysql zabbix agent3 初始化資料庫 mysql uroot p passw...

zabbix監控搭建步驟

因為zabbix需要lamp或lnmp所以先搭建環境需求。我這裡選擇lnmp。填寫內容 name nginx repo baseurl gpgcheck 0 enabled 1 replace os with rhel or centos depending on the distribution ...