目錄
1 zabbix簡介
1.zabbix 是什么
2.zabbix 能干什么
2 zabbix-server安裝
3.zabbix-agent 安裝
1 zabbix簡介
1.zabbix 是什么
中文網站介紹

2.zabbix 能干什么
指標收集:從任何設備、系統、應用程式上進行指標采集
- 多平臺Zabbix代理
- SNMP和IPMI代理
- 用戶服務無代理監控
- 自定義方法
- 計算和聚合
- 終端用戶Web監控
問題檢測:定義智能閾值
- 高度靈活的自定義選項
- 獨立的問題條件和解決條件
- 多個嚴重等級
- 根故障分析
- 例外檢測
- 趨勢預測
可視化:單一界面管理平臺
- 儀表盤小部件
- 圖表組件
- 網路拓撲圖
- 幻燈片展示
- Drill-down報表
告警和修復:確保及時、有效的告警
- 發送資訊
- 讓Zabbix自動修復問題
- 根據用戶自定義的服務級別,階梯式發送告警,靈活可控
- 根據收件人的角色自定義郵件
- 基于運行時間和資產資訊自定義訊息
安全和認證:保護您所有層級的資料
- 所有Zabbix組件之間強加密
- 多種驗證方法:Open LDAP, 活動目錄
- 靈活的用戶權限架構
- Zabbix代碼公開,可用于安全審核
輕松搭建部署:大批模板,開箱即用,節省您寶貴的時間
- 幾分鐘內即可安裝Zabbix
- Zabbix提供適用于大部分平臺的模板,開箱即用
- 自定義模板
- 來自Zabbix社區的無數模板
- 申請Zabbix原廠模板創建服務
- 套用配置模板一次性監控數千個類似設備
自動發現: 自動監控大型動態環境
- 網路發現:定期掃描、發現設備型別,IP,狀態,運行時間/停機時間等,并采取預定義的操作
- 低級別發現(LLD):自動為設備上不同元素創建監控項,觸發器和圖形
- 主動agent自動注冊 使用Zabbix agent自動開始監控新設備
分布式監控:無限制擴展
- 從數千個被監控的設備中采集資料
- 防火墻,DMZ后監控
- 即使網路例外,也可以持續采集資料
- 在受監控的主機上遠程運行自定義腳本
Zabbix API:將Zabbix集成到您IT環境的其他任何部分
- 通過API自動化Zabbix管理
- 提供200+不同的方法
- 創造全新的Zabbix+應用
- 將Zabbix與第三方軟體集成:配置管理,工單系統
- 獲取、管理配置和歷史資料
2 zabbix-server安裝
1. 安裝軟體
open-vm-tools bash-completion lrzsz tree vim wget
2.設定 hosts
[root@zabbix ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.153 zabbix
3.關閉防火墻
[root@zabbix ~]# systemctl stop firewalld
[root@zabbix ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2021-04-08 22:50:47 EDT; 10s ago
Docs: man:firewalld(1)
Process: 5795 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 5795 (code=exited, status=0/SUCCESS)
Apr 08 16:27:52 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 08 16:27:52 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Apr 08 22:50:46 zabbix systemd[1]: Stopping firewalld - dynamic firewall daemon...
Apr 08 22:50:47 zabbix systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@zabbix ~]# systemctl disable firewalld ### 永久關閉
4.關閉seLinux
[root@zabbix ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
5.下載zabbix的軟體倉庫和 安裝 zabbix
[root@zabbix software]# wget https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
[root@zabbix zabbix]# rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm
warning: zabbix-release-4.0-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-4.0-2.el7 ################################# [100%]
[root@zabbix yum.repos.d]# yum clean all # =====》 可能 rpm 依賴報錯,執行 clean all
[root@zabbix zabbix]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get
6.安裝MySQL資料庫
MySQL5.7.19安裝
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'zabbix'@'%' IDENTIFIED BY 'winner001';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@'%' identified by 'winner001';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
7.將表匯入到 zabbix
[root@zabbix zabbix]# zcat /usr/share/doc/zabbix-server-mysql-4.0.30/create.sql.gz | mysql -uzabbix -pwinner001 -Dzabbix
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zabbix zabbix]# mysql -uzabbix -pwinner001 -Dzabbix
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.19 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> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
8.設定組態檔
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
9.zabbix.conf 組態檔
兩個時區都要設定
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
[root@zabbix zabbix]# vim /etc/php.ini
date.timezone=Asia/Shanghai
10.啟動服務
[root@zabbix zabbix]# systemctl status httpd
[root@zabbix zabbix]# systemctl enable httpd
[root@zabbix zabbix]# systemctl restart zabbix-server
[root@zabbix zabbix]# 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 zabbix]# systemctl status zabbix-server
[root@zabbix zabbix]#
11.zabbix 初始化設定

12.Check of pre-requisites

13.MySQL zabbix庫連接

如果連接資訊不對或者資料庫連接不上,會報錯
14. 配置 安裝資訊總覽


15.使用默認的賬號密碼登錄
賬號:Admin
密碼:zabbix
16.設定語言

3 zabbix-agent 安裝
1.三臺機器

2.下載RPM包并安裝
[root@hdp105 ~]# wget https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
--2021-04-10 01:06:30-- https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
Resolving repo.zabbix.com (repo.zabbix.com)... 178.128.6.101, 2604:a880:2:d0::2062:d001
Connecting to repo.zabbix.com (repo.zabbix.com)|178.128.6.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13800 (13K) [application/x-redhat-package-manager]
Saving to: ‘zabbix-release-4.0-2.el7.noarch.rpm’
100%[=========================================================================================================>] 13,800 --.-K/s in 0s
2021-04-10 01:06:36 (408 MB/s) - ‘zabbix-release-4.0-2.el7.noarch.rpm’ saved [13800/13800]
[root@hdp105 ~]# rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm
warning: zabbix-release-4.0-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-4.0-2.el7 ################################# [100%]
[root@hdp105 ~]# yum -y install zabbix-agent
3.修改組態檔
- Server是指被動監測,服務器主動的向被監控主機查詢資料
- ServerActive是主動監測,服務器被動的接收資料,被監控主機主動向服務器提供資料
- Hostname是制定被監控主機的名字,服務器將以這個名字作為唯一標識
[root@hdp105 ~]# vim /etc/zabbix/zabbix_agentd.conf
### Option: Hostname
# Value is acquired from HostnameItem if undefined.
# Hostname=
Server=192.168.2.153
### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
# HostnameItem=system.hostname
# Aliases can be used in HostMetadataItem but not in HostnameItem parameters.
# Hostname=
Hostname=hdp105
[root@hdp105 ~]#
?
4.啟動服務
[root@hdp105 ~]# systemctl restart zabbix-agent.service
[root@hdp105 ~]# systemctl enable zabbix-agent.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@hdp105 ~]# systemctl status zabbix-agent.service
5.查看10050埠是否開啟

6.在zabbix服務器上測驗客戶端是否正常運行
# hdp104 為 zabbix server
[root@hdp104 ~]# zabbix_get -s 192.168.2.154 -k agent.hostname
hdp105
7.在服務器上添加被監控主機

8.查看被監控主機

9.創建監控項

10.隨便啟動一個行程
[root@hdp105 ~]# cat helloSleep.sh
echo "haha"
sleep 3h
echo "呵呵呵"
[root@hdp105 ~]# ps -ef | grep helloSleep
root 3029 6618 0 02:41 pts/0 00:00:00 grep --color=auto helloSleep
root 15808 12565 0 01:48 pts/1 00:00:00 sh helloSleep.sh
11.zabbbix-server 查看行程狀態是否可以獲取
[root@hdp104 ~]# zabbix_get -s 192.168.2.154 -p 10050 -k "proc.num[,,,helloSleep]"
1
[root@hdp104 ~]#
12.web 中查看

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/274857.html
標籤:其他
上一篇:關于部署springboot+jsp專案時打jar包無法訪問靜態資源的問題
下一篇:dice_game攻防世界進階區

