Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/check_redis_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,16 @@ def main():

if master_state != 'unknown' and slave_state != 'unknown':
if cluster_state_master != 'ok' and cluster_state_slave != 'ok':
print('CRITICAL - cluster is broken')
print('cluster is broken')
code = 2
elif master_state != 'master' or slave_state != 'slave':
print('WARNING - cluster status is degraded')
if master_state != 'master':
print('{} got demoted to slave'.format(master_addr))
code = 1
if slave_state != 'slave':
print('{} got promoted to master'.format(slave_addr))
code = 1
elif master_state == slave_state:
code = 1
print(
'Redundancy lost: Two {}s on the same host! '
'If this host fails we will experience data loss!'
.format(master_state))
else:
print('OK - cluster status is OK')
print('cluster status is OK')
print('{} - {}'.format(master_addr, master_state))
print('{} - {}'.format(slave_addr, slave_state))
code = 0
Expand Down