Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ for service in 'compute' 'network' 'volume'; do
echo "${metric}{cloud=\"${OS_CLOUD}\",project=\"${os_project}\",type=\"limit\"} $limit"
done
done


metric=openstack_server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be openstack_server_status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in my first iteration. But then I thought: shall we reflect the attributes in the metric? That's really the number of existing servers. Shall the metric name reflect the fact that the list is broken down by status?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'm sold.

/lgtm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was easier than expected

echo "# HELP ${metric} OpenStack servers by status"
echo "# TYPE ${metric} gauge"
openstack server list -f value -c Status \
| uniq -c \
| while read -r number state; do
echo "${metric}{cloud=\"${OS_CLOUD}\",project=\"${os_project}\",status=\"${state}\"} $number";
done