Browse code

reorg_20202027

Gandolf authored on 10/27/2020 20:25:34
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,205 +0,0 @@
1
-<html>
2
-<!-- Courtsey ruler
3
-12345678901234567890123456789012345678901234567890123456789012345678901234567890
4
-<head>
5
-<style>
6
-p {
7
-    font: 14px ariel, sans serif;
8
-}
9
-#errorMsg {
10
-    font:bold 18px arial,sans-serif;
11
-    color:red;
12
-    text-align:center;
13
-}
14
-.chartContainer {
15
-    padding: 2px;
16
-}
17
-img.chart {
18
-    width:100%;
19
-}
20
-</style>
21
-</head>
22
-<body>
23
-
24
-<?php
25
-/*
26
- Script: arednsig.php
27
-
28
- Description: This scripts generates on the server charts showing
29
- signal data spanning the period supplied by the user.  The script
30
- does the following:
31
-    - converts user supplied dates to  epoch time
32
-    - gets the times of the first and last data point in the round
33
-      robin database (RRD)
34
-    - from above validates user supplied begin and end dates
35
-    - creates charts of the specified period
36
-
37
- Copyright 2020 Jeff Owrey
38
-    This program is free software: you can redistribute it and/or modify
39
-    it under the terms of the GNU General Public License as published by
40
-    the Free Software Foundation, either version 3 of the License, or
41
-    (at your option) any later version.
42
-
43
-    This program is distributed in the hope that it will be useful,
44
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
45
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
-    GNU General Public License for more details.
47
-
48
-    You should have received a copy of the GNU General Public License
49
-    along with this program.  If not, see http://www.gnu.org/license.
50
-
51
- Revision History
52
-   * v20 released 18 Jan 2020 by J L Owrey; first release
53
-*/
54
-
55
-# Define global constants
56
-
57
-# round robin database file
58
-define("_RRD_FILE", str_replace("public_html/arednsig/arednsig.php",
59
-                                "database/arednsigData.rrd",
60
-                                $_SERVER["SCRIPT_FILENAME"]));
61
-# charts html directory
62
-define("_CHART_DIRECTORY", str_replace("arednsig.php",
63
-                                       "dynamic/",
64
-                                       $_SERVER["SCRIPT_FILENAME"]));
65
-# standard chart width in pixels
66
-define("_CHART_WIDTH", 600);
67
-# standard chart height in pixels
68
-define("_CHART_HEIGHT", 150);
69
-# debug mode
70
-define("_DEBUG", false);
71
-
72
-# Set error handling modes.
73
-error_reporting(E_ALL);
74
-
75
-# Get user supplied chart begin and end dates.
76
-$beginDate = $_POST["beginDate"];
77
-$endDate =  $_POST["endDate"];
78
-
79
-# Convert the user supplied dates to epoch time stamps.
80
-$beginDateEp = strtotime($beginDate);
81
-$endDateEp = strtotime($endDate);
82
-
83
-# Get the time stamp of the earliest data point in the RRD file.
84
-$cmd = sprintf("rrdtool first %s --rraindex 1", _RRD_FILE);
85
-$firstDP = shell_exec($cmd);
86
-
87
-# Get the time stamp of the latest data point in the RRD file.
88
-$cmd = sprintf("rrdtool last %s", _RRD_FILE);
89
-$lastDP = shell_exec($cmd);
90
-
91
-# Determine validity of user supplied dates.  User supplied begin
92
-# date must be less than user supplied end date.  Furthermore both
93
-# dates must be within the range of dates stored in the RRD.
94
-if ($beginDateEp > $endDateEp) {
95
-    echo "<p id=\"errorMsg\">" .
96
-         "End date must be after begin date.</p>";
97
-} elseif ($beginDateEp < $firstDP || $endDateEp > $lastDP) {
98
-    echo "<p id=\"errorMsg\">" .
99
-          "Date range must be between " .
100
-          date('m / d / Y', $firstDP) . " and " . 
101
-          date('m / d / Y', $lastDP) . ".</p>";
102
-} else {
103
-    # Generate charts from validated user supplied dates.
104
-    if (_DEBUG) {
105
-        echo "<p>Date range: " . $beginDateEp . " thru " .
106
-              $endDateEp . "</p>";
107
-    }
108
-    createChart('custom_signal', 'S', 'dBm', 
109
-                'RSSI', $beginDateEp, $endDateEp,
110
-                 0, 0, 2, false);
111
-    createChart('custom_snr', 'SNR', 'dBm', 
112
-                'S/N', $beginDateEp, $endDateEp,
113
-                 0, 0, 2, false);
114
-    # Send html commands to client browser.
115
-    echo "<div class=\"chartContainer\">" .
116
-         "<img class=\"chart\" src=\"dynamic/custom_signal.png\">" .
117
-         "</div>";
118
-    echo "<div class=\"chartContainer\">" .
119
-         "<img class=\"chart\" src=\"dynamic/custom_snr.png\">" .
120
-         "</div>";
121
-}
122
-
123
-function createChart($chartFile, $dataItem, $label, $title, $begin,
124
-                     $end, $lower, $upper, $addTrend, $autoScale) {
125
-    /*
126
-    Uses rrdtool to create a chart of specified aredn node data item.
127
-    Parameters:
128
-       fileName - name of the created chart file
129
-       dataItem - data item to be charted
130
-       label - string containing a label for the item to be charted
131
-       title - string containing a title for the chart
132
-       begin - beginning time of the chart data
133
-       end   - ending time of the data to be charted
134
-       lower - lower bound for chart ordinate #NOT USED
135
-       upper - upper bound for chart ordinate #NOT USED
136
-       addTrend - 0, show only chart data
137
-                  1, show only a trend line
138
-                  2, show a trend line and the chart data
139
-       autoScale - if True, then use vertical axis auto scaling
140
-           (lower and upper parameters are ignored), otherwise use
141
-           lower and upper parameters to set vertical axis scale
142
-    Returns: True if successful, False otherwise
143
-    */
144
-
145
-    # Define path on server to chart files.
146
-    $chartPath = _CHART_DIRECTORY . $chartFile . ".png";
147
-
148
-    # Format the rrdtool chart command.
149
-
150
-    # Set chart file name, start time, end time, height, and width.
151
-    $cmdfmt = "rrdtool graph %s -a PNG -s %s -e %s -w %s -h %s ";
152
-    $cmd = sprintf($cmdfmt, $chartPath, $begin, $end, _CHART_WIDTH,
153
-                   _CHART_HEIGHT);
154
-    $cmdfmt = "-l %s -u %s -r ";
155
-
156
-    # Set upper and lower ordinate bounds.
157
-    if ($lower < $upper) {
158
-        $cmd .= sprintf($cmdfmt, $lower, $upper);
159
-    } elseif ($autoScale) {
160
-        $cmd .= "-A ";
161
-    }
162
-    $cmd .= "-Y ";
163
-
164
-    # Set the chart ordinate label and chart title. 
165
-    $cmdfmt = "-v %s -t %s ";
166
-    $cmd .= sprintf($cmdfmt, $label, $title);
167
-   
168
-    # Define moving average window width.
169
-    $trendWindow = floor(($end - $begin) / 12);
170
-        
171
-    # Show the data, or a moving average trend line over
172
-    # the data, or both.
173
-    $cmdfmt = "DEF:dSeries=%s:%s:LAST ";
174
-    $cmd .= sprintf($cmdfmt, _RRD_FILE, $dataItem);
175
-    if ($addTrend == 0) {
176
-        $cmd .= "LINE1:dSeries#0400ff ";
177
-    } elseif ($addTrend == 1) {
178
-        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
179
-        $cmd .= sprintf($cmdfmt, $trendWindow);
180
-    } elseif ($addTrend == 2) {
181
-        $cmd .= "LINE1:dSeries#0400ff ";
182
-        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
183
-        #$cmdfmt = "CDEF:smoothed=dSeries,%s,XYZZY LINE3:smoothed#ff0000 ";
184
-        $cmd .=  sprintf($cmdfmt, $trendWindow);
185
-    }
186
-     
187
-    # Execute the formatted rrdtool command in the shell. The rrdtool
188
-    # command will complete execution before the html image tags get
189
-    # sent to the browser.  This assures that the charts are available
190
-    # when the client browser executes the html code that loads the
191
-    # charts into the document displayed by the client browser.
192
-    if (_DEBUG) {
193
-        echo "<p>chart command:<br>" . $cmd . "</p>";
194
-    }
195
-    $result = shell_exec($cmd . " 2>&1");
196
-    if (_DEBUG) {
197
-        echo "<p>result:<br>" . $result . "</p>";
198
-    }
199
-}
200
-
201
-?>
202
-
203
-</body>
204
-</html>
Browse code

