AIX init script "status" should exit 3 when Zabbix not running
emperortomato opened this issue · comments
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
;;
@emperortomato thanks for raising the issue. Could you please provide a pull request with that change please?