Super detailed zabbix custom graphics and grafana plots and custom templates

Custom graphics and grafana plotting

Insert picture description here
Insert picture description here
Don't panic when there are garbled Chinese characters!
Modify the file on zabbix-server (/html is the code directory displayed by my zabbix-web) (SIMHEI.TTF is the font path that comes with the system: C:\Windows\Fonts, pay attention to looking for Chinese fonts)

cd /html/assets/fonts/
#上传中文字体
[root@zabbix-server fonts]# ls
DejaVuSans.ttf SIMHEI.TTF

mv SIMHEI.TTF DejaVuSans.ttf

Show after success
Insert picture description here

Custom graphics
Insert picture description here
Insert picture description here
My TIME_WAIT monitoring item is defined by myself and can be defined arbitrarily, which is to show the effect of the picture.
Insert picture description here

Use grafana to graph zabbix

Install grafana (install on both zabbix-server and zabbix-agent)

wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/grafana-7.3.7-1.x86_64.rpm
yum localinstall grafana-7.3.7-1.x86_64.rpm -y
systemctl start grafana-server.service
systemctl enable grafana-server.service
#访问grafana
http://10.0.0.8:3000
默认账号密码:admin/admin

The concept of grafana

a:插件,丰富原有功能plugin
b:数据源 datasource
c:dashboard 效果图

It's useless to see grafana with light! We want to see the picture of zabbix

Install zabbix plugin

grafana-cli plugins install alexanderzobnin-zabbix-app4.1.2
service grafana-server restart

Start zabbix plugin
Insert picture description here

New zabbix data source

Insert picture description here


Insert picture description here
Insert picture description here

effect

Insert picture description here
Insert picture description here

Import dashboard

Insert picture description here
Insert picture description here
Insert picture description here

After the completion of the display interface B grid is very high
Insert picture description here

Custom monitoring template

Template: Defined, some monitoring items, application sets, triggers, graphics and other resources.
Templates can contain sub-templates.
Templates can be imported and exported, and can be shared.

Custom template

#开启nginx监控页面  /etc/nginx/nginx.conf
location = /nginx_status {
    
    
stub_status;
access_log off;
}
#测试
[root@web01 ~]# curl http://127.0.0.1/nginx_status
Active connections: 1
server accepts handled requests
7 7 7
Reading: 0 Writing: 1 Waiting: 0
#自定义监控项
[root@web01 zabbix_agent2.d]# cat zbx_nginx.conf
UserParameter=nginx_status,netstat -lntp|grep -c nginx
UserParameter=nginx_accepts,curl http://127.0.0.1/nginx_status 2>/dev/null|awk 'NR==3{print $1}'
UserParameter=nginx_active_con,curl http://127.0.0.1/nginx_status 2>/dev/null|awk 'NR==1{print $NF}'
UserParameter=nginx_Reading,curl http://127.0.0.1/nginx_status 2>/dev/null|awk 'NR==4{print $2}'
UserParameter=nginx_Writing,curl http://127.0.0.1/nginx_status 2>/dev/null|awk 'NR==4{print $4}'
UserParameter=nginx_Waiting,curl http://127.0.0.1/nginx_status 2>/dev/null|awk 'NR==4{print $NF}'

First create a monitoring item and check whether there is data
Insert picture description here

Make a template
Insert picture description here
Insert picture description here
Insert picture description here

Add monitoring item
Insert picture description here

Insert picture description here
Insert picture description here

Precautions for using the template: #Open
monitoring page
#Import template (compatibility) #Put
the value configuration file of
zabbix into the specified directory /etc/zabbix/zabbix_agentd.d/ #If
there is a value script, you need to get it The value is also placed in the corresponding directory
#zabbix-getDebug取值#link the
newly imported template on the target host
#Verify, view the latest data

Guess you like

Origin blog.csdn.net/weixin_49629796/article/details/113619091
Recommended