Splunk对接zabbix监控数据库SQL

Splunk对接zabbix监控数据库SQL

01 zabbix mysql table 说明

hosts:存储被监控的机器的信息
items:items表是zabbix核心表之一,记录item的所有设置
hstgrp:机器所属组表
history:性能数据保存表
history_uint:性能数据保存表

02 查询SQL语句

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
SELECT 
HOST,
hosts.name AS host_name,
items.name AS item_name,
items.itemid,
hstgrp.name AS group_name,
history.value AS VALUE
FROM
`hosts`
JOIN hosts_groups
ON hosts_groups.hostid = hosts.hostid
JOIN hstgrp
ON hosts_groups.groupid = hstgrp.groupid
JOIN items
ON items.hostid = hosts.hostid
JOIN history
ON h1.itemid = items.itemid
WHERE hosts.host = "10.203.4.23"
AND h1.clock > UNIX_TIMESTAMP(NOW()) - 3 * 60
UNION
SELECT
HOST,
hosts.name AS host_name,
items.name AS item_name,
items.itemid,
hstgrp.name AS group_name,
history_uint.value
FROM
`hosts`
JOIN hosts_groups
ON hosts_groups.hostid = hosts.hostid
JOIN hstgrp
ON hosts_groups.groupid = hstgrp.groupid
JOIN items
ON items.hostid = hosts.hostid
JOIN history_uint
ON h2.itemid = items.itemid
WHERE hosts.host = "10.203.4.23"
AND h2.clock > UNIX_TIMESTAMP(NOW()) - 3 * 60
ORDER BY item_name


Splunk对接zabbix监控数据库SQL
https://hesc.info/02d2a3bfe685/
作者
需要哈气的纸飞机
发布于
2020年7月8日
许可协议