Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
linux:metrics [2023/10/30 12:59] admin |
linux:metrics [2023/11/05 06:05] (текущий) admin [Мониторинг ZFS] |
||
---|---|---|---|
Строка 12: | Строка 12: | ||
# Либо есть в тех же репозиториях что и influxdb | # Либо есть в тех же репозиториях что и influxdb | ||
- | sudo tee / | + | cat <<EOF | sudo tee / |
- | [influxdb] | + | [influxdata] |
- | name = InfluxDB | + | name = InfluxData |
- | baseurl = https:// | + | baseurl = https:// |
enabled = 1 | enabled = 1 | ||
gpgcheck = 1 | gpgcheck = 1 | ||
- | gpgkey = https:// | + | gpgkey = https:// |
EOF | EOF | ||
Строка 58: | Строка 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 | + | |
Строка 329: | Строка 286: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Мониторинг ZFS ==== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | [[https:// | ||
+ | |||
+ | Добавялем в конфиг, | ||
+ | Данные берутся из "/ | ||
+ | <code bash> | ||
+ | [[inputs.zfs]] | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | [[https:// | ||
+ | По некоторым причинам удобнее метрики передавать (настраивать в графане) через прометеус\\ | ||
+ | Есть модуль который публикует содержимое телеграфа в формате прометеуса, | ||
+ | Добавляем блок " | ||
+ | <code bash> | ||
+ | [[outputs.prometheus_client]] | ||
+ | listen = ": | ||
+ | string_as_label = true | ||
+ | metric_version = 2 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||