Skip to content

Commit

Permalink
Use JSON format to obtain data from 'ceph -s'
Browse files Browse the repository at this point in the history
'ceph -s' text output format strongly depends upon ceph version. Using JSON format to obtain data works across different ceph versions.
  • Loading branch information
xavise committed Jul 25, 2018
1 parent d01aa27 commit 4ac9c7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/ceph/ceph_osd
Expand Up @@ -44,6 +44,6 @@ if [ "$1" = "config" ]; then
exit 0
fi

echo "osds.value $(ceph -s | grep osdmap | awk '{ print $3 }')"
echo "up.value $(ceph -s | grep osdmap | awk '{ print $5 }')"
echo "in.value $(ceph -s | grep osdmap | awk '{ print $7 }')"
echo "osds.value $(ceph -s --format=json | jq '.osdmap.osdmap.num_osds')"
echo "up.value $(ceph -s --format=json | jq '.osdmap.osdmap.num_up_osds')"
echo "in.value $(ceph -s --format=json | jq '.osdmap.osdmap.num_in_osds')"

0 comments on commit 4ac9c7b

Please sign in to comment.