check_mysql_slave: fix null attributes
This commit is contained in:
parent
f76ec953b9
commit
7941b3e6ac
|
@ -52,9 +52,7 @@ def main(args):
|
||||||
sys.exit(nagios.STATE_UNKNOWN)
|
sys.exit(nagios.STATE_UNKNOWN)
|
||||||
|
|
||||||
last_io_error = slave_status['Last_IO_Error']
|
last_io_error = slave_status['Last_IO_Error']
|
||||||
if not last_io_error:
|
last_sql_error = slave_status['Last_SQL_Error']
|
||||||
print("UNKNOWN - Could not retrieve Last_IO_Error")
|
|
||||||
sys.exit(nagios.STATE_UNKNOWN)
|
|
||||||
|
|
||||||
replication_delay = -1
|
replication_delay = -1
|
||||||
perfdata = {}
|
perfdata = {}
|
||||||
|
@ -72,16 +70,7 @@ def main(args):
|
||||||
exit_msg.append(f'Last IO Error: {last_io_error.strip(".")}.')
|
exit_msg.append(f'Last IO Error: {last_io_error.strip(".")}.')
|
||||||
|
|
||||||
if exit_code == nagios.STATE_OK:
|
if exit_code == nagios.STATE_OK:
|
||||||
# Only check these things if everything else is healthy.
|
# Only replication delay if everything else is healthy.
|
||||||
|
|
||||||
last_sql_error = slave_status['Last_SQL_Error']
|
|
||||||
if not last_sql_error:
|
|
||||||
print("UNKNOWN - Could not retrieve Last_SQL_Error")
|
|
||||||
sys.exit(nagios.STATE_UNKNOWN)
|
|
||||||
if last_sql_error:
|
|
||||||
exit_code = nagios.STATE_CRIT
|
|
||||||
exit_msg.append(f'Last SQL Error: {last_sql_error.strip(".")}.')
|
|
||||||
|
|
||||||
if not slave_status['Seconds_Behind_Master']:
|
if not slave_status['Seconds_Behind_Master']:
|
||||||
print("UNKNOWN - Could not retrieve Seconds_Behind_Master")
|
print("UNKNOWN - Could not retrieve Seconds_Behind_Master")
|
||||||
sys.exit(nagios.STATE_UNKNOWN)
|
sys.exit(nagios.STATE_UNKNOWN)
|
||||||
|
|
Loading…
Reference in New Issue