update check_mysql_slave
This commit is contained in:
parent
a2b6174b49
commit
f911448a90
10
README.md
10
README.md
|
@ -1,13 +1,17 @@
|
|||
# icinga2-checks
|
||||
|
||||
My custom Icinga2 checks.
|
||||
_My custom Icinga2 checks._
|
||||
|
||||
Useful: https://nagios-plugins.org/doc/guidelines.html#AEN200
|
||||
https://icinga.com/docs/icinga-2/latest/doc/05-service-monitoring/#performance-data-metrics
|
||||
|
||||
`requirements-everybody.txt`: pip requirements for all Python 3 versions and Linux and BSD hosts. Should be easy to install on all hosts.
|
||||
`requirements-everybody.txt`: pip requirements for all Python 3 versions and Linux and BSD hosts. Should be easy to
|
||||
install on all hosts.
|
||||
|
||||
`requirements-difficult.txt`: pip requirements that are easy to install on normal Debian hosts but complicated when there are wheels available.
|
||||
`requirements-difficult.txt`: pip requirements that are easy to install on normal Debian hosts but complicated when
|
||||
there are wheels available.
|
||||
|
||||
These scripts have varying levels of code quality.
|
||||
|
||||
## Fix `dbus` Issues
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ import traceback
|
|||
|
||||
import mysql.connector
|
||||
|
||||
from checker import nagios, print_icinga2_check_status
|
||||
from checker import nagios
|
||||
from checker.result import quit_check
|
||||
from checker.types import try_int
|
||||
|
||||
"""
|
||||
|
@ -107,19 +108,12 @@ def main(args):
|
|||
},
|
||||
}
|
||||
|
||||
text_result = ' '.join(exit_msg)
|
||||
print_icinga2_check_status(text_result, exit_code, perfdata)
|
||||
sys.exit(exit_code)
|
||||
quit_check(' '.join(exit_msg), exit_code, perfdata)
|
||||
|
||||
except mysql.connector.Error as e:
|
||||
print("UNKNOWN - Could not connect to database!")
|
||||
print(e)
|
||||
sys.exit(nagios.STATE_UNKNOWN)
|
||||
quit_check(f'Could not connect to database: {e}', nagios.STATE_CRIT)
|
||||
except Exception as e:
|
||||
print(f"UNKNOWN - {e}")
|
||||
traceback.print_exc()
|
||||
sys.exit(nagios.STATE_UNKNOWN)
|
||||
|
||||
quit_check(f'Unknown error: {e}\n{traceback.format_exc()}', nagios.STATE_UNKNOWN)
|
||||
finally:
|
||||
if cursor:
|
||||
cursor.close()
|
||||
|
|
Loading…
Reference in New Issue