侧边栏壁纸
  • 累计撰写 78 篇文章
  • 累计创建 37 个标签
  • 累计收到 8 条评论

目 录CONTENT

文章目录

Splunk db conneect采集zabbix监控项数据sql查询语句

散漫的老何
2020-07-08 / 0 评论 / 0 点赞 / 847 阅读 / 237 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-05-26,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

Splunk db conneect采集zabbix监控项数据sql查询语句

zabbix mysql table 说明

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

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

0
广告 广告

评论区