Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1789083: Not reporting 'none' when no platforms located #48

Merged
merged 1 commit into from
Jan 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion text_collectors/virt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ then
platforms=$(echo $( virt-what ) | tr '\n' ' ')
echo '# HELP virt_platform reports one series per detected virtualization type. If no type is detected, the type is "none".' >>"${v}"
echo '# TYPE virt_platform gauge' >>"${v}"
count=0
for platform in ${platforms}; do
if [[ -z "${platform}" ]]; then
continue
fi
count=$(( count + 1 ))
echo "virt_platform{type=\"${platform}\"} 1" >>"${v}"
done
if [[ -z "${platforms}" ]]; then
if [[ "${count}" -eq 0 ]]; then
echo "virt_platform{type=\"none\"} 1" >>"${v}"
fi
fi
Expand Down