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
+*/2 * * * * /opt/testlab-major/tsp/watchers/watch_processes.sh
0 */8 * * * /opt/testlab-major/tsp/watchers/watch_symlinks.sh
--- /dev/null
+#!/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"
+
+EXEC_NAME="exec_count"
+EXEC="$(mktemp)"
+{
+ echo "# HELP $EXEC_NAME Number of processes present in the system"
+ echo "# TYPE $EXEC_NAME gauge"
+} > "$EXEC"
+
+for cmd in "tsp" "wget" "sh" "python" "watcher" "dd"
+do
+ COUNT="$(ps -C "${cmd}" | wc -l)"
+ echo "${EXEC_NAME}{target=\"${cmd}\"} $((COUNT-1))" >> "$EXEC"
+done
+
+chmod 644 "$EXEC"
+mv "$EXEC" "$PROM_DIR/exec_count.prom"