summaryrefslogtreecommitdiff
path: root/tsp
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2017-05-29 11:02:05 +0200
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-08-08 10:18:08 +0200
commit78ce9bc5bc2644bb1362d6ab01b7eeaf3c4482fc (patch)
tree04974a70e6da4efbd70957290a4b1a37be99057d /tsp
parent5a08f0b47b9f6d3aaafdd16d42d5057485278ae4 (diff)
downloadmajor-78ce9bc5bc2644bb1362d6ab01b7eeaf3c4482fc.tar.gz
major-78ce9bc5bc2644bb1362d6ab01b7eeaf3c4482fc.tar.bz2
major-78ce9bc5bc2644bb1362d6ab01b7eeaf3c4482fc.zip
Report tsrun_target queue length to Prometheus
Change-Id: I1ca21846720e550a136e055edfa8412bb804164e
Diffstat (limited to 'tsp')
-rw-r--r--tsp/cronfile.example1
-rwxr-xr-xtsp/watchers/watch_target_queues.sh28
2 files changed, 29 insertions, 0 deletions
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 <a.mistewicz@samsung.com>
+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