From 78ce9bc5bc2644bb1362d6ab01b7eeaf3c4482fc Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Mon, 29 May 2017 11:02:05 +0200 Subject: Report tsrun_target queue length to Prometheus Change-Id: I1ca21846720e550a136e055edfa8412bb804164e --- tsp/cronfile.example | 1 + tsp/watchers/watch_target_queues.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 tsp/watchers/watch_target_queues.sh (limited to 'tsp') diff --git a/tsp/cronfile.example b/tsp/cronfile.example index c32d775..e7d3ee3 100644 --- a/tsp/cronfile.example +++ b/tsp/cronfile.example @@ -2,4 +2,5 @@ 0 */4 * * * /opt/testlab-major/tsp/watchers/watch_diskspace.sh 0 * * * * /opt/testlab-major/tsp/watchers/watch_sdb.sh */10 * * * * /opt/testlab-major/tsp/watchers/watch_usb.sh +*/2 * * * * /opt/testlab-major/tsp/watchers/watch_target_queues.sh 0 */8 * * * /opt/testlab-major/tsp/watchers/watch_symlinks.sh diff --git a/tsp/watchers/watch_target_queues.sh b/tsp/watchers/watch_target_queues.sh new file mode 100755 index 0000000..5380484 --- /dev/null +++ b/tsp/watchers/watch_target_queues.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Author: Aleksander Mistewicz +export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.." + +. "${TSP_DIR}/common.sh" + +for ltarget in $TARGET_LIST +do + target="${ltarget#*-}" + COUNT="$(tsrun_target "${target}" | grep queued | wc -l)" + # Report queue length + post_prom "tsrun_queued_${target}" "$COUNT" "Length of ${target} queue" +done -- cgit v1.2.3