mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Make munin_events POSIX compatible
This commit is contained in:
parent
82edf59689
commit
56cd2c926c
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# -*- sh -*-
|
# -*- sh -*-
|
||||||
: <<=cut
|
: <<=cut
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ INFO, WARNING, ERROR, FATAL.
|
|||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
1.2.20160514
|
1.2.20161017
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
@ -55,7 +55,8 @@ GPLv2
|
|||||||
##############################
|
##############################
|
||||||
# Includes
|
# Includes
|
||||||
|
|
||||||
. $MUNIN_LIBDIR/plugins/plugin.sh
|
# shellcheck disable=SC1090
|
||||||
|
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Configurable variables
|
# Configurable variables
|
||||||
@ -67,12 +68,11 @@ logtail_bin=${logtail_bin:-/usr/sbin/logtail2}
|
|||||||
|
|
||||||
# Print one value
|
# Print one value
|
||||||
do_value() {
|
do_value() {
|
||||||
local FIELD="$1"
|
FIELD="$1"
|
||||||
local EVENT_LABEL="$2"
|
EVENT_LABEL="$2"
|
||||||
local EVENT_COUNT
|
|
||||||
|
|
||||||
EVENT_COUNT="$("$logtail_bin" -t "$muninupdate" 2> /dev/null | grep -c "^[0-9/: ]\{19\} \[${EVENT_LABEL}\]")"
|
EVENT_COUNT="$("$logtail_bin" -t "$muninupdate" 2> /dev/null | grep -c "^[0-9/: ]\{19\} \[${EVENT_LABEL}\]")"
|
||||||
if ! [ -z "${EVENT_COUNT//[0-9]/}" ]; then
|
|
||||||
|
if ! [ -z "$(echo "$EVENT_COUNT" | sed 's|[0-9]\+||')" ]; then
|
||||||
echo "Cannot determine event count" 1>&2
|
echo "Cannot determine event count" 1>&2
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
@ -87,7 +87,7 @@ values() {
|
|||||||
do_value 'munin_error' 'ERROR'
|
do_value 'munin_error' 'ERROR'
|
||||||
do_value 'munin_fatal' 'FATAL'
|
do_value 'munin_fatal' 'FATAL'
|
||||||
# Set offset
|
# Set offset
|
||||||
"$logtail_bin" "$muninupdate" &> /dev/null
|
"$logtail_bin" "$muninupdate" > /dev/null 1>&2
|
||||||
chmod 640 "${muninupdate}.offset"
|
chmod 640 "${muninupdate}.offset"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user