From f7cce858656697ad5e1932aa25e1b9d7baa4ebe1 Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Mon, 8 Aug 2016 13:54:11 +0200 Subject: [PATCH 1/4] Add job stats graph --- plugins/sge/sge_job_stats | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 plugins/sge/sge_job_stats diff --git a/plugins/sge/sge_job_stats b/plugins/sge/sge_job_stats new file mode 100755 index 00000000..075af312 --- /dev/null +++ b/plugins/sge/sge_job_stats @@ -0,0 +1,39 @@ +#!/bin/bash + +# Graphs the number of running and waiting jobs, as well as when they +# are submitted. +# +# Tested with Son of Gridengine. + +if [ "$1" = "config" ] +then + echo graph_title SGE gridengine jobs + echo graph_vlabel count + echo graph_category processes + echo running.label Running jobs + echo running.type GAUGE + echo running.draw AREA + echo waiting.label Queued jobs + echo waiting.type GAUGE + echo waiting.draw STACK + echo maxnum.label Submitted jobs + echo maxnum.type DERIVE + echo maxnum.draw LINE2 + echo maxnum.min 0 + + exit 0 +fi + +. /opt/sge/default/common/settings.sh + +qstat -u '*' | awk ' + BEGIN{maxnum = 0; running = 0; waiting = 0} + /^ /{ + maxnum = (maxnum > $1 ? maxnum : $1); + if ( $5 == "r" ) { + running += 1; + } else { + waiting += 1; + } + } + END { printf("running.value %d\nwaiting.value %d\nmaxnum.value %d\n", running, waiting, maxnum); }' From 8c9f0260f91a43f4d75a7f6d868e8d05d9f42b68 Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Sun, 23 Oct 2016 10:36:35 +0200 Subject: [PATCH 2/4] Use sh shebang Don't need bash-specific features, after all --- plugins/sge/sge_job_stats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sge/sge_job_stats b/plugins/sge/sge_job_stats index 075af312..7350eed0 100755 --- a/plugins/sge/sge_job_stats +++ b/plugins/sge/sge_job_stats @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Graphs the number of running and waiting jobs, as well as when they # are submitted. From 5800201da8e1adfb9ff3b4f72e77bede4522eb8f Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Sun, 23 Oct 2016 10:36:58 +0200 Subject: [PATCH 3/4] Configurable location of sge settings.sh script --- plugins/sge/sge_job_stats | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/sge/sge_job_stats b/plugins/sge/sge_job_stats index 7350eed0..0423ca1e 100755 --- a/plugins/sge/sge_job_stats +++ b/plugins/sge/sge_job_stats @@ -24,7 +24,9 @@ then exit 0 fi -. /opt/sge/default/common/settings.sh +SGE_SETTINGS=${SGE_SETTINGS:-/opt/sge/default/common/settings.sh} + +. $SGE_SETTINGS qstat -u '*' | awk ' BEGIN{maxnum = 0; running = 0; waiting = 0} From 145b65469203cb3e657ae61148ef928fbd45f5bd Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Thu, 24 Nov 2016 17:37:50 +0100 Subject: [PATCH 4/4] Add minimal POD documentation --- plugins/sge/sge_job_stats | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plugins/sge/sge_job_stats b/plugins/sge/sge_job_stats index 0423ca1e..f04d4cad 100755 --- a/plugins/sge/sge_job_stats +++ b/plugins/sge/sge_job_stats @@ -5,6 +5,29 @@ # # Tested with Son of Gridengine. +: <<=cut + +=head1 NAME + +sge_job_stats - Munin plugin to monitor jobs submitted and executed on a Grid +Engine installation + +=head1 APPLICABLE SYSTEMS + +Any system with a qstat command that behaves like the one found in Son of +GridEngine. + +=head1 CONFIGURATION + +The environment variable SGE_SETTINGS can be set to point to an SGE +"settings.sh" file. It defaults to /opt/sge/default/common/settings.sh. + +=head1 AUTHOR + +Wouter Verhelst + +=cut + if [ "$1" = "config" ] then echo graph_title SGE gridengine jobs