from mgr_module import MgrModule
+ALL_CHANNELS = ['basic', 'crash', 'device']
class Module(MgrModule):
config = dict()
"perm": "rw"
},
{
- "cmd": "telemetry show",
+ "cmd": "telemetry show "
+ "name=channels,type=CephString,n=N,req=False",
"desc": "Show last report or report to be sent",
"perm": "r"
},
except:
return None
- def compile_report(self):
+ def compile_report(self, channels=[]):
+ if not channels:
+ channels = self.get_active_channels()
report = {
'leaderboard': False,
'report_version': 1,
'report_timestamp': datetime.utcnow().isoformat(),
'report_id': self.report_id,
- 'channels': self.get_active_channels(),
+ 'channels': channels,
+ 'channels_available': ALL_CHANNELS,
}
if self.leaderboard:
for option in ['description', 'contact', 'organization']:
report[option] = getattr(self, option)
- if self.channel_basic:
+ if 'basic' in channels:
mon_map = self.get('mon_map')
osd_map = self.get('osd_map')
service_map = self.get('service_map')
for key, value in service_map['services'].items():
report['services'][key] += 1
- if self.channel_crash:
+ if 'crash' in channels:
report['crashes'] = self.gather_crashinfo()
- if self.channel_devices:
+ if 'device' in channels:
report['devices'] = self.gather_device_report()
return report
)
elif command['prefix'] == 'telemetry show':
- report = self.compile_report()
+ report = self.compile_report(
+ channels=command.get('channels', None)
+ )
return 0, json.dumps(report, indent=4), ''
else:
return (-errno.EINVAL, '',