diff options
Diffstat (limited to 'tsp/common.sh')
-rwxr-xr-x | tsp/common.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tsp/common.sh b/tsp/common.sh index 69f20fa..43ddf39 100755 --- a/tsp/common.sh +++ b/tsp/common.sh @@ -46,6 +46,9 @@ WS_PUBLISH="${WS}/publish" SNAPSHOT_WS_DOWNLOAD="${WS_DOWNLOAD}/snapshot" SNAPSHOT_WS_DOWNLOAD_NEW="${WS_DOWNLOAD}/new_snapshot" +PROM_DIR="${WS}/prom" + +test -d "${PROM_DIR}" || mkdir -p "${PROM_DIR}" test -d "${WS_PUBLISH}" || mkdir -p "${WS_PUBLISH}" DBNAME="results.db3" @@ -79,6 +82,20 @@ init_db() { test -f "${DBPATH}" || init_db +post_prom() { + NAME="$1" + VALUE="$2" + HELP="$3" + test -n "$NAME" || die "Missing argument: name" + test -n "$VALUE" || die "Missing argument: value" + { + test -z "$HELP" || echo "# HELP $NAME $HELP" + echo "# TYPE $NAME gauge" + echo "$NAME $VALUE" + } > "$PROM_DIR/temp.$$" + mv "$PROM_DIR/temp.$$" "$PROM_DIR/$NAME.prom" +} + tsrun_target() { test -n "$1" || die "Missing argument: target" TMPDIR="/tmp/tl-runner-$1" |