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:
commit
4703a46278
1 changed files with 6 additions and 4 deletions
|
@ -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}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue