Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / pnp-templates / check_mk-cisco_qos.php
blobb628cee5294faf01ab34556f2bc7f728c6768af2
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 $bandwidth = $MAX[1] * 8;
27 $warn = $WARN[1] * 8;
28 $crit = $CRIT[1] * 8;
30 $bwuom = '';
31 $base = 1000;
32 if($bandwidth > $base * $base * $base) {
33 $warn /= $base * $base * $base;
34 $crit /= $base * $base * $base;
35 $bandwidth /= $base * $base * $base;
36 $bwuom = 'G';
37 } elseif($bandwidth > $base * $base) {
38 $warn /= $base * $base;
39 $crit /= $base * $base;
40 $bandwidth /= $base * $base;
41 $bwuom = 'M';
42 } elseif($bandwidth > $base) {
43 $warn /= $base;
44 $crit /= $base;
45 $bandwidth /= $base;
46 $bwuom = 'K';
49 $ds_name[1] = 'QoS Class Traffic';
50 $opt[1] = "--vertical-label \"MBit/sec\" -X0 -b 1000 --title \"$hostname / $servicedesc\" ";
51 $def[1] =
52 "HRULE:0#c0c0c0 ".
53 "HRULE:$bandwidth#808080:\"Interface speed\: " . sprintf("%.1f", $bandwidth) . " ".$bwuom."Bit/s\\n\" ".
54 "HRULE:$warn#FFE000:\"Warning\: " . sprintf("%.1f", $warn) . " ".$bwuom."Bit/s\\n\" ".
55 "HRULE:$crit#FF5030:\"Critical\: " . sprintf("%.1f", $crit) . " ".$bwuom."Bit/s\\n\" ".
56 "DEF:postbytes=$RRDFILE[1]:$DS[1]:MAX ".
57 "DEF:dropbytes=$RRDFILE[2]:$DS[2]:MAX ".
58 "CDEF:post_traffic=postbytes,8,* ".
59 "CDEF:drop_traffic=dropbytes,8,* ".
60 "CDEF:postmbit=post_traffic,1000000,/ ".
61 "CDEF:dropmbit=drop_traffic,1000000,/ ".
62 "AREA:postmbit#00e060:\"post \" ".
63 "GPRINT:post_traffic:LAST:\"%5.1lf %sBit/s last\" ".
64 "GPRINT:post_traffic:AVERAGE:\"%5.1lf %sBit/s avg\" ".
65 "GPRINT:post_traffic:MAX:\"%5.1lf %sBit/s max\\n\" ".
66 "AREA:dropmbit#0080e0:\"drop \" ".
67 "GPRINT:drop_traffic:LAST:\"%5.1lf %sBit/s last\" ".
68 "GPRINT:drop_traffic:AVERAGE:\"%5.1lf %sBit/s avg\" ".
69 "GPRINT:drop_traffic:MAX:\"%5.1lf %sBit/s max\\n\" ";
72 if (isset($DS[3])) {
73 $def[1] .= "DEF:postbytes_avg=$RRDFILE[3]:$DS[1]:MAX ".
74 "DEF:dropbytes_avg=$RRDFILE[4]:$DS[2]:MAX ".
75 "CDEF:post_traffic_avg=postbytes_avg,8,* ".
76 "CDEF:drop_traffic_avg=dropbytes_avg,8,* ".
77 "CDEF:postmbit_avg=post_traffic_avg,1000000,/ ".
78 "CDEF:dropmbit_avg=drop_traffic_avg,1000000,/ ".
79 "LINE:postmbit_avg#3b762e:\"post avg \" ".
80 "GPRINT:post_traffic_avg:LAST:\"%5.1lf %sBit/s last\" ".
81 "GPRINT:post_traffic_avg:AVERAGE:\"%5.1lf %sBit/s avg\" ".
82 "GPRINT:post_traffic_avg:MAX:\"%5.1lf %sBit/s max\\n\" ".
83 "LINE:dropmbit_avg#1255a9:\"drop avg \" ".
84 "GPRINT:drop_traffic_avg:LAST:\"%5.1lf %sBit/s last\" ".
85 "GPRINT:drop_traffic_avg:AVERAGE:\"%5.1lf %sBit/s avg\" ".
86 "GPRINT:drop_traffic_avg:MAX:\"%5.1lf %sBit/s max\\n\" ";