You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be in most circumstances better to get the actual timestamp of the last time the service was restarted. Unfortunately, Zabbix' custom params does not know how to handle exception data other than making the service unavilable, so 0 probably makes sense. HEre is my implementation, based on your check-status script:
service="$1"
if [[ -z "$service" ]]; then
# Assume they mean the system itself
date +%s -d "$(uptime --since)"
else
hrt=$(systemctl show "$service" --property=ActiveEnterTimestamp | awk -F= '{print $2}')
if [[ -z $hrt ]] || [[ "$hrt" = 0 ]]; then
echo 0
else
date +%s -d "$hrt"
fi
fi
The text was updated successfully, but these errors were encountered:
Also, I refactored the other script into a nicer more efficient pipeline, but it shaves only 1% of execution time at best. I then did it in perl for a 1.01% speed-up! Here's the SH pipeline version.
It would be in most circumstances better to get the actual timestamp of the last time the service was restarted. Unfortunately, Zabbix' custom params does not know how to handle exception data other than making the service unavilable, so 0 probably makes sense. HEre is my implementation, based on your check-status script:
The text was updated successfully, but these errors were encountered: