Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / pnp-templates / check_mk-kernel.php
blobff6f1071777633c9caa775a7c5f9352c8d73e47e
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 $subtype = substr($servicedesc, 7);
27 if ($subtype == "pgmajfault" || $subtype == "Major_Page_Faults") {
28 $title = "Major Page Faults";
29 $vertical = "faults / sec";
30 $format = "%5.1lf/s";
31 $upto = "500";
32 $color = "20ff80";
33 $line = "10a040";
35 else if ($subtype == "ctxt" || $subtype == "Context_Switches") {
36 $title = "Context Switches";
37 $vertical = "switches / sec";
38 $format = "%5.1lf/s";
39 $upto = "50000";
40 $color = "80ff20";
41 $line = "40a010";
43 else if ($subtype == "processes" || $subtype == "Process_Creations") {
44 $title = "Process creation";
45 $vertical = "new processes / sec";
46 $format = "%5.1lf/s";
47 $upto = "100";
48 $color = "ff8020";
49 $line = "a04010";
51 else {
52 $title = "Kernel counter $subtype";
53 $vertical = "per sec";
54 $format = "%3.0lf";
55 $upto = "100";
56 $color = "ffff20";
57 $line = "90a010";
60 $opt[1] = " --vertical-label \"$vertical\" -X0 -l 0 -u $upto --title \"$hostname: $title\" ";
62 $def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
63 $def[1] .= "AREA:var1#$color:\"$title\:\" ";
64 $def[1] .= "LINE1:var1#$line:\"\" ";
65 $def[1] .= "GPRINT:var1:LAST:\"Current\: $format\" ";
66 if ($WARN[1])
67 $lf = "\\n";
68 else
69 $lf = "";
71 $def[1] .= "GPRINT:var1:MAX:\"Maximum\: $format\" ";
72 $def[1] .= "GPRINT:var1:AVERAGE:\"Average\: $format$lf\" ";
73 if ($WARN[1]) {
74 $def[1] .= "HRULE:$WARN[1]#FFFF00:\"Warning\: $WARN[1]/s\" ";
75 $def[1] .= "HRULE:$CRIT[1]#FF0000:\"Critical\: $CRIT[1]/s\" ";