From 4a274dc50c293a1f3e535be2798c16000e729b6d Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Thu, 18 Jul 2024 17:18:57 +1000 Subject: [PATCH] Squashed 'vendor/github.com/htop-dev/htop/' changes from 549843606b..7694b68417 7694b68417 Check attributes color, type, and width for valid values 700959a2fb Yet another minor typo in the PCP configuration files git-subtree-dir: vendor/github.com/htop-dev/htop git-subtree-split: 7694b68417f561f2337da6d7881f183c14c90aa9 --- check-pcp-style.sh | 23 +++++++++++++++++++++++ pcp/meters/mysql | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/check-pcp-style.sh b/check-pcp-style.sh index 2dcbacc434..986a63aa9d 100755 --- a/check-pcp-style.sh +++ b/check-pcp-style.sh @@ -69,6 +69,7 @@ check_file() { split($0, pair, " = ") name = trim(pair[1]) + value = trim(pair[2]) group = "" known = 0 @@ -102,6 +103,28 @@ check_file() { seen[name] = 1 groups[group] = 1 + + if (name ~ /(^|\.)width$/) { + if (!(value ~ /^-?[0-9]{1,3}$/)) { + print "Error: Specified width " value " for " name " in section " section " is not an integer or out of range (-999..999)." + exit 1 + } + } + + if (name ~ /(^|\.)type$/) { + if (!(value ~ /^(bar|text|graph|led)$/)) { + print "Error: Specified type " value " for " name " in section " section " is not recognized." + exit 1 + } + } + + if (name ~ /(^|\.)color$/) { + if (!(value ~ /^(black|blue|green|red|cyan|magenta|yellow|(dark)?gray|white)$/)) { + print "Error: Specified color " value " for " name " in section " section " is not recognized." + exit 1 + } + } + next } diff --git a/pcp/meters/mysql b/pcp/meters/mysql index 17e7b33b9d..424d72a16d 100644 --- a/pcp/meters/mysql +++ b/pcp/meters/mysql @@ -37,7 +37,7 @@ created.label = cr created.color = yellow read.metric = mysql.status.innodb_pages_read read.label = rd -read.color = greed +read.color = green written.metric = mysql.status.innodb_pages_written written.label = wr written.color = red