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

Need a "ceph-whatami" kind of utility that returns the type of ceph node {mon|mgr|mds|rgw|osd} #32

Open
nkshirsagar opened this issue Sep 22, 2021 · 3 comments

Comments

@nkshirsagar
Copy link

It would be nice to have a utility that can run on any node and return what node it is (mon/mgr/mds/osd/rgw)

For a script, it's difficult to be sure what node it is running on. For example, if someone is writing a script that needs to do different things depending on whether it's run on a mon or osd node, for eg., there's no easy way to be sure unless you do a combination of things like check running services, examine /var/lib/ceph/XXX for non empty folders, etc.

So for example the expected behavior would be, when run on a OSD node,
$ceph-whatami
OSD

When run on a mon+mgr node
$ceph-whatami
MON
MGR

When run on a RGW node,
$ceph-whatami
RGW

This would come in handy for any scripts that need to behave differently depending on whether they're running on mon/osd/mgr/rgw/mds ceph nodes.

@KervyN
Copy link

KervyN commented Sep 22, 2021 via email

@nkshirsagar
Copy link
Author

nkshirsagar commented Sep 22, 2021 via email

@AntonOks
Copy link

a script I have to show CEPH services and the related hosts, is:

#!/bin/env bash

clear
echo "# MONs #"
ceph mon metadata | jq -c '.[].name' | sort -u | sed 's/"//g'

echo "# MGRs #"
ceph mgr metadata | jq -c '.[].name' | sort -u | sed 's/"//g'

echo "# OSDs #"
ceph osd metadata | jq -c '.[].hostname' | sort -u | sed 's/"//g'

echo "# RGWs #"
ceph service dump | awk -F: ' /hostname/ {print $2}' | sed -e 's/"//g' -e 's/,//g' -e "s/ //g" | sort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants