1 | 1 |
deleted file mode 100755 |
... | ... |
@@ -1,89 +0,0 @@ |
1 |
-#!/usr/bin/python -u |
|
2 |
-## The -u option above turns off block buffering of python output. This assures |
|
3 |
-## that each error message gets individually printed to the log file. |
|
4 |
-# |
|
5 |
-# Module: createArednsigRrd.py |
|
6 |
-# |
|
7 |
-# Description: Creates a rrdtool database for use by the weather agent to |
|
8 |
-# store the data from the weather station. The agent uses the data in the |
|
9 |
-# database to generate graphic charts for display in the weather station |
|
10 |
-# web page. |
|
11 |
-# |
|
12 |
-# Copyright 2020 Jeff Owrey |
|
13 |
-# This program is free software: you can redistribute it and/or modify |
|
14 |
-# it under the terms of the GNU General Public License as published by |
|
15 |
-# the Free Software Foundation, either version 3 of the License, or |
|
16 |
-# (at your option) any later version. |
|
17 |
-# |
|
18 |
-# This program is distributed in the hope that it will be useful, |
|
19 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
-# GNU General Public License for more details. |
|
22 |
-# |
|
23 |
-# You should have received a copy of the GNU General Public License |
|
24 |
-# along with this program. If not, see http://www.gnu.org/license. |
|
25 |
-# |
|
26 |
-# Revision History |
|
27 |
-# * v10 released 11 Jan 2020 by J L Owrey |
|
28 |
-# |
|
29 |
-import os |
|
30 |
-import time |
|
31 |
-import subprocess |
|
32 |
- |
|
33 |
- ### DEFINE FILE LOCATIONS ### |
|
34 |
- |
|
35 |
-_USER = os.environ['USER'] |
|
36 |
-# the file that stores the data |
|
37 |
-_RRD_FILE = "/home/%s/database/arednsigData.rrd" % _USER |
|
38 |
-_RRD_SIZE_IN_DAYS = 370 # days |
|
39 |
-_1YR_RRA_STEPS_PER_DAY = 96 |
|
40 |
-_DATABASE_UPDATE_INTERVAL = 60 |
|
41 |
- |
|
42 |
-def createRrdFile(): |
|
43 |
- """Create the rrd file if it does not exist. |
|
44 |
- Parameters: none |
|
45 |
- Returns: True, if successful |
|
46 |
- """ |
|
47 |
- |
|
48 |
- if os.path.exists(_RRD_FILE): |
|
49 |
- print "aredn node database already exists" |
|
50 |
- return True |
|
51 |
- |
|
52 |
- ## Calculate database size |
|
53 |
- |
|
54 |
- heartBeat = 2 * _DATABASE_UPDATE_INTERVAL |
|
55 |
- rra1yrNumPDP = int(round(86400 / (_1YR_RRA_STEPS_PER_DAY * \ |
|
56 |
- _DATABASE_UPDATE_INTERVAL))) |
|
57 |
- rrd24hrNumRows = int(round(86400 / _DATABASE_UPDATE_INTERVAL)) |
|
58 |
- rrd1yearNumRows = _1YR_RRA_STEPS_PER_DAY * _RRD_SIZE_IN_DAYS |
|
59 |
- |
|
60 |
- strFmt = ("rrdtool create %s --start now-1day --step %s " |
|
61 |
- "DS:S:GAUGE:%s:U:U DS:N:GAUGE:%s:U:U DS:SNR:GAUGE:%s:U:U " |
|
62 |
- "DS:RX_MCS:GAUGE:%s:U:U DS:TX_MCS:GAUGE:%s:U:U " |
|
63 |
- "DS:RX_RATE:GAUGE:%s:U:U DS:TX_RATE:GAUGE:%s:U:U " |
|
64 |
- "RRA:LAST:0.5:1:%s RRA:LAST:0.5:%s:%s") |
|
65 |
- |
|
66 |
- strCmd = strFmt % (_RRD_FILE, _DATABASE_UPDATE_INTERVAL, \ |
|
67 |
- heartBeat, heartBeat, heartBeat, heartBeat, \ |
|
68 |
- heartBeat, heartBeat, heartBeat, \ |
|
69 |
- rrd24hrNumRows, rra1yrNumPDP, rrd1yearNumRows) |
|
70 |
- |
|
71 |
- print "creating aredn node database...\n\n%s\n" % strCmd |
|
72 |
- |
|
73 |
- # Spawn a sub-shell and run the command |
|
74 |
- try: |
|
75 |
- subprocess.check_output(strCmd, stderr=subprocess.STDOUT, \ |
|
76 |
- shell=True) |
|
77 |
- except subprocess.CalledProcessError, exError: |
|
78 |
- print "rrdtool create failed: %s" % (exError.output) |
|
79 |
- return False |
|
80 |
- return True |
|
81 |
-##end def |
|
82 |
- |
|
83 |
-def main(): |
|
84 |
- createRrdFile() |
|
85 |
-## end def |
|
86 |
- |
|
87 |
-if __name__ == '__main__': |
|
88 |
- main() |
|
89 |
- |
90 | 0 |
deleted file mode 100755 |
... | ... |
@@ -1,16 +0,0 @@ |
1 |
-#!/bin/sh |
|
2 |
-# |
|
3 |
-# Create a directory in the temporary file system for arednsig dynamic |
|
4 |
-# data. Set ownership and permissions to allow the Apache www-data user |
|
5 |
-# read and write access to this folder. |
|
6 |
-mkdir /tmp/arednsig |
|
7 |
-sudo chown :www-data /tmp/arednsig |
|
8 |
-chmod g+w /tmp/arednsig |
|
9 |
- |
|
10 |
-# Uncomment the following line if you choose to mount the dynamic |
|
11 |
-# folder to the folder created above. |
|
12 |
-#sudo mount --bind /tmp/arednsig /home/pi/public_html/arednsig/dynamic |
|
13 |
- |
|
14 |
-# Start arednsig agent |
|
15 |
-(sleep 5; /home/pi/bin/ardstart;) & |
|
16 |
- |
28 | 11 |
similarity index 99% |
29 | 12 |
rename from arednsig/aredn_fw_3_20_3_0/bin/arednsigAgent.py |
30 | 13 |
rename to arednsig/bin/arednsigAgent.py |
... | ... |
@@ -70,9 +70,9 @@ _RRD_FILE = "/home/%s/database/arednsigData.rrd" % _USER |
70 | 70 |
|
71 | 71 |
### GLOBAL CONSTANTS ### |
72 | 72 |
|
73 |
-# interval in seconds between data requests to the aredn node |
|
73 |
+# AREDN node data request interval in seconds |
|
74 | 74 |
_DEFAULT_DATA_REQUEST_INTERVAL = 60 |
75 |
-# chart update interval in minutes |
|
75 |
+# chart update interval in seconds |
|
76 | 76 |
_CHART_UPDATE_INTERVAL = 600 |
77 | 77 |
|
78 | 78 |
# number seconds to wait for a response to HTTP request |
79 | 79 |
similarity index 96% |
80 | 80 |
rename from arednsig/aredn_fw_3_20_3_0/html/arednsig.html |
81 | 81 |
rename to arednsig/html/arednsig.html |
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
--> |
5 | 5 |
<html> |
6 | 6 |
<head> |
7 |
-<title>Node Signal</title> |
|
7 |
+<title>AREDN Node - Signal Status</title> |
|
8 | 8 |
<meta charset="UTF-8"> |
9 | 9 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
10 | 10 |
<style> |
... | ... |
@@ -98,7 +98,7 @@ span.selectorElement { |
98 | 98 |
<div class="mainContainer"> |
99 | 99 |
<h2><a href="https://github.com/fractalxaos/ham/tree/master/arednsig" |
100 | 100 |
style="text-decoration:none" target="_new"> |
101 |
-KA7JLO AREDN<sup>®</sup> Node Signal</a></h2> |
|
101 |
+AREDN<sup>®</sup> Node Signal</a></h2> |
|
102 | 102 |
<h3>Last Updated</h3> |
103 | 103 |
<div class="datetime"> |
104 | 104 |
<span id="date"></span> |
... | ... |
@@ -110,7 +110,7 @@ KA7JLO AREDN<sup>®</sup> Node Signal</a></h2> |
110 | 110 |
<div class="currentDataCell"> |
111 | 111 |
<div class="dataItems" style="text-align: center;"> |
112 | 112 |
Status: <span id="status"></span><br> |
113 |
-Data updates every: <span id="period"></span> minutes |
|
113 |
+Charts update every: <span id="period"></span> minutes |
|
114 | 114 |
</div> |
115 | 115 |
|
116 | 116 |
</div> |
... | ... |
@@ -283,9 +283,9 @@ function displayData(dataItem) { |
283 | 283 |
statusElmt.style.color = "green"; |
284 | 284 |
|
285 | 285 |
chartRefreshRate = dataItem.period; |
286 |
- periodElmt.innerHTML = chartRefreshRate; |
|
287 |
- setInterval(getNodeData, 60000 * chartRefreshRate); |
|
288 |
- setInterval(getNodeCharts, 60000 * chartRefreshRate); |
|
286 |
+ periodElmt.innerHTML = chartRefreshRate / 60; |
|
287 |
+ setInterval(getNodeData, 1000 * chartRefreshRate); |
|
288 |
+ setInterval(getNodeCharts, 1000 * chartRefreshRate); |
|
289 | 289 |
} |
290 | 290 |
|
291 | 291 |
function displayOfflineStatus() { |
295 | 295 |
similarity index 54% |
296 | 296 |
rename from arednsig/aredn_fw_3_20_3_0/html/index.html |
297 | 297 |
rename to arednsig/html/index.html |
... | ... |
@@ -2,6 +2,5 @@ |
2 | 2 |
<html> |
3 | 3 |
<head> |
4 | 4 |
<meta http-equiv="refresh" content="0; url=./arednsig.html"> |
5 |
- <!--<meta http-equiv="refresh" content="0; url=https://github.com/fractalxaos/radmon">--> |
|
6 | 5 |
</head> |
7 | 6 |
</html> |