СоХабр закрыт.
С 13.05.2019 изменения постов больше не отслеживаются, и новые посты не сохраняются.
### Option: HistoryStorageURL
# History storage HTTP[S] URL.
#
# Mandatory: no
# Default:
# HistoryStorageURL=
HistoryStorageURL=http://hostnameelastic:9200
### Option: HistoryStorageTypes
# Comma separated list of value types to be sent to the history storage.
#
# Mandatory: no
# Default:
# HistoryStorageTypes=uint,dbl,str,log,text
HistoryStorageTypes=uint,dbl,str,log,text
<?php
// Zabbix GUI configuration file.
global $DB, $HISTORY;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'zabbixDB';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
$HISTORY['url'] = [
'uint' => 'http://hostnameelastic:9200',
'text' => 'http://hostnameelastic:9200',
'str' => 'http://hostnameelastic:9200',
'log' => 'http://hostnameelastic:9200',
'dbl' => 'http://hostnameelastic:9200'
];
$HISTORY['types'] = ['uint', 'text', 'str', 'log', 'dbl'];
curl -X PUT \
http://hostnameelastic:9200/uint \
-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" : {
"type" : "long"
}
}
}
}
}'
curl -X PUT \
http://hostnameelastic:9200/dbl \
-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" : {
"type" : "double"
}
}
}
}
}'
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://hostnameDBzabbix:3306/DBzabbixname"
# Пользователь, под которым есть доступ в БД (хотя бы на чтение)
jdbc_user => "userdb"
jdbc_password => "passdb"
# Путь к jdbc драйверу (нужно предварительно скачать)
jdbc_driver_library => "path-to-mysql-connector-java-5.1.46/mysql-connector-java-5.1.46.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
#Следующие две строки запрашивают данные "постранично".
jdbc_paging_enabled => true
jdbc_page_size => 200000
# Строка запроса
statement => "SELECT * FROM history_uint"
}
}
output {
stdout { codec => json_lines }
elasticsearch {
"hosts" => "elastichostname:9200"
# Указываем индекс, в который будут отправляться данные
"index" => "uint"
# Вот тут я долго не мог понять какой именно тип document_type указывать.... В итоге заработало с "values", но окончательного понимания так и не пришло. Если есть знатоки elastic-а, прошу пояснить в комментариях. Спасибо.
"document_type" => "values"
"manage_template" => "true"
}
}
curl -vv -XPOST 'http://hostnameelastic:9200/uint*/_delete_by_query' \
-H 'content-type:application/json' \
-d '{
"query": {
"range" : {
"clock" : {
"gte" : "1528848001",
"lte" : "1528930801"
}
}
}
}'
комментарии (0)