Refactoring: Changed remaining check parameters starting with an 's' to the new rules...
[check_mk.git] / pnp-templates / check_mk-qlogic_fcport.php
blobc3419dff0481b0c62597ec6c6ff77a8b5e622e01
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.
27 # The number of data source various due to different
28 # settings (such as averaging). We rather work with names
29 # than with numbers.
30 $RRD = array();
31 foreach ($NAME as $i => $n) {
32 $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
33 $RRDAVG[$n] = "$RRDFILE[$i]:$DS[$i]:AVERAGE";
34 $WARN[$n] = $WARN[$i];
35 $CRIT[$n] = $CRIT[$i];
36 $MIN[$n] = $MIN[$i];
37 $MAX[$n] = $MAX[$i];
41 # 1. GRAPH: THROUGHPUT IN MB/s
43 $ds_name[1] = 'Traffic';
44 $opt[1] = "--vertical-label \"MByte/sec\" -X0 -b 1024 --title \"Traffic for $hostname / $servicedesc\" ";
46 $def[1] = ""
47 . "HRULE:0#c0c0c0 "
48 . "DEF:in=$RRD[in] "
49 . "DEF:out=$RRD[out] "
50 . "CDEF:inmb=in,1048576,/ "
51 . "CDEF:outmb=out,1048576,/ "
52 . "DEF:inavg=$RRDAVG[in] "
53 . "DEF:outavg=$RRDAVG[out] "
54 . "CDEF:inmbavg=inavg,1048576,/ "
55 . "CDEF:outmbavg=outavg,1048576,/ "
56 . "AREA:inmb#60a020:\"in \" "
57 . "GPRINT:inmb:LAST:\"%5.3lf MB/s last\" "
58 . "GPRINT:inmbavg:AVERAGE:\"%5.3lf MB/s avg\" "
59 . "GPRINT:inmb:MAX:\"%5.3lf MB/s max\\n\" "
60 . "CDEF:out_draw=outmb,-1,* "
61 . "AREA:out_draw#2060a0:\"out \" "
62 . "GPRINT:outmb:LAST:\"%5.3lf MB/s last\" "
63 . "GPRINT:outmbavg:AVERAGE:\"%5.3lf MB/s avg\" "
64 . "GPRINT:outmb:MAX:\"%5.3lf MB/s max\\n\" "
67 if (isset($RRD['in_avg'])) {
68 $def[1] .= ""
69 . "DEF:inaverage=$RRD[in_avg] "
70 . "DEF:outaverage=$RRD[out_avg] "
71 . "CDEF:inaveragemb=inaverage,1048576,/ "
72 . "CDEF:outaveragemb=outaverage,1048576,/ "
73 . "DEF:inaverage_avg=$RRDAVG[in_avg] "
74 . "DEF:outaverage_avg=$RRDAVG[out_avg] "
75 . "CDEF:inaveragemb_avg=inaverage_avg,1048576,/ "
76 . "CDEF:outaveragemb_avg=outaverage_avg,1048576,/ "
77 . "CDEF:outaveragemb_draw=outaverage,-1048576,/ "
78 . "LINE:inaveragemb_avg#a0d040:\"in (avg) \" "
79 . "GPRINT:inaveragemb:LAST:\"%5.3lf MB/s last\" "
80 . "GPRINT:inaveragemb_avg:AVERAGE:\"%5.3lf MB/s avg\" "
81 . "GPRINT:inaveragemb:MAX:\"%5.3lf MB/s max\\n\" "
82 . "LINE:outaveragemb_draw#40a0d0:\"out (avg)\" "
83 . "GPRINT:outaveragemb:LAST:\"%5.3lf MB/s last\" "
84 . "GPRINT:outaveragemb_avg:AVERAGE:\"%5.3lf MB/s avg\" "
85 . "GPRINT:outaveragemb:MAX:\"%5.3lf MB/s max\\n\" "
89 if ($WARN['in']) {
90 $def[1] .= "HRULE:$WARN[in]#ffff00:\"Warning (in)\" ";
91 $def[1] .= "HRULE:-$WARN[out]#ffff00:\"Warning (out)\" ";
93 if ($CRIT['in']) {
94 $def[1] .= "HRULE:$CRIT[in]#ff0000:\"Critical (in)\" ";
95 $def[1] .= "HRULE:-$CRIT[out]#ff0000:\"Critical (out)\" ";
97 if ($MAX['in']) {
98 $speedmb = $MAX['in'] / 1048576.0;
99 $speedtxt = sprintf("%.1f MB/s", $speedmb);
100 $def[1] .= "HRULE:$speedmb#ff80c0:\"Portspeed\: $speedtxt\" ";
101 $def[1] .= "HRULE:-$speedmb#ff80c0 ";
102 # $opt[1] .= " -u $speedmb -l -$speedmb";
105 # 2. GRAPH: FRAMES
106 $ds_name[2] = 'Frames';
107 $opt[2] = "--vertical-label \"Frames/sec\" -b 1024 --title \"Frames per second\" ";
108 $def[2] = ""
109 . "HRULE:0#c0c0c0 "
110 . "DEF:in=$RRD[rxframes] "
111 . "DEF:out=$RRD[txframes] "
112 . "DEF:inavg=$RRDAVG[rxframes] "
113 . "DEF:outavg=$RRDAVG[txframes] "
114 . "AREA:in#a0d040:\"in \" "
115 . "GPRINT:in:LAST:\"%5.1lf/s last\" "
116 . "GPRINT:inavg:AVERAGE:\"%5.1lf/s avg\" "
117 . "GPRINT:in:MAX:\"%5.1lf/s max\\n\" "
118 . "CDEF:out_draw=out,-1,* "
119 . "AREA:out_draw#40a0d0:\"out \" "
120 . "GPRINT:out:LAST:\"%5.1lf/s last\" "
121 . "GPRINT:outavg:AVERAGE:\"%5.1lf/s avg\" "
122 . "GPRINT:out:MAX:\"%5.1lf/s max\\n\" "
125 # 3. GRAPH: ERRORS
127 $ds_name[3] = 'Error counter';
128 $opt[3] = "--vertical-label \"Error counter\" --title \"Problems\" ";
129 $def[3] = ""
130 . "DEF:link_failures=$RRD[link_failures] "
131 . "DEF:sync_losses=$RRD[sync_losses] "
132 . "DEF:prim_seq_proto_errors=$RRD[prim_seq_proto_errors] "
133 . "DEF:invalid_tx_words=$RRD[invalid_tx_words] "
134 . "DEF:invalid_crcs=$RRD[invalid_crcs] "
135 . "DEF:address_id_errors=$RRD[address_id_errors] "
136 . "DEF:link_reset_ins=$RRD[link_reset_ins] "
137 . "DEF:link_reset_outs=$RRD[link_reset_outs] "
138 . "DEF:ols_ins=$RRD[ols_ins] "
139 . "DEF:ols_outs=$RRD[ols_outs] "
140 . "DEF:discards=$RRD[discards] "
141 . "DEF:c2_fbsy_frames=$RRD[c2_fbsy_frames] "
142 . "DEF:c2_frjt_frames=$RRD[c2_frjt_frames] "
143 . "LINE1:link_failures#c00000:\"Link Failures \" "
144 . "GPRINT:link_failures:LAST:\"last\: %4.0lf/s \\n\" "
145 . "LINE1:sync_losses#ff8000:\"Sync Losses \" "
146 . "GPRINT:sync_losses:LAST:\"last\: %4.0lf/s\\n\" "
147 . "LINE1:prim_seq_proto_errors#ff0080:\"PrimitSeqErrors \" "
148 . "GPRINT:prim_seq_proto_errors:LAST:\"last\: %4.0lf/s \\n\" "
149 . "LINE1:invalid_tx_words#ffa0a0:\"Invalid TX Words \" "
150 . "GPRINT:invalid_tx_words:LAST:\"last\: %4.0lf/s\\n\" "
151 . "LINE1:invalid_crcs#0080FF:\"Invalid CRCs \" "
152 . "GPRINT:invalid_crcs:LAST:\"last\: %4.0lf/s \\n\" "
153 . "LINE1:address_id_errors#8080FF:\"Address ID Errors \" "
154 . "GPRINT:address_id_errors:LAST:\"last\: %4.0lf/s\\n\" "
155 . "LINE1:link_reset_ins#0000A0:\"Link Resets In \" "
156 . "GPRINT:link_reset_ins:LAST:\"last\: %4.0lf/s \\n\" "
157 . "LINE1:link_reset_outs#400080:\"Link Resets Out \" "
158 . "GPRINT:link_reset_outs:LAST:\"last\: %4.0lf/s\\n\" "
159 . "LINE1:ols_ins#800000:\"Offline Sequences In \" "
160 . "GPRINT:ols_ins:LAST:\"last\: %4.0lf/s\\n\" "
161 . "LINE1:ols_outs#FF0000:\"Offline Sequences Out\" "
162 . "GPRINT:ols_outs:LAST:\"last\: %4.0lf/s \\n\" "
163 . "LINE1:discards#800080:\"Discards \" "
164 . "GPRINT:discards:LAST:\"last\: %4.0lf/s\\n\" "
165 . "LINE1:c2_fbsy_frames#0000FF:\"F_BSY frames \" "
166 . "GPRINT:c2_fbsy_frames:LAST:\"last\: %4.0lf/s \\n\" "
167 . "LINE1:c2_frjt_frames#408080:\"F_RJT frames \" "
168 . "GPRINT:c2_frjt_frames:LAST:\"last\: %4.0lf/s\\n\" "