Display Ceph health in PVC status as well

Makes this output a little more realistic and allows proper monitoring
of the Ceph cluster status (separate from the PVC status which is
tracking only OSD up/in state).
This commit is contained in:
2020-08-13 15:06:19 -04:00
parent 985ad5edc0
commit 2b4d980685
3 changed files with 23 additions and 0 deletions

View File

@ -92,10 +92,19 @@ def format_info(cluster_information, oformat):
else:
health_colour = ansiprint.yellow()
if cluster_information['storage_health'] == 'Optimal':
storage_health_colour = ansiprint.green()
elif cluster_information['storage_health'] == 'Maintenance':
storage_health_colour = ansiprint.blue()
else:
storage_health_colour = ansiprint.yellow()
ainformation = []
ainformation.append('{}PVC cluster status:{}'.format(ansiprint.bold(), ansiprint.end()))
ainformation.append('')
ainformation.append('{}Cluster health:{} {}{}{}'.format(ansiprint.purple(), ansiprint.end(), health_colour, cluster_information['health'], ansiprint.end()))
ainformation.append('{}Storage health:{} {}{}{}'.format(ansiprint.purple(), ansiprint.end(), storage_health_colour, cluster_information['storage_health'], ansiprint.end()))
ainformation.append('')
ainformation.append('{}Primary node:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['primary_node']))
ainformation.append('{}Cluster upstream IP:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['upstream_ip']))
ainformation.append('')