zabgrab.model.zabbix¶
Zabbix objects as seen by zabgrab.
Functions
|
Parse a Zabbix storage period, such as |
Classes
|
One raw value of an item. |
|
A monitored host. |
|
An item on a host. |
|
Hourly statistics of a numeric item. |
|
Zabbix item value types (the |
- class zabgrab.model.zabbix.ValueType(*values)[source]¶
Bases:
IntEnumZabbix item value types (the
value_type/historyAPI values).- FLOAT, UNSIGNED
Numbers, which have hourly trends and can be plotted.
- CHAR, LOG, TEXT
Text. Log items also have a log time, source, severity and event ID.
- BINARY¶
Binary data, which zabgrab doesn’t fetch.
- class zabgrab.model.zabbix.Host(hostid, host, name, enabled=True, groups=())[source]¶
Bases:
objectA monitored host.
- class zabgrab.model.zabbix.Item(itemid, hostid, host, host_name, name, key, value_type, units='', enabled=True, last_value=None, last_clock=None, history=None, trends=None, tags=())[source]¶
Bases:
objectAn item on a host.
- Parameters:
- itemid, hostid
The item’s and its host’s IDs.
- Type:
- host, host_name
The host’s technical and visible names.
- Type:
- name, key
The item’s name and key.
- Type:
- last_clock¶
When the latest value was collected.
- Type:
datetime or None
- history, trends
How long raw values and hourly trends are kept, in seconds (0 means they aren’t), or
Noneif not known.- Type:
int or None
- class zabgrab.model.zabbix.HistoryRow(time, value, log_time=None, source='', severity=0, event_id=0)[source]¶
Bases:
objectOne raw value of an item.
- Parameters:
- log_time, source, severity, event_id
The log entry’s own time, source, severity and event ID (log items only).
- class zabgrab.model.zabbix.TrendRow(time, count, min, avg, max)[source]¶
Bases:
objectHourly statistics of a numeric item.
- min, avg, max
The hour’s minimum, average and maximum, as Zabbix returns them.
- Type:
- zabgrab.model.zabbix.parse_period(text)[source]¶
Parse a Zabbix storage period, such as
31dor3600.- Parameters:
text (str) – The period, as
item.getreturns it: whole seconds, optionally with a time suffix (s,m,h,dorw), or a user macro.- Returns:
int or None – The period in seconds (0 means nothing is kept), or
Noneif it isn’t known (e.g. a macro, which the API doesn’t resolve).- Return type:
int | None
Examples
>>> parse_period("2w"), parse_period("3600"), parse_period("{$HISTORY}") (1209600, 3600, None)