add version for FW v3.20

Gandolf authored on 10/03/2020 23:02:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,205 @@
1
+<html>
2
+<!-- Courtsey ruler
3
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
4
+-->
5
+<head>
6
+<style>
7
+p {
8
+    font: 14px ariel, sans serif;
9
+}
10
+#errorMsg {
11
+    font:bold 18px arial,sans-serif;
12
+    color:red;
13
+    text-align:center;
14
+}
15
+.chartContainer {
16
+    padding: 2px;
17
+}
18
+img.chart {
19
+    width:100%;
20
+}
21
+</style>
22
+</head>
23
+<body>
24
+
25
+<?php
26
+/*
27
+ Script: arednsig.php
28
+
29
+ Description: This scripts generates on the server charts showing
30
+ signal data spanning the period supplied by the user.  The script
31
+ does the following:
32
+    - converts user supplied dates to  epoch time
33
+    - gets the times of the first and last data point in the round
34
+      robin database (RRD)
35
+    - from above validates user supplied begin and end dates
36
+    - creates charts of the specified period
37
+
38
+ Copyright 2020 Jeff Owrey
39
+    This program is free software: you can redistribute it and/or modify
40
+    it under the terms of the GNU General Public License as published by
41
+    the Free Software Foundation, either version 3 of the License, or
42
+    (at your option) any later version.
43
+
44
+    This program is distributed in the hope that it will be useful,
45
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
46
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
47
+    GNU General Public License for more details.
48
+
49
+    You should have received a copy of the GNU General Public License
50
+    along with this program.  If not, see http://www.gnu.org/license.
51
+
52
+ Revision History
53
+   * v20 released 18 Jan 2020 by J L Owrey; first release
54
+*/
55
+
56
+# Define global constants
57
+
58
+# round robin database file
59
+define("_RRD_FILE", str_replace("public_html/arednsig/arednsig.php",
60
+                                "database/arednsigData.rrd",
61
+                                $_SERVER["SCRIPT_FILENAME"]));
62
+# charts html directory
63
+define("_CHART_DIRECTORY", str_replace("arednsig.php",
64
+                                       "dynamic/",
65
+                                       $_SERVER["SCRIPT_FILENAME"]));
66
+# standard chart width in pixels
67
+define("_CHART_WIDTH", 600);
68
+# standard chart height in pixels
69
+define("_CHART_HEIGHT", 150);
70
+# debug mode
71
+define("_DEBUG", false);
72
+
73
+# Set error handling modes.
74
+error_reporting(E_ALL);
75
+
76
+# Get user supplied chart begin and end dates.
77
+$beginDate = $_POST["beginDate"];
78
+$endDate =  $_POST["endDate"];
79
+
80
+# Convert the user supplied dates to epoch time stamps.
81
+$beginDateEp = strtotime($beginDate);
82
+$endDateEp = strtotime($endDate);
83
+
84
+# Get the time stamp of the earliest data point in the RRD file.
85
+$cmd = sprintf("rrdtool first %s --rraindex 1", _RRD_FILE);
86
+$firstDP = shell_exec($cmd);
87
+
88
+# Get the time stamp of the latest data point in the RRD file.
89
+$cmd = sprintf("rrdtool last %s", _RRD_FILE);
90
+$lastDP = shell_exec($cmd);
91
+
92
+# Determine validity of user supplied dates.  User supplied begin
93
+# date must be less than user supplied end date.  Furthermore both
94
+# dates must be within the range of dates stored in the RRD.
95
+if ($beginDateEp > $endDateEp) {
96
+    echo "<p id=\"errorMsg\">" .
97
+         "End date must be after begin date.</p>";
98
+} elseif ($beginDateEp < $firstDP || $endDateEp > $lastDP) {
99
+    echo "<p id=\"errorMsg\">" .
100
+          "Date range must be between " .
101
+          date('m / d / Y', $firstDP) . " and " . 
102
+          date('m / d / Y', $lastDP) . ".</p>";
103
+} else {
104
+    # Generate charts from validated user supplied dates.
105
+    if (_DEBUG) {
106
+        echo "<p>Date range: " . $beginDateEp . " thru " .
107
+              $endDateEp . "</p>";
108
+    }
109
+    createChart('custom_signal', 'S', 'dBm', 
110
+                'RSSI', $beginDateEp, $endDateEp,
111
+                 0, 0, 2, false);
112
+    createChart('custom_snr', 'SNR', 'dBm', 
113
+                'S/N', $beginDateEp, $endDateEp,
114
+                 0, 0, 2, false);
115
+    # Send html commands to client browser.
116
+    echo "<div class=\"chartContainer\">" .
117
+         "<img class=\"chart\" src=\"dynamic/custom_signal.png\">" .
118
+         "</div>";
119
+    echo "<div class=\"chartContainer\">" .
120
+         "<img class=\"chart\" src=\"dynamic/custom_snr.png\">" .
121
+         "</div>";
122
+}
123
+
124
+function createChart($chartFile, $dataItem, $label, $title, $begin,
125
+                     $end, $lower, $upper, $addTrend, $autoScale) {
126
+    /*
127
+    Uses rrdtool to create a chart of specified aredn node data item.
128
+    Parameters:
129
+       fileName - name of the created chart file
130
+       dataItem - data item to be charted
131
+       label - string containing a label for the item to be charted
132
+       title - string containing a title for the chart
133
+       begin - beginning time of the chart data
134
+       end   - ending time of the data to be charted
135
+       lower - lower bound for chart ordinate #NOT USED
136
+       upper - upper bound for chart ordinate #NOT USED
137
+       addTrend - 0, show only chart data
138
+                  1, show only a trend line
139
+                  2, show a trend line and the chart data
140
+       autoScale - if True, then use vertical axis auto scaling
141
+           (lower and upper parameters are ignored), otherwise use
142
+           lower and upper parameters to set vertical axis scale
143
+    Returns: True if successful, False otherwise
144
+    */
145
+
146
+    # Define path on server to chart files.
147
+    $chartPath = _CHART_DIRECTORY . $chartFile . ".png";
148
+
149
+    # Format the rrdtool chart command.
150
+
151
+    # Set chart file name, start time, end time, height, and width.
152
+    $cmdfmt = "rrdtool graph %s -a PNG -s %s -e %s -w %s -h %s ";
153
+    $cmd = sprintf($cmdfmt, $chartPath, $begin, $end, _CHART_WIDTH,
154
+                   _CHART_HEIGHT);
155
+    $cmdfmt = "-l %s -u %s -r ";
156
+
157
+    # Set upper and lower ordinate bounds.
158
+    if ($lower < $upper) {
159
+        $cmd .= sprintf($cmdfmt, $lower, $upper);
160
+    } elseif ($autoScale) {
161
+        $cmd .= "-A ";
162
+    }
163
+    $cmd .= "-Y ";
164
+
165
+    # Set the chart ordinate label and chart title. 
166
+    $cmdfmt = "-v %s -t %s ";
167
+    $cmd .= sprintf($cmdfmt, $label, $title);
168
+   
169
+    # Define moving average window width.
170
+    $trendWindow = floor(($end - $begin) / 12);
171
+        
172
+    # Show the data, or a moving average trend line over
173
+    # the data, or both.
174
+    $cmdfmt = "DEF:dSeries=%s:%s:LAST ";
175
+    $cmd .= sprintf($cmdfmt, _RRD_FILE, $dataItem);
176
+    if ($addTrend == 0) {
177
+        $cmd .= "LINE1:dSeries#0400ff ";
178
+    } elseif ($addTrend == 1) {
179
+        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
180
+        $cmd .= sprintf($cmdfmt, $trendWindow);
181
+    } elseif ($addTrend == 2) {
182
+        $cmd .= "LINE1:dSeries#0400ff ";
183
+        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
184
+        #$cmdfmt = "CDEF:smoothed=dSeries,%s,XYZZY LINE3:smoothed#ff0000 ";
185
+        $cmd .=  sprintf($cmdfmt, $trendWindow);
186
+    }
187
+     
188
+    # Execute the formatted rrdtool command in the shell. The rrdtool
189
+    # command will complete execution before the html image tags get
190
+    # sent to the browser.  This assures that the charts are available
191
+    # when the client browser executes the html code that loads the
192
+    # charts into the document displayed by the client browser.
193
+    if (_DEBUG) {
194
+        echo "<p>chart command:<br>" . $cmd . "</p>";
195
+    }
196
+    $result = shell_exec($cmd . " 2>&1");
197
+    if (_DEBUG) {
198
+        echo "<p>result:<br>" . $result . "</p>";
199
+    }
200
+}
201
+
202
+?>
203
+
204
+</body>
205
+</html>
Browse code

