Skip to content

Commit

Permalink
Merge pull request #48 from smarterclayton/virt_none
Browse files Browse the repository at this point in the history
Bug 1789083: Not reporting 'none' when no platforms located
  • Loading branch information
openshift-merge-robot committed Jan 12, 2020
2 parents 9fbe3e3 + a1f4958 commit cef8fe2
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit cef8fe2

Please sign in to comment.