1#!@@GOODSH@@ 2# -*- sh -*- 3 4: << =cut 5 6=head1 NAME 7 8load - Plugin to monitor the load average on a system. 9 10=head1 CONFIGURATION 11 12The following environment variables are used by this plugin 13 14=over 4 15 16=item load_warn <load> 17 18Warning threshold for load (Default: 10) 19 20=item load_crit <load> 21 22Critical threshold for load (Default: 120) 23 24=back 25 26=head1 AUTHOR 27 28Unknown author 29 30=head1 LICENSE 31 32Unknownl LICENSE 33 34=head1 MAGIC MARKERS 35 36 #%# family=auto 37 #%# capabilities=autoconf 38 39=cut 40 41# If run with the "autoconf"-parameter, give our opinion on wether we 42# should be run on this system or not. This is optinal, and only used by 43# munin-config. In the case of this plugin, we should most probably 44# always be included. 45 46if [ "$1" = "autoconf" ]; then 47 echo yes 48 exit 0 49fi 50 51# If run with the "config"-parameter, give out information on how the 52# graphs should look. 53 54if [ "$1" = "config" ]; then 55 LOAD_WARN=${load_warn:-10} 56 LOAD_CRIT=${load_crit:-120} 57 58 # The host name this plugin is for. (Can be overridden to have 59 # one machine answer for several) 60 61 # The title of the graph 62 echo 'graph_title Load average' 63 # Arguments to "rrdtool graph". In this case, tell it that the 64 # lower limit of the graph is '0', and that 1k=1000 (not 1024) 65 echo 'graph_args --base 1000 -l 0' 66 # The Y-axis label 67 echo 'graph_vlabel load' 68 # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of 69 # 420 milliload) 70 echo 'graph_scale no' 71 # Graph category. Defaults to 'other' 72 echo 'graph_category system' 73 # The fields. "label" is used in the legend. "label" is the only 74 # required subfield. 75 echo 'load.label load' 76 # These two are optional. They are only used if you have 77 # configured your munin to tell a Nagios-server about any 78 # problems 79 echo "load.warning $LOAD_WARN" 80 echo "load.critical $LOAD_CRIT" 81 # This one is purely to add an explanation to the web page. The first 82 # one is for the graph itself, while the second one is for the field 83 # "load". 84 echo 'graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").' 85 echo 'load.info Average load for the five minutes.' 86 87 # Last, if run with the "config"-parameter, quit here (don't 88 # display any data) 89 exit 0 90fi 91 92# If not run with any parameters at all (or only unknown ones), do the 93# real work - i.e. display the data. Almost always this will be 94# "value" subfield for every data field. 95 96printf "load.value " 97uptime | sed -e 's/^.*load averages: [^ ]* //' -e 's/ [^ ]*$//' 98