remove old versions

Gandolf authored on 10/03/2020 23:00:21
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,205 +0,0 @@
1
-<html>
2
-<!-- Courtsey ruler
3
-12345678901234567890123456789012345678901234567890123456789012345678901234567890
4
-<head>
5
-<style>
6
-p {
7
-    font: 14px ariel, sans serif;
8
-}
9
-#errorMsg {
10
-    font:bold 18px arial,sans-serif;
11
-    color:red;
12
-    text-align:center;
13
-}
14
-.chartContainer {
15
-    padding: 2px;
16
-}
17
-img.chart {
18
-    width:100%;
19
-}
20
-</style>
21
-</head>
22
-<body>
23
-
24
-<?php
25
-/*
26
- Script: arednsig.php
27
-
28
- Description: This scripts generates on the server charts showing
29
- signal data spanning the period supplied by the user.  The script
30
- does the following:
31
-    - converts user supplied dates to  epoch time
32
-    - gets the times of the first and last data point in the round
33
-      robin database (RRD)
34
-    - from above validates user supplied begin and end dates
35
-    - creates charts of the specified period
36
-
37
- Copyright 2020 Jeff Owrey
38
-    This program is free software: you can redistribute it and/or modify
39
-    it under the terms of the GNU General Public License as published by
40
-    the Free Software Foundation, either version 3 of the License, or
41
-    (at your option) any later version.
42
-
43
-    This program is distributed in the hope that it will be useful,
44
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
45
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
-    GNU General Public License for more details.
47
-
48
-    You should have received a copy of the GNU General Public License
49
-    along with this program.  If not, see http://www.gnu.org/license.
50
-
51
- Revision History
52
-   * v20 released 18 Jan 2020 by J L Owrey; first release
53
-*/
54
-
55
-# Define global constants
56
-
57
-# round robin database file
58
-define("_RRD_FILE", str_replace("public_html/arednsig/arednsig.php",
59
-                                "database/arednsigData.rrd",
60
-                                $_SERVER["SCRIPT_FILENAME"]));
61
-# charts html directory
62
-define("_CHART_DIRECTORY", str_replace("arednsig.php",
63
-                                       "dynamic/",
64
-                                       $_SERVER["SCRIPT_FILENAME"]));
65
-# standard chart width in pixels
66
-define("_CHART_WIDTH", 600);
67
-# standard chart height in pixels
68
-define("_CHART_HEIGHT", 150);
69
-# debug mode
70
-define("_DEBUG", false);
71
-
72
-# Set error handling modes.
73
-error_reporting(E_ALL);
74
-
75
-# Get user supplied chart begin and end dates.
76
-$beginDate = $_POST["beginDate"];
77
-$endDate =  $_POST["endDate"];
78
-
79
-# Convert the user supplied dates to epoch time stamps.
80
-$beginDateEp = strtotime($beginDate);
81
-$endDateEp = strtotime($endDate);
82
-
83
-# Get the time stamp of the earliest data point in the RRD file.
84
-$cmd = sprintf("rrdtool first %s --rraindex 1", _RRD_FILE);
85
-$firstDP = shell_exec($cmd);
86
-
87
-# Get the time stamp of the latest data point in the RRD file.
88
-$cmd = sprintf("rrdtool last %s", _RRD_FILE);
89
-$lastDP = shell_exec($cmd);
90
-
91
-# Determine validity of user supplied dates.  User supplied begin
92
-# date must be less than user supplied end date.  Furthermore both
93
-# dates must be within the range of dates stored in the RRD.
94
-if ($beginDateEp > $endDateEp) {
95
-    echo "<p id=\"errorMsg\">" .
96
-         "End date must be after begin date.</p>";
97
-} elseif ($beginDateEp < $firstDP || $endDateEp > $lastDP) {
98
-    echo "<p id=\"errorMsg\">" .
99
-          "Date range must be between " .
100
-          date('m / d / Y', $firstDP) . " and " . 
101
-          date('m / d / Y', $lastDP) . ".</p>";
102
-} else {
103
-    # Generate charts from validated user supplied dates.
104
-    if (_DEBUG) {
105
-        echo "<p>Date range: " . $beginDateEp . " thru " .
106
-              $endDateEp . "</p>";
107
-    }
108
-    createChart('custom_signal', 'S', 'dBm', 
109
-                'RSSI', $beginDateEp, $endDateEp,
110
-                 0, 0, 2, false);
111
-    createChart('custom_snr', 'SNR', 'dBm', 
112
-                'S/N', $beginDateEp, $endDateEp,
113
-                 0, 0, 2, false);
114
-    # Send html commands to client browser.
115
-    echo "<div class=\"chartContainer\">" .
116
-         "<img class=\"chart\" src=\"dynamic/custom_signal.png\">" .
117
-         "</div>";
118
-    echo "<div class=\"chartContainer\">" .
119
-         "<img class=\"chart\" src=\"dynamic/custom_snr.png\">" .
120
-         "</div>";
121
-}
122
-
123
-function createChart($chartFile, $dataItem, $label, $title, $begin,
124
-                     $end, $lower, $upper, $addTrend, $autoScale) {
125
-    /*
126
-    Uses rrdtool to create a chart of specified aredn node data item.
127
-    Parameters:
128
-       fileName - name of the created chart file
129
-       dataItem - data item to be charted
130
-       label - string containing a label for the item to be charted
131
-       title - string containing a title for the chart
132
-       begin - beginning time of the chart data
133
-       end   - ending time of the data to be charted
134
-       lower - lower bound for chart ordinate #NOT USED
135
-       upper - upper bound for chart ordinate #NOT USED
136
-       addTrend - 0, show only chart data
137
-                  1, show only a trend line
138
-                  2, show a trend line and the chart data
139
-       autoScale - if True, then use vertical axis auto scaling
140
-           (lower and upper parameters are ignored), otherwise use
141
-           lower and upper parameters to set vertical axis scale
142
-    Returns: True if successful, False otherwise
143
-    */
144
-
145
-    # Define path on server to chart files.
146
-    $chartPath = _CHART_DIRECTORY . $chartFile . ".png";
147
-
148
-    # Format the rrdtool chart command.
149
-
150
-    # Set chart file name, start time, end time, height, and width.
151
-    $cmdfmt = "rrdtool graph %s -a PNG -s %s -e %s -w %s -h %s ";
152
-    $cmd = sprintf($cmdfmt, $chartPath, $begin, $end, _CHART_WIDTH,
153
-                   _CHART_HEIGHT);
154
-    $cmdfmt = "-l %s -u %s -r ";
155
-
156
-    # Set upper and lower ordinate bounds.
157
-    if ($lower < $upper) {
158
-        $cmd .= sprintf($cmdfmt, $lower, $upper);
159
-    } elseif ($autoScale) {
160
-        $cmd .= "-A ";
161
-    }
162
-    $cmd .= "-Y ";
163
-
164
-    # Set the chart ordinate label and chart title. 
165
-    $cmdfmt = "-v %s -t %s ";
166
-    $cmd .= sprintf($cmdfmt, $label, $title);
167
-   
168
-    # Define moving average window width.
169
-    $trendWindow = floor(($end - $begin) / 12);
170
-        
171
-    # Show the data, or a moving average trend line over
172
-    # the data, or both.
173
-    $cmdfmt = "DEF:dSeries=%s:%s:LAST ";
174
-    $cmd .= sprintf($cmdfmt, _RRD_FILE, $dataItem);
175
-    if ($addTrend == 0) {
176
-        $cmd .= "LINE1:dSeries#0400ff ";
177
-    } elseif ($addTrend == 1) {
178
-        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
179
-        $cmd .= sprintf($cmdfmt, $trendWindow);
180
-    } elseif ($addTrend == 2) {
181
-        $cmd .= "LINE1:dSeries#0400ff ";
182
-        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
183
-        #$cmdfmt = "CDEF:smoothed=dSeries,%s,XYZZY LINE3:smoothed#ff0000 ";
184
-        $cmd .=  sprintf($cmdfmt, $trendWindow);
185
-    }
186
-     
187
-    # Execute the formatted rrdtool command in the shell. The rrdtool
188
-    # command will complete execution before the html image tags get
189
-    # sent to the browser.  This assures that the charts are available
190
-    # when the client browser executes the html code that loads the
191
-    # charts into the document displayed by the client browser.
192
-    if (_DEBUG) {
193
-        echo "<p>chart command:<br>" . $cmd . "</p>";
194
-    }
195
-    $result = shell_exec($cmd . " 2>&1");
196
-    if (_DEBUG) {
197
-        echo "<p>result:<br>" . $result . "</p>";
198
-    }
199
-}
200
-
201
-?>
202
-
203
-</body>
204
-</html>
Browse code

