mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 22:25:23 +00:00
Nginx error: log files may be empty
This commit is contained in:
parent
a2ebe02412
commit
caf3b6c90f
1 changed files with 6 additions and 2 deletions
|
@ -122,9 +122,13 @@ http_codes[503]='Service Unavailable'
|
||||||
do_fetch () {
|
do_fetch () {
|
||||||
local count status_code
|
local count status_code
|
||||||
declare -A line_counts
|
declare -A line_counts
|
||||||
|
values="$(awk '{print $9}' "$log" | sort | uniq -c)"
|
||||||
|
# Log files may be empty due to logrotation
|
||||||
|
if [ -n "$values" ]; then
|
||||||
while read -r count status_code; do
|
while read -r count status_code; do
|
||||||
line_counts[$status_code]=$count
|
line_counts[$status_code]=$count
|
||||||
done <<< "$(awk '{print $9}' "$log" | sort | uniq -c)"
|
done <<< "$values"
|
||||||
|
fi
|
||||||
|
|
||||||
for status_code in "${!http_codes[@]}"; do
|
for status_code in "${!http_codes[@]}"; do
|
||||||
echo "error${status_code}.value ${line_counts[$status_code]:-0}"
|
echo "error${status_code}.value ${line_counts[$status_code]:-0}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue