mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Minor cleanup of logs/ plugins
* fix spelling mistake (thanks, codespell) * do not hide exit code of command substitution via "local" (thanks, shellcheck) * avoid access of potentially undefined variables (thanks, shellcheck) * fix tabs/spaces * avoid variable substitution in arithmetic substitution * reduce number of successive blank lines at the top level down to two * simplify evaluation of "printenv" output
This commit is contained in:
parent
48953d84d2
commit
e48f0a3b79
2 changed files with 22 additions and 31 deletions
|
@ -83,14 +83,14 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
=cut
|
||||
|
||||
|
||||
|
||||
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||
|
||||
regex=${regex:-}
|
||||
logfiles=${logfiles:-}
|
||||
LOGFILES="$(IFS= ; for f in $logfiles; do echo "$f"; done)"
|
||||
title="${title:-Log Matches}"
|
||||
|
||||
|
||||
|
||||
|
||||
function config() {
|
||||
echo "graph_title ${title}"
|
||||
echo "graph_args --base 1000 -l 0"
|
||||
|
@ -111,13 +111,12 @@ function config() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function fetch() {
|
||||
# Load state
|
||||
touch "$MUNIN_STATEFILE"
|
||||
local curstate="$(cat "$MUNIN_STATEFILE")"
|
||||
local nextstate=()
|
||||
local curstate
|
||||
curstate="$(cat "$MUNIN_STATEFILE")"
|
||||
|
||||
local var_prefix logfile prvlines curlines matches
|
||||
while read -u 3 -r logfile; do
|
||||
|
@ -161,11 +160,7 @@ function fetch() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "$1" in
|
||||
config) config ;;
|
||||
*) fetch ;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue