OpenVPN: fix path to Zabbix agent config in cron, part 2

Helps if you add all the files you changed...

Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
Greg Sutcliffe 2026-03-12 12:01:20 +00:00
commit 084da3c5ab
Signed by: gwmngilfen
SSH key fingerprint: SHA256:dNHcz65ApR68w2TkCIAXDBdt4oNL62Fyx48U7dXWuk0
2 changed files with 2 additions and 22 deletions

View file

@ -1,20 +0,0 @@
#!/usr/bin/bash
# A script to report days-left on the openvpn cert to zabbix
# Configuration
CERT_FILE="/etc/openvpn/client/client.crt"
# Get certificate expiry
EXPIRY=$(openssl x509 -in "$CERT_FILE" -noout -enddate | cut -d= -f2)
if [ -z "$EXPIRY" ]; then
echo "problem reading $CERT_FILE"
exit 1
fi
# Convert to epoch and calculate days remaining
EXPIRY_EPOCH=$(date -d "$EXPIRY" +%s)
NOW_EPOCH=$(date +%s)
DAYS_LEFT=$(( ($EXPIRY_EPOCH - $NOW_EPOCH) / 86400 ))
/usr/bin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k openvpn.cert_date -o "$DAYS_LEFT" > /dev/null

View file

@ -71,8 +71,8 @@
# OpenVPN certs have restrcited permissions, so we use a zabbix-sender cronjob
# for this, which runs as root once per day
- name: Setup OpenVPN monitoring cron job
ansible.builtin.copy:
src: zabbix/cron-openvpn-cert
ansible.builtin.template:
src: zabbix/cron-openvpn-cert.j2
dest: /etc/cron.daily/zabbix-openvpn-cert
owner: root
group: root