PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /proc/self/root/opt/saltstack/salt/extras-3.10/mtrlib/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //proc/self/root/opt/saltstack/salt/extras-3.10/mtrlib/nagios.py |
"""Python/Nagios integration .. data:: OK .. data:: WARNING .. data:: CRITICAL .. data:: UNKNOWN """ import sys from functools import wraps from typing import NoReturn OK = 0 OKAY = OK WARNING = 1 CRITICAL = 2 UNKNOWN = 3 # the name arg used to be used for rads.lock() def nrpe_lock(name=None): # pylint: disable=unused-argument """Convenience decorator for NRPE scripts""" def decorator(func): @wraps(func) def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as exc: print(type(exc).__name__, exc, sep=': ') sys.exit(UNKNOWN) return wrapper return decorator def okay(*args, **kwargs) -> NoReturn: """Print a message and exit with OK status""" print(*args, **kwargs) sys.exit(OKAY) def warning(*args, **kwargs) -> NoReturn: """Print a message and exit with WARNING status""" print(*args, **kwargs) sys.exit(WARNING) def critical(*args, **kwargs) -> NoReturn: """Print a message and exit with CRITICAL status""" print(*args, **kwargs) sys.exit(CRITICAL) def unknown(*args, **kwargs) -> NoReturn: """Print a message and exit with UNKNOWN status""" print(*args, **kwargs) sys.exit(UNKNOWN) ok = okay