From 4c7c9dcdfd05a2d9648756c0da5c68588929ba5d Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 29 Dec 2014 00:34:16 +0800 Subject: restructured the project --- examples/count.sh | 10 ++++++++++ examples/cpu.sh | 8 ++++++++ examples/mem.sh | 8 ++++++++ examples/sge.sh | 8 ++++++++ examples/top.sh | 8 ++++++++ 5 files changed, 42 insertions(+) create mode 100755 examples/count.sh create mode 100755 examples/cpu.sh create mode 100755 examples/mem.sh create mode 100755 examples/sge.sh create mode 100755 examples/top.sh (limited to 'examples') diff --git a/examples/count.sh b/examples/count.sh new file mode 100755 index 0000000..3db505f --- /dev/null +++ b/examples/count.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export JMNAME='COUNTER' +export JTYPE='linegraph' +i=1 +function trigger { + $CLIENT --add "$JID" "$i" + let i=i+10000 +} +export -f trigger +./monitor_daemon.sh diff --git a/examples/cpu.sh b/examples/cpu.sh new file mode 100755 index 0000000..0487b6f --- /dev/null +++ b/examples/cpu.sh @@ -0,0 +1,8 @@ +#!/bin/bash +export JMNAME='CPU' +export JTYPE='linegraph' +function trigger { +$CLIENT --add "$JID" $(python -c $'import psutil\nimport time\nprint " ".join([str(i) for i in psutil.cpu_percent(1, True)])') +} +export -f trigger +./monitor_daemon.sh diff --git a/examples/mem.sh b/examples/mem.sh new file mode 100755 index 0000000..e8a3df6 --- /dev/null +++ b/examples/mem.sh @@ -0,0 +1,8 @@ +#!/bin/bash +export JMNAME='RAM' +export JTYPE='linegraph' +function trigger { + $CLIENT --add "$JID" $(python -c $'import psutil\nprint psutil.virtual_memory().percent') +} +export -f trigger +./monitor_daemon.sh diff --git a/examples/sge.sh b/examples/sge.sh new file mode 100755 index 0000000..ebfb65b --- /dev/null +++ b/examples/sge.sh @@ -0,0 +1,8 @@ +#!/bin/bash +export JMNAME='TOP' +export JTYPE='listgraph' +function trigger { + qstat -u '*' | tail -n +3 | head -n 10 | $CLIENT --alter "$JID" +} +export -f trigger +./monitor_daemon.sh diff --git a/examples/top.sh b/examples/top.sh new file mode 100755 index 0000000..55288b8 --- /dev/null +++ b/examples/top.sh @@ -0,0 +1,8 @@ +#!/bin/bash +export JMNAME='TOP' +export JTYPE='listgraph' +function trigger { + top -bn1 -S | tail -n +8 | head -n 10 | awk '{ print $1, $2}' | $CLIENT --alter "$JID" +} +export -f trigger +./monitor_daemon.sh -- cgit v1.2.3-70-g09d2