zabbix 表结构详情(基本)
zabbix表结构
1、acknowledges
记录告警的确认信息
2、actions
记录了当触发器触发时,需要采用的动作。
mysql> desc actions;
+---------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+-------+
| actionid | bigint(20) unsigned | NO | PRI | 0 | |
| name | varchar(255) | NO | | | |
| eventsource | int(11) | NO | MUL | 0 | |
| evaltype | int(11) | NO | | 0 | |
| status | int(11) | NO | | 0 | |
| esc_period | int(11) | NO | | 0 | |
| def_shortdata | varchar(255) | NO | | | |
| def_longdata | blob | NO | | NULL | |
| recovery_msg | int(11) | NO | | 0 | |
| r_shortdata | varchar(255) | NO | | | |
| r_longdata | blob | NO | | NULL | |
+---------------+---------------------+------+-----+---------+-------+
actionid:动作ID
name:动作名称
eventsource:
3、alerts 报警信息表(比如邮件报警信息)
mysql> desc alerts;
+-------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+-------+
| alertid | bigint(20) unsigned | NO | PRI | 0 | |
| actionid | bigint(20) unsigned | NO | MUL | 0 | |
| eventid | bigint(20) unsigned | NO | MUL | 0 | |
| userid | bigint(20) unsigned | NO | MUL | 0 | |
| clock | int(11) | NO | PRI | 0 | |
| mediatypeid | bigint(20) unsigned | NO | MUL | 0 | |
| sendto | varchar(100) | NO | | | |
| subject | varchar(255) | NO | | | |
| message | blob | NO | | NULL | |
| status | int(11) | NO | MUL | 0 | |
| retries | int(11) | NO | | 0 | |
| error | varchar(128) | NO | | | |
| esc_step | int(11) | NO | | 0 | |
| alerttype | int(11) | NO | | 0 | |
+-------------+---------------------+------+-----+---------+-------+
alertid: 报警ID
actionid: 动作ID
eventid: 事件ID
userid: 报警用户id
clock: 报警事件,时间戳格式
mediatypeid: 报警类型
sendto:报警信息的发送地址
subject:报警标题
message:报警内容
status:发送状态。2失败,1成功,0发送中
retries:重发次数
error:错误信息
esc_step:操作类型,0成功报警,1失败报警
alerttype:报警类型,0邮件报警
3、application 系类:应用集表
application_template
applications
4、audit
auditlog
auditlog_details
autoreg_host
5、conditions 动作条件信息表
6、config
config表保存了全局的参数,前端包括后端也是,很多情况下会查询改表的参数的,例如用户的自定义主题、
登陆认证类型等,非常重要.
不过对我们做数据分析意义不大
7、dbversion
8、dchecks
dhosts
drules
dservices
9、escalations
10、events
11、expressions
12、functions 触发器表达式
13、globalmacro
globalvars
14、graph_discovery
graph_theme
graphs
graphs_items
15、groups 组名和组ID
mysql> desc groups ; +----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+---------------------+------+-----+---------+-------+ | groupid | bigint(20) unsigned | NO | PRI | 0 | | | name | varchar(64) | NO | MUL | | | | internal | int(11) | NO | | 0 | | +----------+---------------------+------+-----+---------+-------+
internal:不知道
flag: 0主机,1模板
group_discovery
group_prototype
16、history历史表信息
类似表还有:history_log、history_str、history_str_sync、history_sync、history_text、history_unit、history_unit_sync
mysql> desc history;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| itemid | bigint(20) unsigned | NO | PRI | 0 | |
| clock | int(11) | NO | PRI | 0 | |
| value | double(16,4) | NO | | 0.0000 | |
+--------+---------------------+------+-----+---------+-------+
mysql> desc history_str;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| itemid | bigint(20) unsigned | NO | MUL | 0 | |
| clock | int(11) | NO | | 0 | |
| value | varchar(255) | NO | | | |
+--------+---------------------+------+-----+---------+-------+
这些表与监控项表 items中value_type关联.
0:numeric float
1:character
2:log
3:numeric unsigned
4:text
value_type 为0,表示监控项存于表history
value_type 为1,表示监控项存于表history_str
value_type 为2,表示监控项存于表history_log
value_type 为3,表示监控项存于表history_uint
value_type 为4,表示监控项存于表history_text
17、host_discovery
host_inventory
hostmacro
18、hosts 主机信息
hosts_groups 主机群组的关联信息
hosts_templates
mysql> desc hosts;
+--------------------+---------------------+------+-----+-----------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+---------------------+------+-----+-----------+-------+
| hostid | bigint(20) unsigned | NO | PRI | 0 | |
| proxy_hostid | bigint(20) unsigned | NO | MUL | 0 | |
| host | varchar(64) | NO | MUL | | |
| dns | varchar(64) | NO | | | |
| useip | int(11) | NO | | 1 | |
| ip | varchar(39) | NO | | 127.0.0.1 | |
| port | int(11) | NO | | 10050 | |
| status | int(11) | NO | MUL | 0 | |
| disable_until | int(11) | NO | | 0 | |
| error | varchar(128) | NO | | | |
| available | int(11) | NO | | 0 | |
| errors_from | int(11) | NO | | 0 | |
| lastaccess | int(11) | NO | | 0 | |
| inbytes | bigint(20) unsigned | NO | | 0 | |
| outbytes | bigint(20) unsigned | NO | | 0 | |
| useipmi | int(11) | NO | | 0 | |
| ipmi_port | int(11) | NO | | 623 | |
| ipmi_authtype | int(11) | NO | | 0 | |
| ipmi_privilege | int(11) | NO | | 2 | |
| ipmi_username | varchar(16) | NO | | | |
| ipmi_password | varchar(20) | NO | | | |
| ipmi_disable_until | int(11) | NO | | 0 | |
| ipmi_available | int(11) | NO | | 0 | |
| snmp_disable_until | int(11) | NO | | 0 | |
| snmp_available | int(11) | NO | | 0 | |
| maintenanceid | bigint(20) unsigned | NO | | 0 | |
| maintenance_status | int(11) | NO | | 0 | |
| maintenance_type | int(11) | NO | | 0 | |
| maintenance_from | int(11) | NO | | 0 | |
| ipmi_ip | varchar(64) | NO | | 127.0.0.1 | |
| ipmi_errors_from | int(11) | NO | | 0 | |
| snmp_errors_from | int(11) | NO | | 0 | |
| ipmi_error | varchar(128) | NO | | | |
| snmp_error | varchar(128) | NO | | | |
+--------------------+---------------------+------+-----+-----------+-------+
host : 主机名称
status:主机状态,检测中
19、interface 主机-接口信息
hostid:主机ID
ip:ip信息
port:端口
20、items监控项信息表
mysql> desc items ;
+-----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------------------+------+-----+---------+-------+
| itemid | bigint(20) unsigned | NO | PRI | 0 | |
| type | int(11) | NO | | 0 | |
| snmp_community | varchar(64) | NO | | | |
| snmp_oid | varchar(255) | NO | | | |
| snmp_port | int(11) | NO | | 161 | |
| hostid | bigint(20) unsigned | NO | MUL | 0 | |
| description | varchar(255) | NO | | | |
| key_ | varchar(255) | NO | | | |
| delay | int(11) | NO | | 0 | |
| history | int(11) | NO | | 90 | |
| trends | int(11) | NO | | 365 | |
| lastvalue | varchar(255) | YES | | NULL | |
| lastclock | int(11) | YES | | NULL | |
| prevvalue | varchar(255) | YES | | NULL | |
| status | int(11) | NO | MUL | 0 | |
| value_type | int(11) | NO | | 0 | |
| trapper_hosts | varchar(255) | NO | | | |
| units | varchar(10) | NO | | | |
| multiplier | int(11) | NO | | 0 | |
| delta | int(11) | NO | | 0 | |
| prevorgvalue | varchar(255) | YES | | NULL | |
| snmpv3_securityname | varchar(64) | NO | | | |
| snmpv3_securitylevel | int(11) | NO | | 0 | |
| snmpv3_authpassphrase | varchar(64) | NO | | | |
| snmpv3_privpassphrase | varchar(64) | NO | | | |
| formula | varchar(255) | NO | | 1 | |
| error | varchar(128) | NO | | | |
| lastlogsize | int(11) | NO | | 0 | |
| logtimefmt | varchar(64) | NO | | | |
| templateid | bigint(20) unsigned | NO | MUL | 0 | |
| valuemapid | bigint(20) unsigned | NO | | 0 | |
| delay_flex | varchar(255) | NO | | | |
| params | text | NO | | NULL | |
| ipmi_sensor | varchar(128) | NO | | | |
| data_type | int(11) | NO | | 0 | |
| authtype | int(11) | NO | | 0 | |
| username | varchar(64) | NO | | | |
| password | varchar(64) | NO | | | |
| publickey | varchar(64) | NO | | | |
| privatekey | varchar(64) | NO | | | |
| mtime | int(11) | NO | | 0 | |
+-----------------------+---------------------+------+-----+---------+-------+
items_applications
item_discovery
21、media 用户媒介信息 与media_type 媒介类型表相关
mysql> desc media; +-------------+---------------------+------+-----+-----------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+-----------------+-------+ | mediaid | bigint(20) unsigned | NO | PRI | 0 | | | userid | bigint(20) unsigned | NO | MUL | 0 | | | mediatypeid | bigint(20) unsigned | NO | MUL | 0 | | | sendto | varchar(100) | NO | | | | | active | int(11) | NO | | 0 | | | severity | int(11) | NO | | 63 | | | period | varchar(100) | NO | | 1-7,00:00-23:59 | | +-------------+---------------------+------+-----+-----------------+-------+
22、operations 动作的运行记录
23、opmessage 动作操作信息
opmessage_grp
opmessage_usr
24、profiles 保存了一些用户的基本配置
25、rights 保存了用户的权限信息
26、sessions 保存了每个用户的sessions,在登陆、注销的时候均会操作
该张表的。
25、triggers 触发器
26、user 用户信息