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

Fix trigger in Zabbix 4.0 LTS, add support to systemd 219 (CentOS 7) #37

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
4 changes: 3 additions & 1 deletion usr/local/bin/zbx_service_restart_check_old.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
service="$1"
now=$(date +%s)

uptime_value=$(systemctl show --value -p ActiveEnterTimestamp sysinit.target)

# Don't alert if the server has just been restarted
uptime=$(date +%s -d "$(systemctl show --value -p ActiveEnterTimestamp sysinit.target)")
uptime=$(date +%s -d "$uptime_value")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just extracted the variable

if [[ $(( now - uptime)) -lt 180 ]]; then
echo 0
else
Expand Down