forked from infra/ansible
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:
parent
3d7a57e1b0
commit
084da3c5ab
2 changed files with 2 additions and 22 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue