CentOS 7.3安裝Zabbix 3.2
一、準備搭建環(huán)境
1.系統(tǒng):CentOS 7.3
2.軟件:Zabbix 3.2
主機 IP地址 系統(tǒng)
Zabbix Server 10.10.1.113 CentOS 7.3
Linux-Agent 10.10.10.114 CentOS 7.3
二、安裝前的準備
最小化安裝CentOS 7系統(tǒng)時,需要做一下設置:
1.安裝所需的軟件包
yum groupinstall "Development Tools"
yum -y install vim lrzsz tree wget ntp mlocate
ntpdate time.nist.gov #與時間同步服務器同步
2.關閉firewalld和iptables防火墻服務
centos從7開始默認用的是firewalld,這個是基于iptables的,雖然有iptables的核心,但是
iptables的服務是沒安裝的。所以你只要停止firewalld服務即可:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啟動
firewall-cmd --state #查看默認防火墻狀態(tài)(關閉后顯示notrunning,開啟后顯示running)
如果你要改用iptables的話,需要安裝iptables服務:
yum install iptables-services
systemctl enable iptables
systemctl enable ip6tables
systemctl start iptables
systemctl start ip6tables
3.關閉SElinux
使用這個命令查看SElinux狀態(tài)
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# vim /etc/selinux/config
#在文件中找到這一行
SELINUX=enforcing
#把后面的參數(shù)修改為disabled
SELinux=disabled
enforcing:開啟防火墻
permissive:關閉防火墻,但是會產生相應的日志
disabled:徹底關閉防火墻,沒日志產生
不關機情況下關閉SElinux,這個在重啟之后會失效,臨時關閉
[root@localhost ~]# setenforce 0
三、安裝Zabbix3.2
1.安裝LAMP環(huán)境
yum -y install mariadb mariadb-server php php-mysql httpd
#配置數(shù)據庫開機啟動
systemctl enable mariadb
systemctl start mariadb
#配置Apache服務開機自啟
systemctl enable httpd
systemctl start httpd
2.配置數(shù)據庫
查看MariaDB數(shù)據庫在進程的狀態(tài)
[root@localhost ~]# ss -tulnp | grep mysqld
tcp LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=2674,fd=14))
初始化mysql數(shù)據庫,并配置root用戶密碼(默認為空密碼)
mysql_secure_installation會執(zhí)行以下幾個設置:
a)為root用戶設置密碼
b)刪除匿名賬號
c)取消root用戶遠程登錄
d)刪除test庫和對test庫的訪問權限
e)刷新授權表使修改生效
[root@localhost ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
創(chuàng)建zabbix數(shù)據庫及訪問用戶
mysql -uroot -proot -e "create database zabbix default character set utf8 collate utf8_bin;"
mysql -uroot -proot -e "grant all on zabbix.* to 'zabbix'@'%' identified by 'zabbix';"
測試剛創(chuàng)建的數(shù)據庫及用戶
mysql -uzabbix -pzabbix
show databases;
exit;
3.安裝Zabbix Server端
導入yum源
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
安裝Zabbix
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
導入zabbix數(shù)據結構
[root@localhost ~]# updatedb #生成查找快照
[root@localhost ~]# locate create.sql #查找create.sql文件位置
/usr/share/doc/zabbix-server-mysql-3.2.7/create.sql.gz
[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.7
[root@localhost zabbix-server-mysql-3.2.7]# zcat create.sql.gz | mysql -uroot -proot zabbix
修改Zabbix Server配置文件
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
新增如下內容:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
修改Zabbix的php配置文件
vim /etc/httpd/conf.d/zabbix.conf
取消內容為:php_value date.timezone的注釋,并調整值為:Asia/Shanghai
啟動Zabbix-Server,設置為開機自啟動
[root@localhost ~]# systemctl enable zabbix-server
[root@localhost ~]# systemctl start zabbix-server
[root@localhost ~]# systemctl enable zabbix-agent
[root@localhost ~]# systemctl start zabbix-agent
重啟Apache服務器
[root@localhost ~]# systemctl restart httpd
瀏覽器訪問Zabbix-Server,進一步安裝Zabbix
使用http://IP/zabbix訪問

檢查組件是否所有ok,直接下一步

創(chuàng)建數(shù)據庫的連接:輸入端口號和密碼



完成安裝

默認登錄賬戶密碼:Admin/zabbix

設置語言為中文:Chinese(zh_CN


簡單設置一下,啟用Zabbix Server的監(jiān)控

解決亂碼問題

解決辦法如下:
在Windows系統(tǒng)下Win+R打開運行,輸入fonts,回車進入Windows字體目錄,找到
黑體-常規(guī),復制出來將文件名修改為simhei.ttf,然后上傳到/usr/share/zabbix/fonts

[root@localhost ~]# cd /usr/share/zabbix/fonts
[root@localhost fonts]# rz #上傳simheil.ttf字體
[root@localhost fonts]# ls
graphfont.ttf simhei.ttf
上傳成功后,編輯 /usr/share/zabbix/include/defines.inc.php這個文件
大約在45行,將'graphfont' 修改為simhei 。
[root@localhost fonts]# vim /usr/share/zabbix/include/defines.inc.php
44 define('ZBX_FONTPATH', realpath('fonts')); // where to search for font (GD > 2.0.18)
45 define('ZBX_GRAPH_FONT_NAME', 'simhei'); // font file name
46 define('ZBX_GRAPH_LEGEND_HEIGHT', 120); // when graph height is less then this value, some legend will not show up

修改完成后,刷新亂碼就好了。
四、安裝Zabbix-agent
1.監(jiān)控Linux系統(tǒng)配置
客戶端CentOS 7.3系統(tǒng)
(1). 導入yum源
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
(2). 安裝zabbix-agent
yum -y install zabbix-agent
(3). 配置zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
Server=10.10.10.113
ServerActive=10.10.10.113
Hostname=10.10.10.114
修改Server的IP,地址為服務端地址:Server=ServerIP
修改ServerAcive的IP,地址為服務端地址:ServerActive=ServerIP
Hostname修改為網頁里面添加的Hostname,需要保持一致,zabbix_agentd客戶端計算機名:Hostname=Zabbix server
設置為0 僅為主動模式,如果需要發(fā)送數(shù)據等 可以不修改此項:StartAgents=0
(4). 啟動zabbix-agent,并配置開機啟動
systemctl enable zabbix-agent
systemctl start zabbix-agent
服務端配置監(jiān)控Linux主機
配置 --> 主機 --> 創(chuàng)建主機

創(chuàng)建主機后,選擇主機選項,然后填寫:主機名稱、可見的名稱、群組、agent代理程序的接口IP,這幾項添寫就OK了

然后再添加模板

然后勾選剛剛添加的主機,點擊"啟用"

從拓撲圖里右鍵可以查看主機聚合圖形,具體查看Linux主機監(jiān)控指標的圖表

添加網絡拓撲圖 --> 更新

2.監(jiān)控Windows系統(tǒng)配置
(1). 下載文件: http://www.zabbix.com/downloads/3.2.0/zabbix_agents_3.2.0.win.zip
(2). 解壓到C盤根目錄,再修改文件:zabbix_agents_3.2.0.win/conf/zabbix_agentd.win.conf
Server=10.10.10.113
ServerActive=10.10.10.113
Hostname=Windows Server
(3).修改完后,"Win+R"打開cmd命令行運行安裝Zabbix Agent服務注冊,啟動一下
# 安裝注冊服務
c:\zabbix_agents_3.2.0.win\bin\win64\zabbix_agentd.exe -i -c c:\zabbix_agents_3.2.0.win\conf\zabbix_agentd.win.conf
# 刪除注冊服務
c:\zabbix_agents_3.2.0.win\bin\win64\zabbix_agentd.exe -d -c c:\zabbix_agents_3.2.0.win\bin\win64\zabbix_agentd.win.conf


(4).在服務端"配置" --> "主機" --> "創(chuàng)建主機"


最后再"配置" --> "主機"里勾選"[Windows Server測試主機]"啟用,一會就可以看到圖形
從拓撲圖里右鍵可以查看主機聚合圖形,具體查看Windows主機監(jiān)控指標的圖表

添加網絡拓撲圖 --> 更新

五、安裝圖形展示
1.趨勢圖集中顯示Graphtree插件
插件地址:https://github.com/OneOaaS/graphtrees
(1).在Server上配置,下載補丁并升級
cd /usr/share/zabbix
wget https://raw.githubusercontent.com/OneOaaS/graphtrees/master/graphtree3.0.4.patch
yum install -y patch #安裝打補丁path包,安裝過可忽略
patch -Np0 <graphtree3.0.4.patch
chown -R apache:apache oneoaas/ #設置權限,注意此處的權限,必須和nginx或者apache的用戶一致
(2).安裝好后,會在主頁顯示Graphtree插件


(3).刪除廣告信息
vim /usr/share/zabbix/oneoaas/templates/graphtree/graphtree.tpl
刪除頂部圖片8-12行和66-86底部廣告
66 <footer id="footer" class="footer navbar-inverse">
61 <div class="container">
62 <ul>
63 <li class="qrcode">
64 
65 <p>專業(yè) 合作 開放 </p>
66 <p>運維方案解決專家</p>
67 </li>
68 <li class="business">
69 <p>Zabbix監(jiān)控項目承接</p>
70 <p>運維解決方案咨詢</p>
71 <p>運維產品咨詢</p>
72 <p><a href="[http://www.oneoaas.com](http://www.oneoaas.com/)">[www.oneoaas.com](http://www.oneoaas.com/)</a></p>
73 <p>請聯(lián)系 support#[oneoaas.com](http://oneoaas.com/) (#替換為@)
74 </li>
……………
(4).重新載入Zabbix-web,可以看到Graphtree已出效果;
systemctl restart httpd

2.安裝Grafana 4實現(xiàn)可視化圖形監(jiān)控
Grafana 是 Graphite 和 InfluxDB 儀表盤和圖形編輯器。Grafana 是開源的,功能齊全的
度量儀表盤和圖形編輯器,支持 Graphite,InfluxDB 和 OpenTSDB。
Grafana 主要特性:靈活豐富的圖形化選項;可以混合多種風格;支持白天和夜間模式;
多個數(shù)據源;Graphite 和 InfluxDB 查詢編輯器等等。
安裝Grafana
(1).安裝服務端圖形呈現(xiàn)依賴包
yum install fontconfig
yum install freetype*
yum install urw-fonts
yum install initscripts
(2). 在服務端安裝Grafana 4.4.3
#使用yum源安裝
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.4.3-1.x86_64.rpm
#使用rpm安裝
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.4.3-1.x86_64.rpm
rpm -Uvh grafana-4.4.3-1.x86_64.rpm
(4).啟動Grafana并設置開機啟動
systemctl daemon-reload #重新載入服務
systemctl start grafana-server
systemctl status grafana-server
systemctl enable grafana-server.service
(5).查看安裝包位置
[root@localhost ~]# rpm -qc grafana
/etc/init.d/grafana-server
/etc/sysconfig/grafana-server
/usr/lib/systemd/system/grafana-server.service

(6). 訪問Grafana
地址:http://ServerIP:3000
默認登錄用戶名密碼:admin/admin

為Grafana安裝Zabbix插件
(1). grafana-zabbix插件安裝有好幾種方式:
# 第一種:使用grafana-cli工具安裝
獲取可用插件列表命令
grafana-cli plugins list-remote
安裝zabbix插件命令
grafana-cli plugins install alexanderzobnin-zabbix-app
安裝插件完成之后重啟garfana服務
systemctl restart grafana-server
service grafana-server restart
# 第二種:使用grafana-zabbix-app源,其中包含最新版本的插件
cd /var/lib/grafana/plugins/
克隆grafana-zabbix-app插件項目
git clone https://github.com/alexanderzobnin/grafana-zabbix-app
注:如果沒有git,請先安裝git
yum –y install git
插件安裝完成重啟garfana服務
systemctl restart grafana-server
service grafana-server restart
注:通過這種方式,可以很容易升級插件
$ cd /var/lib/grafana/plugins/grafana-zabbix-app
$ git pull
$ service grafana-server restart
# 第三種:使用源碼包安裝(一般沒有必要)
需要安裝NodeJS, npm和Grunt 從源碼構建插件,更多安裝方法可以查看Grafana docs.
git clone https://github.com/alexanderzobnin/grafana-zabbix.git
cd grafana-zabbix
npm install
npm install -g grunt-cli
grunt #插件將建成dist/目錄。然后你可以將它復制到你的grafana插件目錄或在grafana配
置文件中指定編譯插件的路徑
如果需要更新,執(zhí)行下面命令
git pull
Grunt
重啟grafana服務
systemctl restart grafana-server
service grafana-server restart
這里使用grafana-cli工具安裝的
# 安裝grafana-zabbix插件:
[root@localhost plugins]# grafana-cli plugins install alexanderzobnin-zabbix-app
# 以下插件可以根據自己所需安裝
# 安裝grafana-clock-panel鐘表形展示
[root@localhost plugins]# grafana-cli plugins install grafana-clock-panel
#安裝briangann-gauge-panel字符型展示
[root@localhost plugins]# grafana-cli plugins install briangann-gauge-panel
#安裝natel-discrete-panel服務器狀態(tài)
[root@localhost plugins]# grafana-cli plugins install natel-discrete-panel
#安裝grafana-worldmap-panel世界地圖插件
grafana-cli plugins install grafana-worldmap-panel
[root@localhost plugins]# systemctl restart grafana-server
為Grafana安裝Zabbix插件

(2).到網站管理控制臺啟用zabbix插件
移動到grafana左側面板的插件,選擇應用程序選項卡,然后選擇"Apps"選項卡,打開Zabbix,啟用插件


(3).添加Zabbix為數(shù)據源
點擊左側的"Data Sources" --> "Add data source"
默認的接口地址:
http://ip/zabbix3/api_jsonrpc.php


* Name 可以自定義
* Type下拉框中選擇Zabbix
* Http setting s --> Url 填入[http://zabbix-server-ip/zabbix/api_jsonrpc.php](http://zabbix-server-ip/zabbix/api_jsonrpc.php) 這里填入的是Zabbix API接口
* Http settings --> Access 選擇 direct 使用直接訪問的方式
* Zabbix API details --> User 填入Admin
* Zabbix API details --> Password 填入 zabbix
* 點擊"Sava & Test"保存并測試,測試API配置是否正確。配置成功會出現(xiàn):Success Zabbix API version: 3.2.7
自定義儀表板
1.Grafana儀表板配置
配置完Zabbix Source,需要自定義儀表板顯示所需的監(jiān)控項圖形,配置儀表板的步驟如下:
* 點擊左側的"Dashboards" --> 在下拉菜單的底部選擇"+ New"。這時新的頁面中默認出
現(xiàn)一個空的橫行圖表,左上角有的隱藏的按鈕,鼠標放上可以看到,右下角有"+ ADD ROW"
* 添加"Graph"面板,鼠標往下拖,就可以添加一個面板;列出的面板包括"Graph、
Singlestat、Table、Text、Heatmap、Alert List、Dashboard list、Clock……"
* 如需再添加面板,鼠標放在左上角處,選擇Add Panel,和上一步一樣;
* 最后一步點擊"保存"或者使用快捷鍵"Ctrl+s",設置儀表板的名稱,保存下來;

新添加一個"Graph"面板


這里介紹以下主要面板:
官網介紹:http://docs.grafana.org/features/panels/
(1).Graph
這個選項是創(chuàng)建一個圖表,類似于Zabbix的監(jiān)控圖表,是最常用的類型之一。
* General-Title:設置該圖表的名稱
* Metrics:在該項的右下角,選擇正確的數(shù)據源(之前在Data Sources配置的Name)
* Metrics-Group/Host/Application/Item:這些項目是必填項目,需要依次下拉選擇*如果一張圖需要展現(xiàn)兩條線的數(shù)據,可以在左下角點擊"+ Query"
* Display Styles-Chart Options:這里可以選擇以豎線展示,以折線展示或以點來展示數(shù)據
(2).Table
表格展示,類似于Excel表格的展現(xiàn)形式
* 點擊"- +"號可以調整該模塊的大?。M向伸縮)
* 點擊"Edit"可以重新編輯該模塊的數(shù)據源
(3).Singlestat
單統(tǒng)計模塊,從字面意思就可以知道,該種模塊僅可以展示一種數(shù)據,統(tǒng)計一種數(shù)據。這里需要重點說明就是Option
選項下的參數(shù)以統(tǒng)計磁盤使用大小一項來舉例
* Unit:要選擇data下的bytes單位來統(tǒng)計
* Decimals:小數(shù)設置保持默認的auto即可
* Coloring:這里可以選擇渲染背景色或字體色
* Colors控制著三個顏色,可以自由發(fā)揮,一般綠色代表正常,黃色代表預警,紅色代表警告
* Thresholds可以設置以逗號分隔的三個數(shù)字,分別表示三個狀態(tài)的閾值
* Spark lines有兩種顯示模式,Show會在數(shù)據的下方展示折線;Background mode會在整個模塊的背景展示折線
(4).Text
這個模塊很好理解,就是一個現(xiàn)實文字的模塊,支持markdown語法,可以放在每個頁面的頭部,標記當前圖表信息的歸類。
(5).Dashboards list
這個模塊是用來展示頁面列表用的。舉個例子,如果一個監(jiān)控系統(tǒng)中,涉及到了多個頁面展示監(jiān)控圖表,就會用到這個功能,這個模塊會列出你需要展示的頁面的列表,方便在當前頁面中,快速的切換到其他監(jiān)控頁面。
2.配置Graph Panel
現(xiàn)在開始配置剛剛添加好的"Graph"面板


設置數(shù)據源
設置主機組 Zabbix servers
設置主機到Zabbix server 。
設置應用程序到CPU
設置項為Processor load (1 min average per core)


然后再回到"Metrics",多添加幾個查詢,比如我添加5分鐘、15分鐘的負載

再添加另一個圖表,可以重復上述步驟或復制現(xiàn)有圖形。
要復制現(xiàn)有的圖,選擇面板標題,然后單擊duplicate 。 然后選擇新的圖形的標題,并選擇Edit選項。然后應用以下設置:
更改標題為CPU usage
選擇指標選項卡和項目字段更改為/CPU.*/
可以對主機或度量名稱使用正則表達式模式。只是一定要在包含正斜杠(模式/ )


使用快鍵鍵"ESC"退出到主面板,然后"Ctrl+s"保存一下,一會可以看到圖形;

如需添加其他圖表的應用程序展示,可以按照這種方法來配置,大同小異;
3.配置Singlestat Panel
點擊左下角"+ ADD ROW "新添加一行,選擇"Singlestat"向下拖;



設置 General 選項:
設置標題字段為:Free disk space on /
其他無需設置

設置Metrics選項如下:
面板數(shù)據源設置 Zabbix Server
主機組設置 Zabbix servers
主機設置 Zabbix server
應用程序設置 Filesystems
項目設置為Free disk space on / (percentage)

設置Options選項如下:
設置Valuet的stat為"current"
設置單元為百分比
設置Coloring的值,勾選上和閾值設置為10,20 在測量儀上顯示這些閾值
設置Gauge(測量)啟用Show選項,勾選閾值便簽和標記

Esc返回到儀表板,調整到最上面,然后"Ctrl+s"保存,展示數(shù)據如下:

例:測試實時響應情況,我們將手動減少磁盤上的可用空間,并查看儀表板顯示的內容。
首先登陸到Linux Agent服務器,查看"/"目錄的使用情況
[root@localhost ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/cl-root xfs 17G 1.7G 16G 10% /
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 8.5M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 138M 877M 14% /boot
tmpfs tmpfs 380M 0 380M 0% /run/user/0
通過查看,有16 GB的可用空間,然后減少對根分區(qū)的20%閾值之下,使用fallocate命令創(chuàng)建一個大的臨時文件:
[root@localhost ~]# fallocate -l 15G /tmp/test.img #可以根據服務器上的可用空間量設置文件大小

最后,讓我們在儀表板上顯示活動的Zabbix觸發(fā)器,這里我們引入一個"Zabbix Triggers"面板。
4.配置Zabbix Triggers
設置 General 選項:
設置標題字段為:Zabbix Alarm
其他無需設置

設置Options選項:
show fileds 勾選顯示詳細的屬性

Esc返回到儀表板,調整到最上面,然后"Ctrl+s"保存,可以看到主動觸發(fā)器通知您服務器上缺少可用空間顯示的報警:

最好刪除之前創(chuàng)建的臨時文件以釋放磁盤上的空間,消除告警信息:
[root@localhost ~]# rm -rf /tmp/test.img
再次查看,已沒有告警信息顯示了

其他面板可以通過上面的方式自行添加,就不一一介紹了,來一張編輯好的圖形,是不是很漂亮:

Grafana-zabbix模板配置
在配置好自定義的儀表板時,展示的效果還是很不錯的,但是有一個缺點,每次只能查看一臺主機的監(jiān)控圖形,如果有多臺很是不方便,所以這時可以引入模板設置,通過變量的方式去實現(xiàn),根據選擇顯示不同主機的狀態(tài),比較靈活;需要的設置的變量包括:group、host、application、item 下面介紹下模板的各種參數(shù);
模板
儀表盤模板可以讓你創(chuàng)建一個交互式和動態(tài)性的儀表板,它是Grafana里面最強大的、
最常用的功能之一。創(chuàng)建的儀表盤模板參數(shù),可以在任何一個儀表盤中使用。
創(chuàng)建變量
點擊頂部的設置按鈕,選擇模板," + New" 創(chuàng)建新的變量,可以看到模板變量編輯器,包含以下參數(shù):
變量(Variable)
命名:變量的名稱。
標簽:可見標簽變量
類型:查詢類型選擇; 有6種變量類型: query,custom,interval,Data source和Contsta,
Ad hoc filters它們都可以用來創(chuàng)建動態(tài)變量,不同之處在于獲得的數(shù)據值不一樣
查詢選項(Query Options)
數(shù)據源:用于查詢變量值的數(shù)據源
刷新:更新此變量的值
查詢:查詢字符串。
正則表達式:如果你需要篩選值或提取值的一部分,那就使用正則表達式
其中query的匹配原則
* returns all groups
*.* returns all hosts (from all groups)
Servers.* returns all hosts in group Servers
Servers.*.* returns all applications in group Servers
Servers.*.*.* returns all items from hosts in group Servers
選擇選項(Selection Options)
多值:啟用,如果你想在同一時間選擇多個值
數(shù)值組/標簽(實驗功能)(Value groups/tags (Experimental feature))
開始創(chuàng)建模板
復制一個面板出來,免得出錯,創(chuàng)建模板



依次添加host、application、item變量





模板適合監(jiān)控單獨一項,不能同時選擇多個item,可以選擇多臺主機顯示在一個監(jiān)控圖形中,形成對比;儀表板上的每個面板都可以顯示不同服務器的數(shù)據,您可以使用Grafana以許多有用的方式過濾數(shù)據,Grafana很強大,還有很多功能要自己摸索;
頁面自動刷新
點擊右上角Last 30 minutes, 在彈出的下拉框中,選擇Time range下的Refreshing
every選項,點擊下拉框按鈕,有off 和其他選項。點擊5s然后Apply設置。即為每5秒刷
新一次數(shù)據的意思。設置成功后,在原來Last 30 minutes的后面會出現(xiàn)Refresh
every 5s的橙色文字!
總結
在本教程中,使用yum安裝Zabbix 3.2;以及使用Zabbix監(jiān)控Linux系統(tǒng)主機和Windows
系統(tǒng)主機;安裝圖形插件Graphtree;由于圖形顯示不夠好看,學習了如何安裝和配置
Grafana,創(chuàng)建自定義儀表板、不同插件配置、顯示Zabbix數(shù)據的面板??梢栽谧烂婊?大屏幕上顯示這些儀表板,以便管理員可以查看IT基礎架構的狀態(tài),配置模板等。后續(xù)
再慢慢補充Zabbix相關配置,歡迎大家批評指正;
作者:六月天的安靜
鏈接:http://www.itdecent.cn/p/4c6142afd9a4
來源:簡書
著作權歸作者所有。商業(yè)轉載請聯(lián)系作者獲得授權,非商業(yè)轉載請注明出處。