1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Merge pull request #813 from UbiCastTeam/master

fix crash if access.log is empty
This commit is contained in:
sumpfralle 2017-02-21 19:04:21 +01:00 committed by GitHub
commit 4703a46278

View file

@ -97,10 +97,12 @@ http_codes[503]='Service Unavailable'
do_ () { # Fetch
declare -A line_counts
values=`awk '{print $9}' $log | sort | uniq -c`
while read -r line; do
read -a tmp <<< "$line";
line_counts[${tmp[1]}]=${tmp[0]};
done <<< "$values"
if [ -n "$values" ]; then
while read -r line; do
read -a tmp <<< "$line";
line_counts[${tmp[1]}]=${tmp[0]};
done <<< "$values"
fi
for k in ${!http_codes[@]}; do
echo "error$k.value ${line_counts[$k]:-0}"