mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
fix crash if access.log is empty
This commit is contained in:
parent
3cbaa078e7
commit
af334370db
1 changed files with 6 additions and 4 deletions
|
@ -97,10 +97,12 @@ http_codes[503]='Service Unavailable'
|
||||||
do_ () { # Fetch
|
do_ () { # Fetch
|
||||||
declare -A line_counts
|
declare -A line_counts
|
||||||
values=`awk '{print $9}' $log | sort | uniq -c`
|
values=`awk '{print $9}' $log | sort | uniq -c`
|
||||||
while read -r line; do
|
if [ -n "$values" ]; then
|
||||||
read -a tmp <<< "$line";
|
while read -r line; do
|
||||||
line_counts[${tmp[1]}]=${tmp[0]};
|
read -a tmp <<< "$line";
|
||||||
done <<< "$values"
|
line_counts[${tmp[1]}]=${tmp[0]};
|
||||||
|
done <<< "$values"
|
||||||
|
fi
|
||||||
|
|
||||||
for k in ${!http_codes[@]}; do
|
for k in ${!http_codes[@]}; do
|
||||||
echo "error$k.value ${line_counts[$k]:-0}"
|
echo "error$k.value ${line_counts[$k]:-0}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue