Database and Data
The local schema is generated by the template haskell in https://github.com/Multi-Axis/habbix/blob/master/src/Models.hs. The definitions use a little different naming from the real db, but you should be able to figure out the differences. For clarity I’ll stick to names used in the actual postgresql database in this document.
All table and field names that are above the Not in Zabbix
comment are also present in the remote zabbix db. Tables below that comment are present only in the local schema.
Items
items.itemid
is the most important field in our database. itemids are used everywhere to identify a single metric. An item qualifies the host, too.
History
History data, (time, value)-points, are in the history
and history_uint
tables. Nearly dually, future data is in future
and future_uint
tables.
item history:
select clock, value from history where itemid = <items.itemid> order by clock;
(or ints:)
select clock, value from history_uint where itemid = <items.itemid> order by clock;
Predictions and Futures
Item’s all precomputed “prediction futures” are in the item_future
table:
select id, modelid, params from item_future where itemid = <items.itemid>;
Fetch future data:
select clock, value from future where itemid = <item_future.id> order by clock;
(or ints:)
select clock, value from future_uint where itemid = <item_future.id> order by clock;
Pretty Names
We provide pretty names for common items.key_
’s in the metric
database:
id | name | key_
----+------+------------------------------
1 | mem | system.stat[memory,fre]
2 | cpu | system.cpu.load[percpu,avg5]