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)
|
||||
|
||||
last_io_error = slave_status['Last_IO_Error']
|
||||
if not last_io_error:
|
||||
print("UNKNOWN - Could not retrieve Last_IO_Error")
|
||||
sys.exit(nagios.STATE_UNKNOWN)
|
||||
last_sql_error = slave_status['Last_SQL_Error']
|
||||
|
||||
replication_delay = -1
|
||||
perfdata = {}
|
||||
|
@ -72,16 +70,7 @@ def main(args):
|
|||
exit_msg.append(f'Last IO Error: {last_io_error.strip(".")}.')
|
||||
|
||||
if exit_code == nagios.STATE_OK:
|
||||
# Only check these things 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(".")}.')
|
||||
|
||||
# Only replication delay if everything else is healthy.
|
||||
if not slave_status['Seconds_Behind_Master']:
|
||||
print("UNKNOWN - Could not retrieve Seconds_Behind_Master")
|
||||
sys.exit(nagios.STATE_UNKNOWN)
|
||||
|
|
Loading…
Reference in New Issue