Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User friendly nagios exit function #1

Open
JensTimmerman opened this issue Oct 31, 2013 · 0 comments
Open

User friendly nagios exit function #1

JensTimmerman opened this issue Oct 31, 2013 · 0 comments

Comments

@JensTimmerman
Copy link
Contributor

Is a more user friendly nagios exit function needed or not?
It can be cumbersome to import all exit function or all nagsio tuple constants. a more easy to use wrapper can solve this.

def nagios_exit(state, message):
    """Print message according to state: supported states:
        - defined nagios constants NAGIOS_EXIT_
        - string: OK,WARNING,CRITICAL and UNKNOWN
        - integer: 0,1,2,3
    """
    nagios_states = [NAGIOS_EXIT_OK, NAGIOS_EXIT_WARNING, NAGIOS_EXIT_CRITICAL, NAGIOS_EXIT_UNKNOWN]
    for x in nagios_states:
        if state == x or state == x[0]  or state == x[1]:
            # this exits, no break or return needed
            _real_exit(message, x)
    log.raiseException('Unsupported state %s.' % (state))
itkovian pushed a commit to itkovian/vsc-utils that referenced this issue Nov 14, 2013
itkovian added a commit to itkovian/vsc-utils that referenced this issue Nov 14, 2013
FIx bugs while building the RPMs.
wpoely86 added a commit to wpoely86/vsc-utils that referenced this issue Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant