Zabbix_server数据库中部分表的重要字段说明

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zz17zz/article/details/82422617

最简单的zabbix二次开发,我们直接从数据库里把数据读出来就行了。

下面对数据库中部分表的重要字段进行说明。

Interfaceid

interfaceid

hostid

main

type

useip

ip

dns

port

bulk

扫描二维码关注公众号,回复: 3259289 查看本文章

接口信息id

外键

1

1

1

Ip

 

端口

1

`interfaceid` bigint(20) UNSIGNED NOT NULL,

`hostid` bigint(20) UNSIGNED NOT NULL,

`main` int(11) NOT NULL DEFAULT 0,

`type` int(11) NOT NULL DEFAULT 0,

`useip` int(11) NOT NULL DEFAULT 1,

`ip` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '127.0.0.1',

`dns` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',

`port` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '10050',

`bulk` int(11) NOT NULL DEFAULT 1,

PRIMARY KEY (`interfaceid`) ,

CONSTRAINT `c_interface_1` FOREIGN KEY (`hostid`) REFERENCES `zabbix`.`hosts` (`hostid`),

Hosts

hostid

host

status

主键

主机名

状态

`hostid` bigint(20) UNSIGNED NOT NULL,

`host` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',

`status` int(11) NOT NULL DEFAULT 0,

CONSTRAINT `c_hosts_1` FOREIGN KEY (`proxy_hostid`) REFERENCES `zabbix`.`hosts` (`hostid`),

Items

itemid

type

hostid

name

key_

delay

history

trends

status

value_type

interfaceid

主键

监控类型

外键

监控项名

 

延迟

存储历史时间

存储trend时间

状态

对应history表

外键 接口信息

value_type 为0,表示监控项存于表history

value_type 为1,表示监控项存于表history_str

value_type 为2,表示监控项存于表history_log

value_type 为3,表示监控项存于表history_uint

value_type 为4,表示监控项存于表history_text

`itemid` bigint(20) UNSIGNED NOT NULL,

`type` int(11) NOT NULL DEFAULT 0,

`hostid` bigint(20) UNSIGNED NOT NULL,

`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',

`key_` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',

`delay` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',

`history` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '90d',

`trends` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '365d',

`status` int(11) NOT NULL DEFAULT 0,

`value_type` int(11) NOT NULL DEFAULT 0,

`interfaceid` bigint(20) UNSIGNED NULL DEFAULT NULL,

PRIMARY KEY (`itemid`) ,

CONSTRAINT `c_items_1` FOREIGN KEY (`hostid`) REFERENCES `zabbix`.`hosts` (`hostid`),

CONSTRAINT `c_items_4` FOREIGN KEY (`interfaceid`) REFERENCES `zabbix`.`interface` (`interfaceid`),

History

itemid

clock

value

ns

监控项的id

时间戳

监控项采集数据的值

 

纳秒 

`itemid` bigint(20) UNSIGNED NOT NULL,

`clock` int(11) NOT NULL DEFAULT 0,

`value` double(16,4) NOT NULL DEFAULT 0.0000,

`ns` int(11) NOT NULL DEFAULT 0,

Trends

itemid

clock

num

value_min

value_avg

value_max

外键

时间戳

数据量

最小值

平均值

最大值

trends 也是保存了历史数据用的,和history不同的时,trends表仅仅保存了 小时平均的值,即你可以理解为是history表的数据压缩。所以trends表也有 很多的类型,对应history。

`itemid` bigint(20) UNSIGNED NOT NULL,

`clock` int(11) NOT NULL DEFAULT 0,

`num` int(11) NOT NULL DEFAULT 0,

`value_min` double(16,4) NOT NULL DEFAULT 0.0000,

`value_avg` double(16,4) NOT NULL DEFAULT 0.0000,

`value_max` double(16,4) NOT NULL DEFAULT 0.0000,

PRIMARY KEY (`itemid`, `clock`)

 

以后深入开发可以利用API,来获取最新的数据

猜你喜欢

转载自blog.csdn.net/zz17zz/article/details/82422617
今日推荐