From 44993a5d0db8b0829ec98efd16d408256662b57d Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Mon, 12 Apr 2021 22:56:04 -0500 Subject: [PATCH] collect RGW status as part of ceph collector --- pkg/collect/ceph.go | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/pkg/collect/ceph.go b/pkg/collect/ceph.go index fa733e24..1c6fd5d5 100644 --- a/pkg/collect/ceph.go +++ b/pkg/collect/ceph.go @@ -18,10 +18,11 @@ const ( ) type CephCommand struct { - ID string - Command []string - Args []string - Format string + ID string + Command []string + Args []string + Format string + DefaultTimeout string } var CephCommands = []CephCommand{ @@ -73,6 +74,13 @@ var CephCommands = []CephCommand{ Args: []string{"-f", "json-pretty"}, Format: "json", }, + { + ID: "rgw-stats", + Command: []string{"radosgw-admin", "bucket", "stats"}, + Args: []string{"--rgw-cache-enabled=false"}, + Format: "json", + DefaultTimeout: "30s", // include a default timeout because this command will hang if the RGW daemon isn't running/is unhealthy + }, } func Ceph(c *Collector, cephCollector *troubleshootv1beta2.Ceph) (map[string][]byte, error) { @@ -100,12 +108,17 @@ func Ceph(c *Collector, cephCollector *troubleshootv1beta2.Ceph) (map[string][]b } func cephCommandExec(ctx context.Context, c *Collector, cephCollector *troubleshootv1beta2.Ceph, pod *corev1.Pod, command CephCommand) (map[string][]byte, error) { + timeout := cephCollector.Timeout + if timeout == "" { + timeout = command.DefaultTimeout + } + execCollector := &troubleshootv1beta2.Exec{ Selector: labelsToSelector(pod.Labels), Namespace: pod.Namespace, Command: command.Command, Args: command.Args, - Timeout: cephCollector.Timeout, + Timeout: timeout, } results, err := Exec(c, execCollector) if err != nil {