support for Aredn firmware version 3.20.3.0

gandolf authored on 03/31/2020 18:07:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,205 @@
1
+<html>
2
+<!-- Courtsey ruler
3
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
4
+-->
5
+<head>
6
+<style>
7
+p {
8
+    font: 14px ariel, sans serif;
9
+}
10
+#errorMsg {
11
+    font:bold 18px arial,sans-serif;
12
+    color:red;
13
+    text-align:center;
14
+}
15
+.chartContainer {
16
+    padding: 2px;
17
+}
18
+img.chart {
19
+    width:100%;
20
+}
21
+</style>
22
+</head>
23
+<body>
24
+
25
+<?php
26
+/*
27
+ Script: arednsig.php
28
+
29
+ Description: This scripts generates on the server charts showing
30
+ signal data spanning the period supplied by the user.  The script
31
+ does the following:
32
+    - converts user supplied dates to  epoch time
33
+    - gets the times of the first and last data point in the round
34
+      robin database (RRD)
35
+    - from above validates user supplied begin and end dates
36
+    - creates charts of the specified period
37
+
38
+ Copyright 2020 Jeff Owrey
39
+    This program is free software: you can redistribute it and/or modify
40
+    it under the terms of the GNU General Public License as published by
41
+    the Free Software Foundation, either version 3 of the License, or
42
+    (at your option) any later version.
43
+
44
+    This program is distributed in the hope that it will be useful,
45
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
46
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
47
+    GNU General Public License for more details.
48
+
49
+    You should have received a copy of the GNU General Public License
50
+    along with this program.  If not, see http://www.gnu.org/license.
51
+
52
+ Revision History
53
+   * v20 released 18 Jan 2020 by J L Owrey; first release
54
+*/
55
+
56
+# Define global constants
57
+
58
+# round robin database file
59
+define("_RRD_FILE", str_replace("public_html/arednsig/arednsig.php",
60
+                                "database/arednsigData.rrd",
61
+                                $_SERVER["SCRIPT_FILENAME"]));
62
+# charts html directory
63
+define("_CHART_DIRECTORY", str_replace("arednsig.php",
64
+                                       "dynamic/",
65
+                                       $_SERVER["SCRIPT_FILENAME"]));
66
+# standard chart width in pixels
67
+define("_CHART_WIDTH", 600);
68
+# standard chart height in pixels
69
+define("_CHART_HEIGHT", 150);
70
+# debug mode
71
+define("_DEBUG", false);
72
+
73
+# Set error handling modes.
74
+error_reporting(E_ALL);
75
+
76
+# Get user supplied chart begin and end dates.
77
+$beginDate = $_POST["beginDate"];
78
+$endDate =  $_POST["endDate"];
79
+
80
+# Convert the user supplied dates to epoch time stamps.
81
+$beginDateEp = strtotime($beginDate);
82
+$endDateEp = strtotime($endDate);
83
+
84
+# Get the time stamp of the earliest data point in the RRD file.
85
+$cmd = sprintf("rrdtool first %s --rraindex 1", _RRD_FILE);
86
+$firstDP = shell_exec($cmd);
87
+
88
+# Get the time stamp of the latest data point in the RRD file.
89
+$cmd = sprintf("rrdtool last %s", _RRD_FILE);
90
+$lastDP = shell_exec($cmd);
91
+
92
+# Determine validity of user supplied dates.  User supplied begin
93
+# date must be less than user supplied end date.  Furthermore both
94
+# dates must be within the range of dates stored in the RRD.
95
+if ($beginDateEp > $endDateEp) {
96
+    echo "<p id=\"errorMsg\">" .
97
+         "End date must be after begin date.</p>";
98
+} elseif ($beginDateEp < $firstDP || $endDateEp > $lastDP) {
99
+    echo "<p id=\"errorMsg\">" .
100
+          "Date range must be between " .
101
+          date('m / d / Y', $firstDP) . " and " . 
102
+          date('m / d / Y', $lastDP) . ".</p>";
103
+} else {
104
+    # Generate charts from validated user supplied dates.
105
+    if (_DEBUG) {
106
+        echo "<p>Date range: " . $beginDateEp . " thru " .
107
+              $endDateEp . "</p>";
108
+    }
109
+    createChart('custom_signal', 'S', 'dBm', 
110
+                'RSSI', $beginDateEp, $endDateEp,
111
+                 0, 0, 2, false);
112
+    createChart('custom_snr', 'SNR', 'dBm', 
113
+                'S/N', $beginDateEp, $endDateEp,
114
+                 0, 0, 2, false);
115
+    # Send html commands to client browser.
116
+    echo "<div class=\"chartContainer\">" .
117
+         "<img class=\"chart\" src=\"dynamic/custom_signal.png\">" .
118
+         "</div>";
119
+    echo "<div class=\"chartContainer\">" .
120
+         "<img class=\"chart\" src=\"dynamic/custom_snr.png\">" .
121
+         "</div>";
122
+}
123
+
124
+function createChart($chartFile, $dataItem, $label, $title, $begin,
125
+                     $end, $lower, $upper, $addTrend, $autoScale) {
126
+    /*
127
+    Uses rrdtool to create a chart of specified aredn node data item.
128
+    Parameters:
129
+       fileName - name of the created chart file
130
+       dataItem - data item to be charted
131
+       label - string containing a label for the item to be charted
132
+       title - string containing a title for the chart
133
+       begin - beginning time of the chart data
134
+       end   - ending time of the data to be charted
135
+       lower - lower bound for chart ordinate #NOT USED
136
+       upper - upper bound for chart ordinate #NOT USED
137
+       addTrend - 0, show only chart data
138
+                  1, show only a trend line
139
+                  2, show a trend line and the chart data
140
+       autoScale - if True, then use vertical axis auto scaling
141
+           (lower and upper parameters are ignored), otherwise use
142
+           lower and upper parameters to set vertical axis scale
143
+    Returns: True if successful, False otherwise
144
+    */
145
+
146
+    # Define path on server to chart files.
147
+    $chartPath = _CHART_DIRECTORY . $chartFile . ".png";
148
+
149
+    # Format the rrdtool chart command.
150
+
151
+    # Set chart file name, start time, end time, height, and width.
152
+    $cmdfmt = "rrdtool graph %s -a PNG -s %s -e %s -w %s -h %s ";
153
+    $cmd = sprintf($cmdfmt, $chartPath, $begin, $end, _CHART_WIDTH,
154
+                   _CHART_HEIGHT);
155
+    $cmdfmt = "-l %s -u %s -r ";
156
+
157
+    # Set upper and lower ordinate bounds.
158
+    if ($lower < $upper) {
159
+        $cmd .= sprintf($cmdfmt, $lower, $upper);
160
+    } elseif ($autoScale) {
161
+        $cmd .= "-A ";
162
+    }
163
+    $cmd .= "-Y ";
164
+
165
+    # Set the chart ordinate label and chart title. 
166
+    $cmdfmt = "-v %s -t %s ";
167
+    $cmd .= sprintf($cmdfmt, $label, $title);
168
+   
169
+    # Define moving average window width.
170
+    $trendWindow = floor(($end - $begin) / 12);
171
+        
172
+    # Show the data, or a moving average trend line over
173
+    # the data, or both.
174
+    $cmdfmt = "DEF:dSeries=%s:%s:LAST ";
175
+    $cmd .= sprintf($cmdfmt, _RRD_FILE, $dataItem);
176
+    if ($addTrend == 0) {
177
+        $cmd .= "LINE1:dSeries#0400ff ";
178
+    } elseif ($addTrend == 1) {
179
+        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
180
+        $cmd .= sprintf($cmdfmt, $trendWindow);
181
+    } elseif ($addTrend == 2) {
182
+        $cmd .= "LINE1:dSeries#0400ff ";
183
+        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
184
+        #$cmdfmt = "CDEF:smoothed=dSeries,%s,XYZZY LINE3:smoothed#ff0000 ";
185
+        $cmd .=  sprintf($cmdfmt, $trendWindow);
186
+    }
187
+     
188
+    # Execute the formatted rrdtool command in the shell. The rrdtool
189
+    # command will complete execution before the html image tags get
190
+    # sent to the browser.  This assures that the charts are available
191
+    # when the client browser executes the html code that loads the
192
+    # charts into the document displayed by the client browser.
193
+    if (_DEBUG) {
194
+        echo "<p>chart command:<br>" . $cmd . "</p>";
195
+    }
196
+    $result = shell_exec($cmd . " 2>&1");
197
+    if (_DEBUG) {
198
+        echo "<p>result:<br>" . $result . "</p>";
199
+    }
200
+}
201
+
202
+?>
203
+
204
+</body>
205
+</html>
Browse code

