-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_tc4400.php
92 lines (86 loc) · 3.36 KB
/
check_tc4400.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/*
*
* pnp4nagios template for check_tc4400.
*
* use RRD_STORAGE_TYPE = MULTIPLE.
*
* Author: Philippe Kueck <projects at unixadm dot org>
*
*/
$myds = array();
for ($i = 1; $i <= count($DS); $i++) {$myds[$NAME[$i]] = $i;}
// ==== upstream transmision level ====
$i = 0;
$ds_name[$i] = "us_tlvl";
$opt[$i] = " --vertical-label dBmV -E -b 1000 --title \"Upstream transmission level\" ";
$def[$i] = rrd::line(1, "32", "#ff0000", ":dashes=5");
$def[$i] .= rrd::line(1, "34", "#e0e000", ":dashes=5");
$def[$i] .= rrd::line(1, "54.1", "#e0e000", ":dashes=5");
$def[$i] .= rrd::line(1, "56.1", "#ff0000", ":dashes=5");
for ($c = 1;; $c++) {
$v = sprintf("up%02d_tlvl", $c);
if (!isset($myds[$v])) break;
$def[$i] .= rrd::def($v, $RRDFILE[$myds[$v]], $DS[$myds[$v]], "AVERAGE");
$def[$i] .= rrd::line1($v, rrd::color($c), rrd::cut("channel $c", 24));
$def[$i] .= rrd::gprint($v, array("LAST", "AVERAGE", "MIN", "MAX"), "%3.1lf dBmV");
}
// ==== downstream SNR ====
$i++;
$ds_name[$i] = "ds_snr";
$opt[$i] = " --vertical-label dB -E -b 1000 --title \"Downstream SNR\" ";
// limits for QAM256
$def[$i] = rrd::hrule("32", "#e0e000", ":dashes=5");
$def[$i] .= rrd::hrule("30", "#ff0000", ":dashes=5");
for ($c = 1;; $c++) {
$v = sprintf("dn%02d_snr", $c);
if (!isset($myds[$v])) break;
$def[$i] .= rrd::def($v, $RRDFILE[$myds[$v]], $DS[$myds[$v]], "AVERAGE");
$def[$i] .= rrd::line1($v, rrd::color($c), rrd::cut("channel $c", 24));
$def[$i] .= rrd::gprint($v, array("LAST", "AVERAGE", "MIN"), "%3.1lf dB");
}
// ==== downstream receive level ====
$i++;
$ds_name[$i] = "ds_rlvl";
$opt[$i] = " --vertical-label dBmV -E -b 1000 --title \"Downstream receive level\" ";
$def[$i] = rrd::line(1, "-8", "#ff0000", ":dashes=5");
$def[$i] .= rrd::line(1, "-6", "#e0e000", ":dashes=5");
$def[$i] .= rrd::line(1, "18.1", "#e0e000", ":dashes=5");
$def[$i] .= rrd::line(1, "20.1", "#ff0000", ":dashes=5");
for ($c = 1;; $c++) {
$v = sprintf("dn%02d_rlvl", $c);
if (!isset($myds[$v])) break;
$def[$i] .= rrd::def($v, $RRDFILE[$myds[$v]], $DS[$myds[$v]], "AVERAGE");
$def[$i] .= rrd::line1($v, rrd::color($c), rrd::cut("channel $c", 24));
$def[$i] .= rrd::gprint($v, array("LAST", "AVERAGE", "MIN", "MAX"), "%3.1lf dBmV");
}
// ==== downstream modulation ====
$i++;
$ds_name[$i] = "ds_modbits";
$opt[$i] = " --vertical-label bits -l 1 -u 8 --title \"Downstream modulation\" ";
$def[$i] = "";
for ($c = 1;; $c++) {
$v = sprintf("dn%02d_bits", $c);
if (!isset($myds[$v])) break;
$def[$i] .= rrd::def($v, $RRDFILE[$myds[$v]], $DS[$myds[$v]], "AVERAGE");
$def[$i] .= rrd::line1($v, rrd::color($c), rrd::cut("channel $c", 24));
$def[$i] .= rrd::gprint($v, array("LAST", "AVERAGE", "MIN", "MAX"), "%1.0lf bits");
}
// ==== downstream codewords ====
foreach (array(
'cwpass' => 'unerrored',
'cwcorr' => 'corrected',
'cwfail' => 'uncorrectable'
) as $id => $title) {
$i++;
$ds_name[$i] = "ds_$id";
$opt[$i] = " -E -b 1000 --title \"Downstream $title codewords\" ";
$def[$i] = "";
for ($c = 1;; $c++) {
$v = sprintf("dn%02d_%s", $c, $id);
if (!isset($myds[$v])) break;
$def[$i] .= rrd::def($v, $RRDFILE[$myds[$v]], $DS[$myds[$v]], "AVERAGE");
$def[$i] .= rrd::area($v, rrd::color($c), rrd::cut("channel $c", 24), "STACK");
$def[$i] .= rrd::gprint($v, array("LAST", "AVERAGE", "MAX"), "%7.0lf");
}
}