X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=sysd-prom-fail;h=0781ff4cb6d99eff36351d8968ff5c06c54ff4a1;hb=5f298276149342f9e2ddf3315355630d205a0456;hp=20e7c9b588cf69c17ca57fda652232934a064b0c;hpb=c95baa6003490dcbbda39f5b6340ab68ba121224;p=log-quiet diff --git a/sysd-prom-fail b/sysd-prom-fail index 20e7c9b..0781ff4 100755 --- a/sysd-prom-fail +++ b/sysd-prom-fail @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. + +# requires 1.4.0 to run with multiple units due to bug before that: +# https://github.com/prometheus/node_exporter/pull/2475 + set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR @@ -33,13 +37,7 @@ if [[ ! -e $dir ]]; then exit 0 fi -# we have to merge files due to this: -# https://github.com/prometheus/node_exporter/issues/1885 -# or else we could put the label in the metric name, but that -# is a bad practice. -# Note, i found this https://github.com/hansmi/prometheus-textformat-merge -# but it seems overkill. -f=$dir/${ser_name}-result-fail.premerge +f=$dir/${ser_name}-result.prom ftmp=$f.$$ @@ -67,7 +65,3 @@ if $write_count; then printf 'node_systemd_unit_result_fail_count{name="%s"} %s\n' "$ser_name" "$count" >$ftmp mv $ftmp $f fi - -finaltmp=$dir/sysd-result-fail.prom.$$ -cat $dir/*-result-fail.premerge >$finaltmp -mv $finaltmp $dir/sysd-result-fail.prom