From c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 14:19:22 +0100 Subject: Adding upstream version 1.44.3. Signed-off-by: Daniel Baumann --- collectors/ioping.plugin/integrations/ioping.md | 9 +- collectors/ioping.plugin/ioping.plugin.in | 120 ++++++++++++++++-------- 2 files changed, 87 insertions(+), 42 deletions(-) (limited to 'collectors/ioping.plugin') diff --git a/collectors/ioping.plugin/integrations/ioping.md b/collectors/ioping.plugin/integrations/ioping.md index 4c16d2e3a..39a07ed62 100644 --- a/collectors/ioping.plugin/integrations/ioping.md +++ b/collectors/ioping.plugin/integrations/ioping.md @@ -4,6 +4,7 @@ meta_yaml: "https://github.com/netdata/netdata/edit/master/collectors/ioping.plu sidebar_label: "IOPing" learn_status: "Published" learn_rel_path: "Data Collection/Synthetic Checks" +most_popular: False message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" endmeta--> @@ -108,10 +109,10 @@ sudo ./edit-config ioping.conf | Name | Description | Default | Required | |:----|:-----------|:-------|:--------:| -| update_every | Data collection frequency. | 1s | False | -| destination | The directory/file/device to ioping. | | True | -| request_size | The request size in bytes to ioping the destination (symbolic modifiers are supported) | 4k | False | -| ioping_opts | Options passed to `ioping` commands. | -T 1000000 | False | +| 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 | diff --git a/collectors/ioping.plugin/ioping.plugin.in b/collectors/ioping.plugin/ioping.plugin.in index d1283bad9..171e384db 100755 --- a/collectors/ioping.plugin/ioping.plugin.in +++ b/collectors/ioping.plugin/ioping.plugin.in @@ -9,7 +9,7 @@ # 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" +export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin:@sbindir_POST@" export LC_ALL=C usage="$(basename "$0") [install] [-h] [-e] @@ -93,60 +93,103 @@ if [ "$INSTALL" == "1" ] fi # ----------------------------------------------------------------------------- +# logging PROGRAM_NAME="$(basename "${0}")" -LOG_LEVEL_ERR=1 -LOG_LEVEL_WARN=2 -LOG_LEVEL_INFO=3 -LOG_LEVEL="$LOG_LEVEL_INFO" - -set_log_severity_level() { - case ${NETDATA_LOG_SEVERITY_LEVEL,,} in - "info") LOG_LEVEL="$LOG_LEVEL_INFO";; - "warn" | "warning") LOG_LEVEL="$LOG_LEVEL_WARN";; - "err" | "error") LOG_LEVEL="$LOG_LEVEL_ERR";; +# 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_severity_level - -logdate() { - date "+%Y-%m-%d %H:%M:%S" -} +set_log_min_priority log() { - local status="${1}" - shift + local level="${1}" + shift 1 - echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${*}" + [[ -n "$level" && -n "$LOG_LEVEL" && "$level" -gt "$LOG_LEVEL" ]] && return + systemd-cat-native --log-as-netdata --newline="--NEWLINE--" <