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

AIX init script "status" should exit 3 when Zabbix not running #942

Open
emperortomato opened this issue Apr 23, 2024 · 1 comment
Open

Comments

@emperortomato
Copy link

emperortomato commented Apr 23, 2024

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: Any
  • Ruby: Any
  • Distribution: AIX
  • Module version: 10.0.0

How to reproduce (e.g Puppet code you use)

Install Zabbix agent on an AIX host using this Zabbix module. Although the service is ensured to start, Puppet will not start it on subsequent runs when it is not running (e.g., if it crashes).

What are you seeing

The zabbix-agent-aix.init.epp init script exits 0 whether the PID is running or not:

status)
        [ -f $PID ] && echo "running as $(cat $PID)" || echo "stopped"
        ;;

Per Puppet's apparent behavior and the Linux specification (AIX appears to respect these same codes), the script should exit 3 when the service is not running.

The net effect of exiting 0 is that the service always appear to be running when status is called, so Puppet will not start the service when it is stopped.

What behaviour did you expect instead

Puppet starts the Zabbix service when it is not running and ensured to start.

Any additional information you'd like to impart

I forked the module in my own environment and updated the template with the following code for status. This seems to solve the issue, so you could do something like this. I would appreciate if this could be incorporated into the module so I don't need to maintain my own fork. Thanks!

status)
        if [[ -f $PID ]]; then
            echo "running as $(cat $PID)"
        else
            echo "stopped"
            exit 3
        fi
        ;;
@bastelfreak
Copy link
Member

@emperortomato thanks for raising the issue. Could you please provide a pull request with that change please?

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

2 participants