aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPonnuvel Palaniyappan <pponnuvel@gmail.com>2022-03-10 17:50:30 +0000
committerJake Hunsaker <jhunsake@redhat.com>2022-03-14 10:11:51 -0400
commit950f84728976cda298d05bbc7bd9ff3fc78768f5 (patch)
tree7cafa1afb313c6ae14fcdd9136d47dac8a8122e9
parent4c92968ce461cdfc6a5d913748b2ce4f148ff4a9 (diff)
downloadsos-950f84728976cda298d05bbc7bd9ff3fc78768f5.tar.gz
[ceph_mon] Replace an obsolete command
mon_status command is no longer available since Octopus release. Replaced it with its ceph tell equivalent that works in both older as well as newer Ceph releases. [ceph_osd/mgr] Improve the method to locate the daemon's IDs. Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
-rw-r--r--sos/report/plugins/ceph_mgr.py11
-rw-r--r--sos/report/plugins/ceph_mon.py21
-rw-r--r--sos/report/plugins/ceph_osd.py11
3 files changed, 34 insertions, 9 deletions
diff --git a/sos/report/plugins/ceph_mgr.py b/sos/report/plugins/ceph_mgr.py
index 8ee60687..ff0c50cc 100644
--- a/sos/report/plugins/ceph_mgr.py
+++ b/sos/report/plugins/ceph_mgr.py
@@ -79,10 +79,13 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
# Extract the OSD ids from valid output lines
for procs in out['output'].splitlines():
proc = procs.split()
- if len(proc) < 6:
- continue
- if proc[4] == '--id' and "ceph-mgr" in proc[0]:
- mgr_ids.append("mgr.%s" % proc[5])
+ # Locate the '--id' value
+ if proc and proc[0].endswith("ceph-mgr"):
+ try:
+ id_index = proc.index("--id")
+ mgr_ids.append("mgr.%s" % proc[id_index+1])
+ except (IndexError, ValueError):
+ self.log_warn("could not find ceph-mgr id: %s", procs)
# If containerized, run commands in containers
try:
diff --git a/sos/report/plugins/ceph_mon.py b/sos/report/plugins/ceph_mon.py
index 142c0822..4ab5c6ba 100644
--- a/sos/report/plugins/ceph_mon.py
+++ b/sos/report/plugins/ceph_mon.py
@@ -49,7 +49,6 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
"ceph config log",
"ceph config generate-minimal-conf",
"ceph config-key dump",
- "ceph mon_status",
"ceph osd metadata",
"ceph osd erasure-code-profile ls",
"ceph osd crush show-tunables",
@@ -90,6 +89,26 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
"ceph %s --format json-pretty" % s for s in ceph_cmds
], subdir="json_output", tags="insights_ceph_health_detail")
+ mon_ids = []
+ # Get the ceph user processes
+ out = self.exec_cmd('ps -u ceph -o args')
+
+ if out['status'] == 0:
+ # Extract the mon ids
+ for procs in out['output'].splitlines():
+ proc = procs.split()
+ # Locate the '--id' value of ceph-mon
+ if proc and proc[0].endswith("ceph-mon"):
+ try:
+ id_index = proc.index("--id")
+ mon_ids.append(proc[id_index+1])
+ except (IndexError, ValueError):
+ self.log_warn("could not find ceph-mon id: %s", procs)
+
+ self.add_cmd_output([
+ "ceph tell mon.%s mon_status" % mon_id for mon_id in mon_ids
+ ], subdir="json_output", tags="insights_ceph_health_detail")
+
# these can be cleaned up too but leaving them for safety for now
self.add_forbidden_path([
"/etc/ceph/*keyring*",
diff --git a/sos/report/plugins/ceph_osd.py b/sos/report/plugins/ceph_osd.py
index 52cf52df..dc3d3af1 100644
--- a/sos/report/plugins/ceph_osd.py
+++ b/sos/report/plugins/ceph_osd.py
@@ -73,10 +73,13 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
# Extract the OSD ids from valid output lines
for procs in out['output'].splitlines():
proc = procs.split()
- if len(proc) < 6:
- continue
- if proc[4] == '--id' and proc[5].isdigit():
- osd_ids.append("osd.%s" % proc[5])
+ # Locate the '--id' value
+ if proc and proc[0].endswith("ceph-osd"):
+ try:
+ id_index = proc.index("--id")
+ osd_ids.append("osd.%s" % proc[id_index+1])
+ except (IndexError, ValueError):
+ self.log_warn("could not find ceph-osd id: %s", procs)
try:
cname = self.get_all_containers_by_regex("ceph-osd*")[0][1]