8000 Bug con check_service.sh EXIT_CODE from eval · Issue #47 · jonschipp/nagios-plugins · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Bug con check_service.sh EXIT_CODE from eval #47
Open
@iam333

Description

@iam333

HI!

According to the code snippet:

STATUS_MSG=$(eval "$SERVICETOOL" 2>&1)
EXIT_CODE=$?

The variable EXIT_CODE will obtain the exit code of eval, not of the command that is implicit in SERVICETOOL, that is, it is not the same to obtain the exit code obtained:

Where SERVICETOOL = systemctl status service1 | grep -i Active

STATUS_MSG = $ (eval "$ SERVICETOOL" 2> & 1)
EXIT_CODE = $?

than the exit code obtained when we execute the command:

`systemctl status service1 | grep -i Active`
EXIT_CODE = $?

This causes cases like mine, in which a service that is in a failed state:

Active: failed (Result: start-limit) since vie 2021-02-12 14:11:24 CET; 3min 59s ago

give an OK in the plugin, exiting its execution in the code:

[ $TRUST_EXIT_CODE -eq 1 ] && [ $EXIT_CODE -eq 0 ] && echo "$STATUS_MSG" && exit $OK 

thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0