Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / pnp-templates / check_mk-cpu.loads.php
blobd1f1cf7cb372cab5f51becccaf2fc9a382d4d5e2
1 <?php
2 # +------------------------------------------------------------------+
3 # | ____ _ _ __ __ _ __ |
4 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
5 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6 # | | |___| | | | __/ (__| < | | | | . \ |
7 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
8 # | |
9 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
10 # +------------------------------------------------------------------+
12 # This file is part of Check_MK.
13 # The official homepage is at http://mathias-kettner.de/check_mk.
15 # check_mk is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by
17 # the Free Software Foundation in version 2. check_mk is distributed
18 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
21 # tails. You should have received a copy of the GNU General Public
22 # License along with GNU Make; see the file COPYING. If not, write
23 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 # Boston, MA 02110-1301 USA.
26 # The number of data source various due to different
27 # settings (such as averaging). We rather work with names
28 # than with numbers.
29 $RRD = array();
30 foreach ($NAME as $i => $n) {
31 $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
32 $WARN[$n] = $WARN[$i];
33 $CRIT[$n] = $CRIT[$i];
34 $MIN[$n] = $MIN[$i];
35 $MAX[$n] = $MAX[$i];
38 $title = "CPU Load for $hostname";
39 if ($MAX[1]) {
40 $title .= " - $MAX[1] CPU Cores";
43 $opt[1] = "--vertical-label 'Load average' -l0 -u 1 --title \"$title\" ";
45 $def[1] = ""
46 . "DEF:load1=$RRD[load1] "
47 . "AREA:load1#60c0e0:\"Load average 1 min \" "
48 . "GPRINT:load1:LAST:\"%6.2lf last\" "
49 . "GPRINT:load1:AVERAGE:\"%6.2lf avg\" "
50 . "GPRINT:load1:MAX:\"%6.2lf max\\n\" "
52 . "DEF:load15=$RRD[load15] "
53 . "LINE:load15#004080:\"Load average 15 min \" "
54 . "GPRINT:load15:LAST:\"%6.2lf last\" "
55 . "GPRINT:load15:AVERAGE:\"%6.2lf avg\" "
56 . "GPRINT:load15:MAX:\"%6.2lf max\\n\" "
57 . "";
59 if ($WARN[1]) {
60 $def[1] .= ""
61 . "HRULE:$WARN[1]#FFFF00 "
62 . "HRULE:$CRIT[1]#FF0000 "
63 . "";
67 if (isset($RRD["predict_load15"])) {
68 $def[1] .= ""
69 . "DEF:predict=$RRD[predict_load15] "
70 . "LINE:predict#ff0000:\"Reference for prediction \\n\" "
71 . "";