X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=sysd-prom-fail-install;h=f25510ef094ce28df9d5cba7e0633bad961aac32;hb=bc712f26afdccd6ecea609edc3705ae719c55b8d;hp=ad9845654480ff0cc93297bb90e7e7b9ee13caec;hpb=5f3c302e1c06c5ff8e8b8d88dcc6d9699ebedb6d;p=log-quiet diff --git a/sysd-prom-fail-install b/sysd-prom-fail-install index ad98456..f25510e 100755 --- a/sysd-prom-fail-install +++ b/sysd-prom-fail-install @@ -16,17 +16,17 @@ # usage: since this is a counter, in prometheus alert manager you will # need to test something like: rate(node_systemd_unit_result_fail_count[30m]) > 0 -source /a/bin/errhandle/err +source /a/bin/bash-bear-trap/bash-bear [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" ser_name=$1 mkdir -p /var/lib/prometheus/node-exporter -f=/var/local/sysd-prom-fail/${ser_name}-result-fail.prom +f=/var/local/sysd-prom-fail/${ser_name}-result.prom -if [[ ! -s /var/lib/prometheus/node-exporter/${ser_name}-result-fail.premerge ]]; then +if [[ ! -s $f ]]; then SERVICE_RESULT=success /usr/local/bin/sysd-prom-fail $ser_name fi @@ -48,3 +48,5 @@ if [[ $out ]]; then systemctl restart $ser_name ||: fi fi + +# todo: make uninstall script