mirror of
https://gitlab.com/s3lph/ansible-collection-prometheus
synced 2024-11-24 18:51:02 +01:00
17 lines
508 B
Text
17 lines
508 B
Text
|
#!/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"
|