Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
linux:metrics [2022/06/06 04:15] admin |
linux:metrics [2023/11/05 06:05] (текущий) admin [Мониторинг ZFS] |
||
---|---|---|---|
Строка 10: | Строка 10: | ||
<code bash> | <code bash> | ||
wget https:// | wget https:// | ||
+ | |||
+ | # Либо есть в тех же репозиториях что и influxdb | ||
+ | cat <<EOF | sudo tee / | ||
+ | [influxdata] | ||
+ | name = InfluxData Repository - Stable | ||
+ | baseurl = https:// | ||
+ | enabled = 1 | ||
+ | gpgcheck = 1 | ||
+ | gpgkey = https:// | ||
+ | EOF | ||
+ | |||
+ | dnf install telegraf | ||
</ | </ | ||
Строка 46: | Строка 58: | ||
<code bash> | <code bash> | ||
- | # Use ' | ||
- | # file would generate. | ||
- | |||
- | # Global tags can be specified here in key=" | ||
[global_tags] | [global_tags] | ||
- | # dc = " | ||
- | # rack = " | ||
- | |||
- | # Configuration for telegraf agent | ||
[agent] | [agent] | ||
- | ## Default data collection interval for all inputs | ||
interval = " | interval = " | ||
- | ## Rounds collection interval to ' | ||
- | ## ie, if interval=" | ||
round_interval = true | round_interval = true | ||
- | |||
- | ## Telegraf will cache metric_buffer_limit metrics for each output, and will | ||
- | ## flush this buffer on a successful write. | ||
metric_buffer_limit = 1000 | metric_buffer_limit = 1000 | ||
- | ## Flush the buffer whenever full, regardless of flush_interval. | ||
flush_buffer_when_full = true | flush_buffer_when_full = true | ||
- | |||
- | ## Collection jitter is used to jitter the collection by a random amount. | ||
- | ## Each plugin will sleep for a random time within jitter before collecting. | ||
- | ## This can be used to avoid many plugins querying things like sysfs at the | ||
- | ## same time, which can have a measurable effect on the system. | ||
collection_jitter = " | collection_jitter = " | ||
- | |||
- | ## Default flushing interval for all outputs. You shouldn' | ||
- | ## interval. Maximum flush_interval will be flush_interval + flush_jitter | ||
flush_interval = " | flush_interval = " | ||
- | ## Jitter the flush interval by a random amount. This is primarily to avoid | ||
- | ## large write spikes for users running a large number of telegraf instances. | ||
- | ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s | ||
flush_jitter = " | flush_jitter = " | ||
+ | |||
## Logging configuration: | ## Logging configuration: | ||
- | ## Run telegraf in debug mode | ||
debug = false | debug = false | ||
- | ## Run telegraf in quiet mode | ||
quiet = false | quiet = false | ||
- | ## Specify the log file name. The empty string means to log to stdout. | ||
logfile = " | logfile = " | ||
- | + | ||
- | ## Override default hostname, if empty use os.Hostname() | + | |
hostname = "" | hostname = "" | ||
- | + | ||
+ | |||
############################################################################### | ############################################################################### | ||
# OUTPUTS | # OUTPUTS | ||
############################################################################### | ############################################################################### | ||
- | + | ||
- | # Configuration for influxdb server to send metrics to | + | |
[[outputs.influxdb]] | [[outputs.influxdb]] | ||
- | # The full HTTP or UDP endpoint URL for your InfluxDB instance. | ||
- | # Multiple urls can be specified but it is assumed that they are part of the same | ||
- | # cluster, this means that only ONE of the urls will be written to each interval. | ||
- | # urls = [" | ||
urls = [" | urls = [" | ||
- | # The target database for metrics (telegraf will create it if not exists) | ||
database = " | database = " | ||
- | # Precision of writes, valid values are " | ||
- | # note: using second precision greatly helps InfluxDB compression | ||
precision = " | precision = " | ||
retention_policy = "" | retention_policy = "" | ||
- | ## Write timeout (for the InfluxDB client), formatted as a string. | ||
- | ## If not provided, will default to 5s. 0s means no timeout (not recommended). | ||
timeout = " | timeout = " | ||
username = "" | username = "" | ||
password = "" | password = "" | ||
- | # Set the user agent for HTTP POSTs (can be useful for log differentiation) | + | |
- | # user_agent = " | + | |
- | # Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes) | + | |
- | # udp_payload = 512 | + | |
Строка 320: | Строка 289: | ||
- | ===== InfluxDB ===== | + | ==== Мониторинг ZFS ==== |
- | Платформа для создания и работы с приложениями временных рядов. (https:// | + | |
- | ==== Подготовка сервера ==== | + | < |
- | Для БД временных рядов важна синхронизация времени, | + | < |
- | *В каталоге | + | [[https://github.com/influxdata/telegraf/blob/master/plugins/inputs/zfs/README.md|Doc]]\\ |
- | <code bash># \cp /usr/share/zoneinfo/Europe/Moscow | + | |
- | <code bash># apt install chrony && sudo systemctl enable chrony</ | + | |
- | Открываем файервол: | + | Добавялем в конфиг, собсна достаточно с параметрами по умолчанию\\ |
- | <code bash># iptables -I INPUT 1 -p tcp --dport 8086 -j ACCEPT</ | + | Данные берутся из "/ |
+ | <code bash> | ||
+ | [[inputs.zfs]] | ||
+ | </ | ||
+ | </ | ||
- | ==== Установка ==== | ||
- | Импортируем ключ: | ||
- | <code bash># wget -qO- https:// | ||
- | Добавляем репо: | + | < |
- | <code bash># echo "deb https:// | + | < |
+ | [[https:// | ||
+ | По некоторым причинам удобнее метрики передавать (настраивать в графане) через прометеус\\ | ||
+ | Есть модуль который публикует содержимое телеграфа в формате прометеуса, | ||
+ | Добавляем блок " | ||
+ | <code bash> | ||
+ | [[outputs.prometheus_client]] | ||
+ | listen = ":9273" | ||
+ | string_as_label = true | ||
+ | metric_version = 2 | ||
+ | </code> | ||
+ | </ | ||
- | Ставим: | ||
- | <code bash># apt update && sudo apt install influxdb</ | ||
- | ==== Управление ==== | ||
- | По умолчанию вход открытый, | ||
- | <code bash># influx | ||
- | > CREATE USER admin WITH PASSWORD '<password>' WITH ALL PRIVILEGES | + | <details> |
- | > SHOW USERS | + | <summary> </summary> |
- | + | ||
- | > GRANT [READ, | + | |
- | > REVOKE [READ, | + | |
- | > GRANT ALL PRIVILEGES TO "< | + | |
- | > REVOKE ALL PRIVILEGES FROM "< | + | |
- | > SHOW GRANTS FOR "< | + | |
- | > SET PASSWORD FOR "< | + | |
- | > DROP USER "< | + | |
- | > | + | |
- | > CREATE DATABASE | + | |
- | > DROP DATABASE | + | |
- | > DROP SERIES | + | |
- | > DROP MEASUREMENT | + | |
- | > CREATE RETENTION POLICY | + | |
- | > ALTER RETENTION POLICY | + | |
- | > DROP RETENTION POLICY | + | |
- | > CREATE CONTINUOUS QUERY | + | |
- | > DROP CONTINUOUS QUERY | + | |
- | > | + | |
+ | <code bash> | ||
</ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
- | ==== ==== | ||
- | <code bash># </ | ||