-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathslurm_cpus
executable file
·60 lines (42 loc) · 1.44 KB
/
slurm_cpus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
slurm_cpus - Plugin to measure the number of cpus in SLURM queue.
=head1 NOTES
Shows the number of CPUs in use by slurm queued jobs.
=head1 AUTHOR
Contributed by Rael Garcia Arnes (raelga@gmail.com)
=head1 LICENSE
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
case $1 in
autoconf)
echo yes
exit 0
;;
config)
echo graph_title "CPUs in use in slurm queue"
echo graph_vlabel "Jobs"
echo slurm_cpus.label "CPUs"
echo graph_category Slurm
echo slurm_cpus.warning 0
echo slurm_cpus.critical 100
echo graph_info "Number of cpus in use for the jobs enqueued in running state on slurm"
exit 0
;;
esac
squeue -o "%C" | awk 'BEGIN {s=0} {s+=$1} END {printf "slurm_cpus.value %g\n", s}'