Linux云计算架构-Zabbix企业级监控系统之数据库常用表结构介绍
/*主机、主机群组、模板关系*/
select * from hosts where hostid='10050' /*主机表,包括所有的模板*/
select * from items where itemid='10050' /*监控项表*/
select * from hosts_templates /*主机与模板 模板与模板 之间的关系表,hostid和templateid都是hosts表的hostid*/
select * from hosts_groups /*主机及主机群组关系表*/
select * from hstgrp /*主机群组表*/
/*仪表盘*/
select * from dashboard /*仪表盘*/
select * from dashboard_user /*仪表盘用户访问*/
select * from dashboard_usrgrp /*仪表盘群组访问*/
select * from config /*前端和后端的配置*/
select * From profiles /*保存用户的一些配置项*/
/*图形*/
select * from graphs /*图形信息表*/
select * from graph_theme /*前端主题表,主题配置在config表中*/
select * from graphs_items /*图形和监控项关联表*/
/*触发器*/
/*
表达式:{12641}>75
{Zabbix server:zabbix[rcache,buffer,pused].max(10m)}>75
{主机名或模板名:zabbix[rcache,buffer,pused].max(10m)}>75
{主机名或模板名:监控项名.函数名(参数)}
*/
select * from triggers where triggerid='13015'/*触发器表*/
select * froM trigger_depends /*触发器依赖关系表,上依赖和下依赖*/
select * from functions where itemid='22189' /*监控项、触发器、触发表达式关系表*/
select * from functions where functionid='12641'
select * from items where itemid='22189' /*监控项表*/
select * from events where objectid='13015' /*事件表*/
/*
source: 事件生成源头:0(触发器)、1(自动发现)、2(自动注册)、3(内部事件)
object:与事件关联的对象:0(触发器)、1(自动发现主机)、2(自动发现服务)、3(自动注册)、4(item)、5(low-level-discovery)
value:
1. 触发器类型事件:0(OK)、1(PROBLEM)
2. discovery类型事件:0(正在工作)、1(停止工作)、2(被侦测到)、3(丢失了)
3. internal类型事件:0(normal)、1(unknown或者not supported)
*/
/*历史数据*/
SELECT itemid,FROM_UNIXTIME(clock),VALUE,FROM_UNIXTIME(ns) FROM history WHERE itemid='10073' /*监控项历史数值类型数据表,默认1分钟取数一次*/
SELECT itemid,FROM_UNIXTIME(clock),num,value_min,value_avg,value_max FROM trends WHERE itemid='10073' /*将history中的数据以小时为单位统计并计入到trends表中*/
SELECT * FROM history_log /*历史日志类型数据*/
select * from history_str /*历史字符串类型数据*/
select * froM history_text /*历史文本类型数据*/
SELECT itemid,FROM_UNIXTIME(clock),VALUE,ns FROM history_uint; /*历史无符号整型数据*/
SELECT itemid,FROM_UNIXTIME(clock),num,value_min,value_avg,value_max FROM trends_uint; /*历史无符号整型数据按小时统计*/
/*
clock 统计时间
num 用到history中统计值的数量
value_min 最小值
value_avg 平均值
value_max 最大值
*/
/*用户及用户群组*/
select * from users /*用户表*/
select * from users_groups /*用户及用户群组关系表*/
select * from usrgrp /*用户群组表*/
select c.name,a.name from usrgrp a inner join users_groups b
on a.usrgrpid=b.usrgrpid
inner join users c on b.userid=c.userid;
/*其他*/
SELECT * FROM interface /*所有主机的IP和监听端口信息*/
SELECT * FROM problem /*问题列表*/
SELECT * FROM actions /*触发动作表*/
SELECT * FROM alerts /*历史告警事件表*/
SELECT * FROM rights /*用户组的权限信息*/
SELECT * FROM screens /*用户定义的图片*/
SELECT * FROM screens_items /*用户定义的图片与监控项关联表*/
SELECT sessionid,userid,FROM_UNIXTIME(lastaccess),STATUS FROM sessions /*会话信息表,保存用户的会话信息,登录注销等*/