1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-11-24 18:51:02 +01:00
ansible-collection-prometheus/roles/prometheus_node_openbsd/templates/syspatch.sh.j2

17 lines
508 B
Text
Raw Permalink Normal View History

2020-11-13 10:36:46 +01:00
#!/bin/sh
{{ ansible_managed | comment}}
N_PATCHES="$(/usr/sbin/syspatch -c | wc -l)"
TMPFILE="$(/usr/bin/mktemp /tmp/prometheus-node-exporter-syspatch.XXXXXX)"
/bin/cat > "${TMPFILE}" <<EOF
# TYPE syspatch_upgrades_pending gauge
# HELP syspatch_upgrades_pending Number of available system patches
syspatch_upgrades_pending ${N_PATCHES}
EOF
/sbin/chown _nodeexporter:_nodeexporter "${TMPFILE}"
/bin/chmod 0640 "${TMPFILE}"
# Atomic move
/bin/mv "$TMPFILE" "{{ node_exporter_textfile_dir }}/syspatch.prom"