Zabbix has recently started to support storage of historical data by means of Elasticsearch instead of a database. Users are now given the possibility to choose the storage place for historical data between a compatible database and Elasticsearch.
To ensure proper communication between all elements involved make sure server configuration file and frontend configuration file parameters are properly configured.
Zabbix server configuration file draft with parameters to be updated:
### Option: HistoryStorageURL # History storage HTTP[S] URL. # # Mandatory: no # Default: # HistoryStorageURL= ### Option: HistoryStorageTypes # Comma separated list of value types to be sent to the history storage. # # Mandatory: no # Default: # HistoryStorageTypes=uint,dbl,str,log,text
Example parameter values to fill the Zabbix server configuration file with:
HistoryStorageURL=http://test.elasticsearch.lan:9200 HistoryStorageTypes=str,log,text
This configuration forces Zabbix server to store history values of numeric types in the corresponding database and textual history data in Elasticsearch.
Elasticsearch supports the following item types:
uint,dbl,str,log,text
Supported item type explanation:
Item value type | Database table | Elasticsearch type |
Numeric (unsigned) | history_uint | uint |
Numeric (float) | history | dbl |
Character | history_str | str |
Log | history_log | log |
Text | history_text | text |
Zabbix frontend configuration file (conf/zabbix.conf.php
) draft with parameters to be updated:
// Elasticsearch url (can be string if same url is used for all types). $HISTORY['url'] = [ 'uint' => 'http://localhost:9200', 'text' => 'http://localhost:9200' ]; // Value types stored in Elasticsearch. $HISTORY['types'] = ['uint', 'text'];
Example parameter values to fill the Zabbix frontend configuration file with:
$HISTORY['url'] = 'http://test.elasticsearch.lan:9200'; $HISTORY['types'] = ['str', 'text', 'log'];
This configuration forces to store Text
, Character
and Log
history values in Elasticsearch.
It is also required to make $HISTORY global in conf/zabbix.conf.php
to ensure everything is working properly (see conf/zabbix.conf.php.example
for how to do it):
// Zabbix GUI configuration file. global $DB, $HISTORY;
Final two steps of making things work are installing Elasticsearch itself and creating a mapping process.
To install Elasticsearch please refer to Elasticsearch installation guide.
database/elasticsearch/elasticsearch.map
.
To create mapping for text
type send the following request to Elasticsearch:
curl -X PUT \ http://your-elasticsearch.here:9200/text \ -H 'content-type:application/json' \ -d '{ "settings" : { "index" : { "number_of_replicas" : 1, "number_of_shards" : 5 } }, "mappings" : { "values" : { "properties" : { "itemid" : { "type" : "long" }, "clock" : { "format" : "epoch_second", "type" : "date" }, "value" : { "fields" : { "analyzed" : { "index" : true, "type" : "text", "analyzer" : "standard" } }, "index" : false, "type" : "text" } } } } }'
Similar request is required to be executed for Character
and Log
history values mapping creation with corresponding type correction.
The following steps may help you troubleshoot problems with Elasticsearch setup:
http://localhost:9200/uint
).If you are still experiencing problems with your installation then please create a bug report with all the information from this list (mapping, error logs, configuration, version, etc.)