GlusterPeerStatus - command gluster peer status

class insights.parsers.gluster_peer_status.GlusterPeerStatus(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

Parse the output of gluster peer status

Typical output of gluster peer status command is:

Number of Peers: 1

Hostname: versegluster1.verse.loc
Uuid: 86c0266b-c78c-4d0c-afe7-953dec143530
State: Peer in Cluster (Connected)

Examples

>>> output.status['peers']
1
>>> len(output.status.get('hosts', []))
1
>>> output.status.get('hosts', [])[0].get('Hostname')
'versegluster1.verse.loc'
status

A dict with keys peers and hosts. For example:

{'peers': 3,
 'hosts': [
           {'Hostname': 'foo.com', 'State': 'Peer in Cluster (Connected)', 'Uuid': '86c0266b-c78c-4d0c-afe7-953dec143530'},
           {'Hostname': 'example.com', 'State': 'Peer in Cluster (Connected)', 'Uuid': '3b4673e3-5e95-4c02-b9bb-2823483e067b'},
           {'Hostname': 'bar.com', 'State': 'Peer in Cluster (Disconnected)', 'Uuid': '4673e3-5e95-4c02-b9bb-2823483e067bb3'}]
}
Type

dict

parse_content(content)[source]

This method must be implemented by classes based on this class.