From be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 04:57:58 +0200 Subject: Adding upstream version 1.44.3. Signed-off-by: Daniel Baumann --- collectors/ioping.plugin/Makefile.am | 24 +++ collectors/ioping.plugin/README.md | 1 + collectors/ioping.plugin/integrations/ioping.md | 133 ++++++++++++ collectors/ioping.plugin/ioping.conf | 40 ++++ collectors/ioping.plugin/ioping.plugin.in | 272 ++++++++++++++++++++++++ collectors/ioping.plugin/metadata.yaml | 101 +++++++++ 6 files changed, 571 insertions(+) create mode 100644 collectors/ioping.plugin/Makefile.am create mode 120000 collectors/ioping.plugin/README.md create mode 100644 collectors/ioping.plugin/integrations/ioping.md create mode 100644 collectors/ioping.plugin/ioping.conf create mode 100755 collectors/ioping.plugin/ioping.plugin.in create mode 100644 collectors/ioping.plugin/metadata.yaml (limited to 'collectors/ioping.plugin') diff --git a/collectors/ioping.plugin/Makefile.am b/collectors/ioping.plugin/Makefile.am new file mode 100644 index 00000000..a9cd7c4f --- /dev/null +++ b/collectors/ioping.plugin/Makefile.am @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +AUTOMAKE_OPTIONS = subdir-objects +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +CLEANFILES = \ + ioping.plugin \ + $(NULL) + +include $(top_srcdir)/build/subst.inc +SUFFIXES = .in + +dist_plugins_SCRIPTS = \ + ioping.plugin \ + $(NULL) + +dist_noinst_DATA = \ + ioping.plugin.in \ + README.md \ + $(NULL) + +dist_libconfig_DATA = \ + ioping.conf \ + $(NULL) diff --git a/collectors/ioping.plugin/README.md b/collectors/ioping.plugin/README.md new file mode 120000 index 00000000..cb660f13 --- /dev/null +++ b/collectors/ioping.plugin/README.md @@ -0,0 +1 @@ +integrations/ioping.md \ No newline at end of file diff --git a/collectors/ioping.plugin/integrations/ioping.md b/collectors/ioping.plugin/integrations/ioping.md new file mode 100644 index 00000000..39a07ed6 --- /dev/null +++ b/collectors/ioping.plugin/integrations/ioping.md @@ -0,0 +1,133 @@ + + +# IOPing + + + + + +Plugin: ioping.plugin +Module: ioping.plugin + + + +## Overview + +Monitor IOPing metrics for efficient disk I/O latency tracking. Keep track of read/write speeds, latency, and error rates for optimized disk operations. + +Plugin uses `ioping` command. + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + + +### Default Behavior + +#### Auto-Detection + +This integration doesn't support auto-detection. + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per disk + + + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | +|:------|:----------|:----| +| ioping.latency | latency | microseconds | + + + +## Alerts + + +The following alerts are available: + +| Alert name | On metric | Description | +|:------------|:----------|:------------| +| [ ioping_disk_latency ](https://github.com/netdata/netdata/blob/master/health/health.d/ioping.conf) | ioping.latency | average I/O latency over the last 10 seconds | + + +## Setup + +### Prerequisites + +#### Install ioping + +You can install the command by passing the argument `install` to the plugin (`/usr/libexec/netdata/plugins.d/ioping.plugin install`). + + + +### Configuration + +#### File + +The configuration file name for this integration is `ioping.conf`. + + +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config ioping.conf +``` +#### Options + + + +
Config options + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| update_every | Data collection frequency. | 1s | no | +| destination | The directory/file/device to ioping. | | yes | +| request_size | The request size in bytes to ioping the destination (symbolic modifiers are supported) | 4k | no | +| ioping_opts | Options passed to `ioping` commands. | -T 1000000 | no | + +
+ +#### Examples + +##### Basic Configuration + +This example has the minimum configuration necessary to have the plugin running. + +
Config + +```yaml +destination="/dev/sda" + +``` +
+ + diff --git a/collectors/ioping.plugin/ioping.conf b/collectors/ioping.plugin/ioping.conf new file mode 100644 index 00000000..86f0de7f --- /dev/null +++ b/collectors/ioping.plugin/ioping.conf @@ -0,0 +1,40 @@ +# no need for shebang - this file is sourced from ioping.plugin + +# ioping.plugin requires a recent version of ioping. +# +# You can get it on your system, by running: +# +# /usr/libexec/netdata/plugins.d/ioping.plugin install + +# ----------------------------------------------------------------------------- +# configuration options + +# The ioping binary to use. We need one that can output netdata friendly info +# (supporting: -N). If you have multiple versions, put here the full filename +# of the right one + +#ioping="/usr/libexec/netdata/plugins.d/ioping" + + +# The directory/file/device to ioping + +destination="" + + +# The update frequency of the chart in seconds (symbolic modifiers are supported) +# the default is inherited from netdata + +#update_every="1s" + + +# The request size in bytes to ioping the destination (symbolic modifiers are supported) +# by default 4k chunks are used + +#request_size="4k" + + +# Other ioping options +# the defaults: +# -T 1000000 = maximum valid request time (us) + +#ioping_opts="-T 1000000" diff --git a/collectors/ioping.plugin/ioping.plugin.in b/collectors/ioping.plugin/ioping.plugin.in new file mode 100755 index 00000000..171e384d --- /dev/null +++ b/collectors/ioping.plugin/ioping.plugin.in @@ -0,0 +1,272 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# netdata +# real-time performance and health monitoring, done right! +# (C) 2017 Costa Tsaousis +# GPL v3+ +# +# This plugin requires a latest version of ioping. +# You can compile it from source, by running me with option: install + +export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin:@sbindir_POST@" +export LC_ALL=C + +usage="$(basename "$0") [install] [-h] [-e] + +where: + install install ioping binary + -e, --env path to environment file (defaults to '/etc/netdata/.environment' + -h show this help text" + +INSTALL=0 +ENVIRONMENT_FILE="/etc/netdata/.environment" + +while :; do + case "$1" in + -h | --help) + echo "$usage" >&2 + exit 1 + ;; + install) + INSTALL=1 + shift + ;; + -e | --env) + ENVIRONMENT_FILE="$2" + shift 2 + ;; + -*) + echo "$usage" >&2 + exit 1 + ;; + *) break ;; + esac +done + +if [ "$INSTALL" == "1" ] + then + [ "${UID}" != 0 ] && echo >&2 "Please run me as root. This will install a single binary file: /usr/libexec/netdata/plugins.d/ioping." && exit 1 + + source "${ENVIRONMENT_FILE}" || exit 1 + + run() { + printf >&2 " > " + printf >&2 "%q " "${@}" + printf >&2 "\n" + "${@}" || exit 1 + } + + download() { + local git="$(which git 2>/dev/null || command -v git 2>/dev/null)" + [ ! -z "${git}" ] && run git clone "${1}" "${2}" && return 0 + + echo >&2 "Cannot find 'git' in this system." && exit 1 + } + + tmp=$(mktemp -d /tmp/netdata-ioping-XXXXXX) + [ ! -d "${NETDATA_PREFIX}/usr/libexec/netdata" ] && run mkdir -p "${NETDATA_PREFIX}/usr/libexec/netdata" + + run cd "${tmp}" + + if [ -d ioping-netdata ] + then + run rm -rf ioping-netdata || exit 1 + fi + + download 'https://github.com/netdata/ioping.git' 'ioping-netdata' + [ $? -ne 0 ] && exit 1 + run cd ioping-netdata || exit 1 + + INSTALL_PATH="${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/ioping" + + run make clean + run make + run mv ioping "${INSTALL_PATH}" + run chown root:"${NETDATA_GROUP}" "${INSTALL_PATH}" + run chmod 4750 "${INSTALL_PATH}" + echo >&2 + echo >&2 "All done, you have a compatible ioping now at ${INSTALL_PATH}." + echo >&2 + + exit 0 +fi + +# ----------------------------------------------------------------------------- +# logging + +PROGRAM_NAME="$(basename "${0}")" + +# these should be the same with syslog() priorities +NDLP_EMERG=0 # system is unusable +NDLP_ALERT=1 # action must be taken immediately +NDLP_CRIT=2 # critical conditions +NDLP_ERR=3 # error conditions +NDLP_WARN=4 # warning conditions +NDLP_NOTICE=5 # normal but significant condition +NDLP_INFO=6 # informational +NDLP_DEBUG=7 # debug-level messages + +# the max (numerically) log level we will log +LOG_LEVEL=$NDLP_INFO + +set_log_min_priority() { + case "${NETDATA_LOG_LEVEL,,}" in + "emerg" | "emergency") + LOG_LEVEL=$NDLP_EMERG + ;; + + "alert") + LOG_LEVEL=$NDLP_ALERT + ;; + + "crit" | "critical") + LOG_LEVEL=$NDLP_CRIT + ;; + + "err" | "error") + LOG_LEVEL=$NDLP_ERR + ;; + + "warn" | "warning") + LOG_LEVEL=$NDLP_WARN + ;; + + "notice") + LOG_LEVEL=$NDLP_NOTICE + ;; + + "info") + LOG_LEVEL=$NDLP_INFO + ;; + + "debug") + LOG_LEVEL=$NDLP_DEBUG + ;; + esac +} + +set_log_min_priority + +log() { + local level="${1}" + shift 1 + + [[ -n "$level" && -n "$LOG_LEVEL" && "$level" -gt "$LOG_LEVEL" ]] && return + + systemd-cat-native --log-as-netdata --newline="--NEWLINE--" <