fix version numbers

gandolf authored on 03/31/2020 18:04:12
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,205 +0,0 @@
1
-<html>
2
-<!-- Courtsey ruler
3
-12345678901234567890123456789012345678901234567890123456789012345678901234567890
4
-<head>
5
-<style>
6
-p {
7
-    font: 14px ariel, sans serif;
8
-}
9
-#errorMsg {
10
-    font:bold 18px arial,sans-serif;
11
-    color:red;
12
-    text-align:center;
13
-}
14
-.chartContainer {
15
-    padding: 2px;
16
-}
17
-img.chart {
18
-    width:100%;
19
-}
20
-</style>
21
-</head>
22
-<body>
23
-
24
-<?php
25
-/*
26
- Script: arednsig.php
27
-
28
- Description: This scripts generates on the server charts showing
29
- signal data spanning the period supplied by the user.  The script
30
- does the following:
31
-    - converts user supplied dates to  epoch time
32
-    - gets the times of the first and last data point in the round
33
-      robin database (RRD)
34
-    - from above validates user supplied begin and end dates
35
-    - creates charts of the specified period
36
-
37
- Copyright 2020 Jeff Owrey
38
-    This program is free software: you can redistribute it and/or modify
39
-    it under the terms of the GNU General Public License as published by
40
-    the Free Software Foundation, either version 3 of the License, or
41
-    (at your option) any later version.
42
-
43
-    This program is distributed in the hope that it will be useful,
44
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
45
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
-    GNU General Public License for more details.
47
-
48
-    You should have received a copy of the GNU General Public License
49
-    along with this program.  If not, see http://www.gnu.org/license.
50
-
51
- Revision History
52
-   * v20 released 18 Jan 2020 by J L Owrey; first release
53
-*/
54
-
55
-# Define global constants
56
-
57
-# round robin database file
58
-define("_RRD_FILE", str_replace("public_html/arednsig/arednsig.php",
59
-                                "database/arednsigData.rrd",
60
-                                $_SERVER["SCRIPT_FILENAME"]));
61
-# charts html directory
62
-define("_CHART_DIRECTORY", str_replace("arednsig.php",
63
-                                       "dynamic/",
64
-                                       $_SERVER["SCRIPT_FILENAME"]));
65
-# standard chart width in pixels
66
-define("_CHART_WIDTH", 600);
67
-# standard chart height in pixels
68
-define("_CHART_HEIGHT", 150);
69
-# debug mode
70
-define("_DEBUG", false);
71
-
72
-# Set error handling modes.
73
-error_reporting(E_ALL);
74
-
75
-# Get user supplied chart begin and end dates.
76
-$beginDate = $_POST["beginDate"];
77
-$endDate =  $_POST["endDate"];
78
-
79
-# Convert the user supplied dates to epoch time stamps.
80
-$beginDateEp = strtotime($beginDate);
81
-$endDateEp = strtotime($endDate);
82
-
83
-# Get the time stamp of the earliest data point in the RRD file.
84
-$cmd = sprintf("rrdtool first %s --rraindex 1", _RRD_FILE);
85
-$firstDP = shell_exec($cmd);
86
-
87
-# Get the time stamp of the latest data point in the RRD file.
88
-$cmd = sprintf("rrdtool last %s", _RRD_FILE);
89
-$lastDP = shell_exec($cmd);
90
-
91
-# Determine validity of user supplied dates.  User supplied begin
92
-# date must be less than user supplied end date.  Furthermore both
93
-# dates must be within the range of dates stored in the RRD.
94
-if ($beginDateEp > $endDateEp) {
95
-    echo "<p id=\"errorMsg\">" .
96
-         "End date must be after begin date.</p>";
97
-} elseif ($beginDateEp < $firstDP || $endDateEp > $lastDP) {
98
-    echo "<p id=\"errorMsg\">" .
99
-          "Date range must be between " .
100
-          date('m / d / Y', $firstDP) . " and " . 
101
-          date('m / d / Y', $lastDP) . ".</p>";
102
-} else {
103
-    # Generate charts from validated user supplied dates.
104
-    if (_DEBUG) {
105
-        echo "<p>Date range: " . $beginDateEp . " thru " .
106
-              $endDateEp . "</p>";
107
-    }
108
-    createChart('custom_signal', 'S', 'dBm', 
109
-                'RSSI', $beginDateEp, $endDateEp,
110
-                 0, 0, 2, false);
111
-    createChart('custom_snr', 'SNR', 'dBm', 
112
-                'S/N', $beginDateEp, $endDateEp,
113
-                 0, 0, 2, false);
114
-    # Send html commands to client browser.
115
-    echo "<div class=\"chartContainer\">" .
116
-         "<img class=\"chart\" src=\"dynamic/custom_signal.png\">" .
117
-         "</div>";
118
-    echo "<div class=\"chartContainer\">" .
119
-         "<img class=\"chart\" src=\"dynamic/custom_snr.png\">" .
120
-         "</div>";
121
-}
122
-
123
-function createChart($chartFile, $dataItem, $label, $title, $begin,
124
-                     $end, $lower, $upper, $addTrend, $autoScale) {
125
-    /*
126
-    Uses rrdtool to create a chart of specified aredn node data item.
127
-    Parameters:
128
-       fileName - name of the created chart file
129
-       dataItem - data item to be charted
130
-       label - string containing a label for the item to be charted
131
-       title - string containing a title for the chart
132
-       begin - beginning time of the chart data
133
-       end   - ending time of the data to be charted
134
-       lower - lower bound for chart ordinate #NOT USED
135
-       upper - upper bound for chart ordinate #NOT USED
136
-       addTrend - 0, show only chart data
137
-                  1, show only a trend line
138
-                  2, show a trend line and the chart data
139
-       autoScale - if True, then use vertical axis auto scaling
140
-           (lower and upper parameters are ignored), otherwise use
141
-           lower and upper parameters to set vertical axis scale
142
-    Returns: True if successful, False otherwise
143
-    */
144
-
145
-    # Define path on server to chart files.
146
-    $chartPath = _CHART_DIRECTORY . $chartFile . ".png";
147
-
148
-    # Format the rrdtool chart command.
149
-
150
-    # Set chart file name, start time, end time, height, and width.
151
-    $cmdfmt = "rrdtool graph %s -a PNG -s %s -e %s -w %s -h %s ";
152
-    $cmd = sprintf($cmdfmt, $chartPath, $begin, $end, _CHART_WIDTH,
153
-                   _CHART_HEIGHT);
154
-    $cmdfmt = "-l %s -u %s -r ";
155
-
156
-    # Set upper and lower ordinate bounds.
157
-    if ($lower < $upper) {
158
-        $cmd .= sprintf($cmdfmt, $lower, $upper);
159
-    } elseif ($autoScale) {
160
-        $cmd .= "-A ";
161
-    }
162
-    $cmd .= "-Y ";
163
-
164
-    # Set the chart ordinate label and chart title. 
165
-    $cmdfmt = "-v %s -t %s ";
166
-    $cmd .= sprintf($cmdfmt, $label, $title);
167
-   
168
-    # Define moving average window width.
169
-    $trendWindow = floor(($end - $begin) / 12);
170
-        
171
-    # Show the data, or a moving average trend line over
172
-    # the data, or both.
173
-    $cmdfmt = "DEF:dSeries=%s:%s:LAST ";
174
-    $cmd .= sprintf($cmdfmt, _RRD_FILE, $dataItem);
175
-    if ($addTrend == 0) {
176
-        $cmd .= "LINE1:dSeries#0400ff ";
177
-    } elseif ($addTrend == 1) {
178
-        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
179
-        $cmd .= sprintf($cmdfmt, $trendWindow);
180
-    } elseif ($addTrend == 2) {
181
-        $cmd .= "LINE1:dSeries#0400ff ";
182
-        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
183
-        #$cmdfmt = "CDEF:smoothed=dSeries,%s,XYZZY LINE3:smoothed#ff0000 ";
184
-        $cmd .=  sprintf($cmdfmt, $trendWindow);
185
-    }
186
-     
187
-    # Execute the formatted rrdtool command in the shell. The rrdtool
188
-    # command will complete execution before the html image tags get
189
-    # sent to the browser.  This assures that the charts are available
190
-    # when the client browser executes the html code that loads the
191
-    # charts into the document displayed by the client browser.
192
-    if (_DEBUG) {
193
-        echo "<p>chart command:<br>" . $cmd . "</p>";
194
-    }
195
-    $result = shell_exec($cmd . " 2>&1");
196
-    if (_DEBUG) {
197
-        echo "<p>result:<br>" . $result . "</p>";
198
-    }
199
-}
200
-
201
-?>
202
-
203
-</body>
204
-</html>
Browse code

