mirror of
https://github.com/ceph/ceph
synced 2024-12-28 22:43:29 +00:00
mgr/telemetry: add command to list all channels
List all channels, their current state, default, and description, with: $ ceph telemetry channel ls NAME ENABLED DEFAULT DESC basic ON ON Share basic cluster information (size, version) ident OFF OFF Share a user-provided description and/or contact email for the cluster crash ON ON Share metadata about Ceph daemon crashes (version, stack straces, etc) device ON ON Share device health metrics (e.g., SMART data, minus potentially identifying info like serial numbers) perf ON OFF Share perf counter metrics summed across the whole cluster Signed-off-by: Yaarit Hatuka <yaarit@redhat.com>
This commit is contained in:
parent
012bde7b26
commit
1c1fcad510
@ -15,6 +15,7 @@ import requests
|
||||
import uuid
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
from prettytable import PrettyTable
|
||||
from threading import Event, Lock
|
||||
from collections import defaultdict
|
||||
from typing import cast, Any, DefaultDict, Dict, List, Optional, Tuple, TypeVar, TYPE_CHECKING, Union
|
||||
@ -1439,6 +1440,39 @@ To enable, add '--license {LICENSE}' to the 'ceph telemetry on' command.'''
|
||||
'''
|
||||
return self.toggle_channel('disable', channels)
|
||||
|
||||
@CLIReadCommand('telemetry channel ls')
|
||||
def channel_ls(self) -> Tuple[int, str, str]:
|
||||
'''
|
||||
List all channels
|
||||
'''
|
||||
table = PrettyTable(
|
||||
[
|
||||
'NAME', 'ENABLED', 'DEFAULT', 'DESC',
|
||||
],
|
||||
border=False)
|
||||
table.align['NAME'] = 'l'
|
||||
table.align['ENABLED'] = 'l'
|
||||
table.align['DEFAULT'] = 'l'
|
||||
table.align['DESC'] = 'l'
|
||||
table.left_padding_width = 0
|
||||
table.right_padding_width = 4
|
||||
|
||||
for c in ALL_CHANNELS:
|
||||
enabled = "ON" if getattr(self, f"channel_{c}") else "OFF"
|
||||
for o in self.MODULE_OPTIONS:
|
||||
if o['name'] == f"channel_{c}":
|
||||
default = "ON" if o.get('default', None) else "OFF"
|
||||
desc = o.get('desc', None)
|
||||
|
||||
table.add_row((
|
||||
c,
|
||||
enabled,
|
||||
default,
|
||||
desc,
|
||||
))
|
||||
|
||||
return 0, table.get_string(), ''
|
||||
|
||||
@CLICommand('telemetry send')
|
||||
def do_send(self,
|
||||
endpoint: Optional[List[EndPoint]] = None,
|
||||
|
Loading…
Reference in New Issue
Block a user