Skip to content

Commit 44526f3

Browse files
Merge pull request #196 from shiftstack/errored_instances
metrics: Expose server status
2 parents 697a8d4 + 10e08d8 commit 44526f3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

metrics.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ for service in 'compute' 'network'; do
2525
echo "${metric}{cloud=\"${OS_CLOUD}\",project=\"${os_project}\",type=\"limit\"} $limit"
2626
done
2727
done
28+
29+
30+
metric=openstack_server
31+
echo "# HELP ${metric} OpenStack servers by status"
32+
echo "# TYPE ${metric} gauge"
33+
openstack server list -f value -c Status \
34+
| uniq -c \
35+
| while read -r number state; do
36+
echo "${metric}{cloud=\"${OS_CLOUD}\",project=\"${os_project}\",status=\"${state}\"} $number";
37+
done

0 commit comments

Comments
 (0)