当前位置:网站首页>Zabbix: 将收集到值映射为易读的语句
Zabbix: 将收集到值映射为易读的语句
2022-07-27 06:10:00 【TechForGeek】
Zabbix 是运维中常用的一款开源监控系统。在 Zabbix 中,要从被监控的主机收集数据,需要创建 Item。Zabbix 内置了很多不同类型的 Item,常用的 Item 类型为 Zabbix agent,这种类型的 Item 通过与部署在被监控主机上的 Zabbix agent 通信来收集数据。
Zabbix agent 类型的 Item 支持很多 Item keys, 不同的 Item keys 用来收集不同的数据。例如 agent.hostname 用来收集被监控主机的主机名,proc.mem 用来收集进程的内存使用情况。所有支持的 Item keys 可以参考对应的 Zabbix 文档[1]。
Zabbix agent 类型的 Item keys 中,很多只返回一个数值,用不同的数值来表示被监控主机的不同状态。例如 net.tcp.port 用来检查被监控主机的指定端口是否开放,它返回数值 0 或 1: 0 表示不能连接到指定端口,1表示可以连接到指定端口。
对于通过数值来表示不同状态的 Item,在 Zabbix 的 Latest data 中查看收集到的数据时,有时候我们并不能很清楚地记得,不同的数值表示什么样的含义,就不得不去查阅 Zabbix 文档。如果能够将数值映射为人类易读的语句,那就方便多了。
其实,Zabbix 已经支持这样的功能了,就是 Zabbix 的 Value mapping[2],它可以将 Numeric (unsigned), Numeric (float) 和 Character 类型的值映射为人类易读的语句。
要使用 Value mapping,首先需要创建创建一个 Value map,操作步骤如下:
进入到 Zabbix 控制台,选择 Administration => Genernal
在 General 页面的右上角的下拉列表里,选择 Value mapping
在 Value mapping 页面的右上角,选择 Create value map
填写名称及需要的 Mappings 后,点击 Add 创建即可
下面是我创建的 Value map 的示例图:

之后,在创建 Item (或者修改现有的Item)时,设置 Show value 字段的值为你刚刚创建的 Value map 即可:

设置完成后,在 Zabbix 的 Latest data 中查看对应的 Item,就可以看到收集的数值已经映射为人类易读的语句了:
参考:
[1]: https://www.zabbix.com/documentation/4.0/en/manual/config/items/itemtypes/zabbix_agent
[2]: https://www.zabbix.com/documentation/4.0/en/manual/config/items/mapping
一如既往,如果你对文章中的内容有任何疑问,或者是发现文章中有任何错误,都可以通过留言告诉我;如果你喜欢我的文章,欢迎关注我的微信公众号 Tech For Geek。

边栏推荐
- VIM editor deletes all file contents
- (posted) comparison of Eureka, consumer and Nacos 2
- Watermelon book learning notes - Chapter 4 decision tree
- Relevant principles of MySQL index optimization
- 把Excel转换成CSV/CSV UTF-8
- ADB instruction sorting
- MySQL query operation index optimization practice
- Oracle database problems
- How to implement Devops with automation tools | including low code and Devops application practice
- Interpretation of deepsort source code (VII)
猜你喜欢

Overall dichotomy?

Music website management system based on SSM

Drools (5): drools advanced syntax

35. Search insert position

C# Winfrom 常用功能整合-2

如何借助自动化工具落地DevOps|含低代码与DevOps应用实践

(转帖)eureka、consul、nacos的对比2

A Competitive Swarm Optimizer for Large Scale Optimization

Generics -- learn it, and there are many benefits

docker安装MySQL8.0.28
随机推荐
Gbase 8C - SQL reference 6 SQL syntax (13)
Pg_relation_size 问题
使用反射实现动态修改@Excel的注解属性
How to implement Devops with automation tools | including low code and Devops application practice
Student achievement management system based on SSM
Linear table -- stack and queue
pytorch笔记:TD3
Usage of string class
用typescript实现排序-递增
[Vani has a date] tail on rainy days
Brief introduction of simulation model
py2exe qt界面风格变成了win98解决方案
【golang学习笔记2.1】 golang中的数组中的排序和查找
Digital image processing Chapter 1 Introduction
MySQL limit paging query optimization practice
端口转发小结
【QT】无法在QT创建者中打开包含文件pcap.h(C1083)
35. Search Insert Position 搜索插入位置
MySQL quickly compares database table data
ADB instruction sorting