support for Aredn FW v3.19.3.0

gandolf authored on 03/31/2020 17:38:41
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,205 @@
1
+<html>
2
+<!-- Courtsey ruler
3
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
4
+-->
5
+<head>
6
+<style>
7
+p {
8
+    font: 14px ariel, sans serif;
9
+}
10
+#errorMsg {
11
+    font:bold 18px arial,sans-serif;
12
+    color:red;
13
+    text-align:center;
14
+}
15
+.chartContainer {
16
+    padding: 2px;
17
+}
18
+img.chart {
19
+    width:100%;
20
+}
21
+</style>
22
+</head>
23
+<body>
24
+
25
+<?php
26
+/*
27
+ Script: arednsig.php
28
+
29
+ Description: This scripts generates on the server charts showing
30
+ signal data spanning the period supplied by the user.  The script
31
+ does the following:
32
+    - converts user supplied dates to  epoch time
33
+    - gets the times of the first and last data point in the round
34
+      robin database (RRD)
35
+    - from above validates user supplied begin and end dates
36
+    - creates charts of the specified period
37
+
38
+ Copyright 2020 Jeff Owrey
39
+    This program is free software: you can redistribute it and/or modify
40
+    it under the terms of the GNU General Public License as published by
41
+    the Free Software Foundation, either version 3 of the License, or
42
+    (at your option) any later version.
43
+
44
+    This program is distributed in the hope that it will be useful,
45
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
46
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
47
+    GNU General Public License for more details.
48
+
49
+    You should have received a copy of the GNU General Public License
50
+    along with this program.  If not, see http://www.gnu.org/license.
51
+
52
+ Revision History
53
+   * v20 released 18 Jan 2020 by J L Owrey; first release
54
+*/
55
+
56
+# Define global constants
57
+
58
+# round robin database file
59
+define("_RRD_FILE", str_replace("public_html/arednsig/arednsig.php",
60
+                                "database/arednsigData.rrd",
61
+                                $_SERVER["SCRIPT_FILENAME"]));
62
+# charts html directory
63
+define("_CHART_DIRECTORY", str_replace("arednsig.php",
64
+                                       "dynamic/",
65
+                                       $_SERVER["SCRIPT_FILENAME"]));
66
+# standard chart width in pixels
67
+define("_CHART_WIDTH", 600);
68
+# standard chart height in pixels
69
+define("_CHART_HEIGHT", 150);
70
+# debug mode
71
+define("_DEBUG", false);
72
+
73
+# Set error handling modes.
74
+error_reporting(E_ALL);
75
+
76
+# Get user supplied chart begin and end dates.
77
+$beginDate = $_POST["beginDate"];
78
+$endDate =  $_POST["endDate"];
79
+
80
+# Convert the user supplied dates to epoch time stamps.
81
+$beginDateEp = strtotime($beginDate);
82
+$endDateEp = strtotime($endDate);
83
+
84
+# Get the time stamp of the earliest data point in the RRD file.
85
+$cmd = sprintf("rrdtool first %s --rraindex 1", _RRD_FILE);
86
+$firstDP = shell_exec($cmd);
87
+
88
+# Get the time stamp of the latest data point in the RRD file.
89
+$cmd = sprintf("rrdtool last %s", _RRD_FILE);
90
+$lastDP = shell_exec($cmd);
91
+
92
+# Determine validity of user supplied dates.  User supplied begin
93
+# date must be less than user supplied end date.  Furthermore both
94
+# dates must be within the range of dates stored in the RRD.
95
+if ($beginDateEp > $endDateEp) {
96
+    echo "<p id=\"errorMsg\">" .
97
+         "End date must be after begin date.</p>";
98
+} elseif ($beginDateEp < $firstDP || $endDateEp > $lastDP) {
99
+    echo "<p id=\"errorMsg\">" .
100
+          "Date range must be between " .
101
+          date('m / d / Y', $firstDP) . " and " . 
102
+          date('m / d / Y', $lastDP) . ".</p>";
103
+} else {
104
+    # Generate charts from validated user supplied dates.
105
+    if (_DEBUG) {
106
+        echo "<p>Date range: " . $beginDateEp . " thru " .
107
+              $endDateEp . "</p>";
108
+    }
109
+    createChart('custom_signal', 'S', 'dBm', 
110
+                'RSSI', $beginDateEp, $endDateEp,
111
+                 0, 0, 2, false);
112
+    createChart('custom_snr', 'SNR', 'dBm', 
113
+                'S/N', $beginDateEp, $endDateEp,
114
+                 0, 0, 2, false);
115
+    # Send html commands to client browser.
116
+    echo "<div class=\"chartContainer\">" .
117
+         "<img class=\"chart\" src=\"dynamic/custom_signal.png\">" .
118
+         "</div>";
119
+    echo "<div class=\"chartContainer\">" .
120
+         "<img class=\"chart\" src=\"dynamic/custom_snr.png\">" .
121
+         "</div>";
122
+}
123
+
124
+function createChart($chartFile, $dataItem, $label, $title, $begin,
125
+                     $end, $lower, $upper, $addTrend, $autoScale) {
126
+    /*
127
+    Uses rrdtool to create a chart of specified aredn node data item.
128
+    Parameters:
129
+       fileName - name of the created chart file
130
+       dataItem - data item to be charted
131
+       label - string containing a label for the item to be charted
132
+       title - string containing a title for the chart
133
+       begin - beginning time of the chart data
134
+       end   - ending time of the data to be charted
135
+       lower - lower bound for chart ordinate #NOT USED
136
+       upper - upper bound for chart ordinate #NOT USED
137
+       addTrend - 0, show only chart data
138
+                  1, show only a trend line
139
+                  2, show a trend line and the chart data
140
+       autoScale - if True, then use vertical axis auto scaling
141
+           (lower and upper parameters are ignored), otherwise use
142
+           lower and upper parameters to set vertical axis scale
143
+    Returns: True if successful, False otherwise
144
+    */
145
+
146
+    # Define path on server to chart files.
147
+    $chartPath = _CHART_DIRECTORY . $chartFile . ".png";
148
+
149
+    # Format the rrdtool chart command.
150
+
151
+    # Set chart file name, start time, end time, height, and width.
152
+    $cmdfmt = "rrdtool graph %s -a PNG -s %s -e %s -w %s -h %s ";
153
+    $cmd = sprintf($cmdfmt, $chartPath, $begin, $end, _CHART_WIDTH,
154
+                   _CHART_HEIGHT);
155
+    $cmdfmt = "-l %s -u %s -r ";
156
+
157
+    # Set upper and lower ordinate bounds.
158
+    if ($lower < $upper) {
159
+        $cmd .= sprintf($cmdfmt, $lower, $upper);
160
+    } elseif ($autoScale) {
161
+        $cmd .= "-A ";
162
+    }
163
+    $cmd .= "-Y ";
164
+
165
+    # Set the chart ordinate label and chart title. 
166
+    $cmdfmt = "-v %s -t %s ";
167
+    $cmd .= sprintf($cmdfmt, $label, $title);
168
+   
169
+    # Define moving average window width.
170
+    $trendWindow = floor(($end - $begin) / 12);
171
+        
172
+    # Show the data, or a moving average trend line over
173
+    # the data, or both.
174
+    $cmdfmt = "DEF:dSeries=%s:%s:LAST ";
175
+    $cmd .= sprintf($cmdfmt, _RRD_FILE, $dataItem);
176
+    if ($addTrend == 0) {
177
+        $cmd .= "LINE1:dSeries#0400ff ";
178
+    } elseif ($addTrend == 1) {
179
+        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
180
+        $cmd .= sprintf($cmdfmt, $trendWindow);
181
+    } elseif ($addTrend == 2) {
182
+        $cmd .= "LINE1:dSeries#0400ff ";
183
+        $cmdfmt = "CDEF:smoothed=dSeries,%s,TREND LINE3:smoothed#ff0000 ";
184
+        #$cmdfmt = "CDEF:smoothed=dSeries,%s,XYZZY LINE3:smoothed#ff0000 ";
185
+        $cmd .=  sprintf($cmdfmt, $trendWindow);
186
+    }
187
+     
188
+    # Execute the formatted rrdtool command in the shell. The rrdtool
189
+    # command will complete execution before the html image tags get
190
+    # sent to the browser.  This assures that the charts are available
191
+    # when the client browser executes the html code that loads the
192
+    # charts into the document displayed by the client browser.
193
+    if (_DEBUG) {
194
+        echo "<p>chart command:<br>" . $cmd . "</p>";
195
+    }
196
+    $result = shell_exec($cmd . " 2>&1");
197
+    if (_DEBUG) {
198
+        echo "<p>result:<br>" . $result . "</p>";
199
+    }
200
+}
201
+
202
+?>
203
+
204
+</body>
205
+</html>