Skip to content

Commit b8ad7a8

Browse files
[change] Turned netjson_monitoring into shell tool #59 (#66)
- turned netjson_monitoring into shell tool - Use `-` as separator instead of `_` - [refactor] Remove .gz extension while checking if data is current or old Changed all occurences of openwisp_monitoring and netjson_monitoring with openwisp-monitoring and netjson-monitoring respectively. Closes #59
1 parent 261239e commit b8ad7a8

21 files changed

Lines changed: 140 additions & 80 deletions

README.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for `OpenWRT <https://openwrt.org/>`_.
3535
Configuration options
3636
---------------------
3737

38-
UCI configuration options must go in ``/etc/config/openwisp_monitoring``.
38+
UCI configuration options must go in ``/etc/config/openwisp-monitoring``.
3939

4040
- ``monitored_interfaces``: interfaces that needs to be monitored, defaults to ``*`` for all interfaces.
4141
- ``interval``: time after which device data should be sent to server, defaults to ``300``.
@@ -57,7 +57,7 @@ Monitoring agent uses two different modes to handle this, ``send`` and ``collect
5757
Collect Mode
5858
~~~~~~~~~~~~
5959

60-
If openwisp_monitoring agent is called with this mode, then the agent will keep charge of collecting and saving data.
60+
If openwisp-monitoring agent is called with this mode, then the agent will keep charge of collecting and saving data.
6161

6262
Agent will periodically check if enough memory is available. If true, data will be collected and saved in temporary storage with the timestamp (in UTC timezone).
6363

@@ -68,7 +68,7 @@ Once the data is saved, a signal will be sent to the other agent to ensure data
6868
Send Mode
6969
~~~~~~~~~
7070

71-
If openwisp_monitoring agent is called with this mode, then the agent will keep charge of sending data.
71+
If openwisp-monitoring agent is called with this mode, then the agent will keep charge of sending data.
7272

7373
Agent will check if any data file is available in temporary storage.
7474

@@ -146,29 +146,29 @@ you will need to select the *openwisp-monitoring* variant and *netjson-monitorin
146146
Once installed *openwisp-monitoring* needs to be configured (see `Configuration options`_)
147147
and then started with::
148148

149-
/etc/init.d/openwisp_monitoring restart
149+
/etc/init.d/openwisp-monitoring restart
150150

151151
Debugging
152152
---------
153153

154154
Debugging *openwisp-monitoring package* can be easily done by using the ``logread`` command::
155155

156-
logread | grep openwisp_monitoring
156+
logread | grep openwisp-monitoring
157157

158158
In case of any issue, you can enable `verbose_mode <#configuration-options>`__.
159159

160160
If you are in that doubt openwisp-monitoring is running at all or not, you can check with::
161161

162-
ps | grep openwisp_monitoring
162+
ps | grep openwisp-monitoring
163163

164164
You should see something like::
165165

166-
2712 root 1224 S /bin/sh /usr/sbin/openwisp_monitoring --interval 300 --monitored_interfaces ...
167-
2713 root 1224 S /bin/sh /usr/sbin/openwisp_monitoring --url http://192.168.1.195:8000 ...
166+
2712 root 1224 S /bin/sh /usr/sbin/openwisp-monitoring --interval 300 --monitored_interfaces ...
167+
2713 root 1224 S /bin/sh /usr/sbin/openwisp-monitoring --url http://192.168.1.195:8000 ...
168168

169169
You can inspect the version of openwisp-monitoring currently installed with::
170170

171-
openwisp_monitoring --version
171+
openwisp-monitoring --version
172172

173173
Quality Assurance Checks
174174
------------------------

openwrt-openwisp-monitoring/Makefile

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,53 @@ define Build/Compile
4545
endef
4646

4747
define Package/openwisp-monitoring-$(BUILD_VARIANT)/conffiles
48-
/etc/config/monitoring
48+
/etc/config/openwisp-monitoring
4949
endef
5050

5151
define Package/netjson-monitoring/install
5252
$(INSTALL_DIR) \
5353
$(1)/usr/sbin \
54-
$(1)/usr/lib/lua/openwisp_monitoring
54+
$(1)/usr/libexec \
55+
$(1)/usr/lib/lua/openwisp-monitoring \
56+
$(1)/etc/openwisp-monitoring
5557

5658
$(INSTALL_BIN) \
5759
files/sbin/netjson-monitoring.lua \
58-
$(1)/usr/sbin/netjson_monitoring
60+
$(1)/usr/libexec/netjson-monitoring
61+
62+
$(INSTALL_BIN) \
63+
files/netjson-monitoring \
64+
$(1)/usr/sbin/netjson-monitoring
5965

6066
$(INSTALL_DATA) \
61-
files/lib/openwisp_monitoring/dhcp.lua \
62-
$(1)/usr/lib/lua/openwisp_monitoring/dhcp.lua
67+
files/lib/openwisp-monitoring/dhcp.lua \
68+
$(1)/usr/lib/lua/openwisp-monitoring/dhcp.lua
6369

6470
$(INSTALL_DATA) \
65-
files/lib/openwisp_monitoring/interfaces.lua \
66-
$(1)/usr/lib/lua/openwisp_monitoring/interfaces.lua
71+
files/lib/openwisp-monitoring/interfaces.lua \
72+
$(1)/usr/lib/lua/openwisp-monitoring/interfaces.lua
6773

6874
$(INSTALL_DATA) \
69-
files/lib/openwisp_monitoring/monitoring.lua \
70-
$(1)/usr/lib/lua/openwisp_monitoring/monitoring.lua
75+
files/lib/openwisp-monitoring/monitoring.lua \
76+
$(1)/usr/lib/lua/openwisp-monitoring/monitoring.lua
7177

7278
$(INSTALL_DATA) \
73-
files/lib/openwisp_monitoring/utils.lua \
74-
$(1)/usr/lib/lua/openwisp_monitoring/utils.lua
79+
files/lib/openwisp-monitoring/utils.lua \
80+
$(1)/usr/lib/lua/openwisp-monitoring/utils.lua
7581

7682
$(INSTALL_DATA) \
77-
files/lib/openwisp_monitoring/neighbors.lua \
78-
$(1)/usr/lib/lua/openwisp_monitoring/neighbors.lua
83+
files/lib/openwisp-monitoring/neighbors.lua \
84+
$(1)/usr/lib/lua/openwisp-monitoring/neighbors.lua
7985

8086
$(INSTALL_DATA) \
81-
files/lib/openwisp_monitoring/resources.lua \
82-
$(1)/usr/lib/lua/openwisp_monitoring/resources.lua
87+
files/lib/openwisp-monitoring/resources.lua \
88+
$(1)/usr/lib/lua/openwisp-monitoring/resources.lua
8389

8490
$(INSTALL_DATA) \
85-
files/lib/openwisp_monitoring/wifi.lua \
86-
$(1)/usr/lib/lua/openwisp_monitoring/wifi.lua
91+
files/lib/openwisp-monitoring/wifi.lua \
92+
$(1)/usr/lib/lua/openwisp-monitoring/wifi.lua
93+
94+
$(CP) ../VERSION $(1)/etc/openwisp-monitoring/
8795

8896
endef
8997

@@ -92,21 +100,19 @@ define Package/openwisp-monitoring-$(BUILD_VARIANT)/install
92100
$(1)/usr/sbin \
93101
$(1)/etc/init.d \
94102
$(1)/etc/config \
95-
$(1)/etc/openwisp/monitoring
103+
$(1)/etc/openwisp-monitoring
96104

97105
$(INSTALL_BIN) \
98106
files/monitoring.agent \
99-
$(1)/usr/sbin/openwisp_monitoring
107+
$(1)/usr/sbin/openwisp-monitoring
100108

101109
$(INSTALL_BIN) \
102110
files/monitoring.init \
103-
$(1)/etc/init.d/openwisp_monitoring
111+
$(1)/etc/init.d/openwisp-monitoring
104112

105113
$(INSTALL_CONF) \
106114
files/monitoring.config \
107-
$(1)/etc/config/openwisp_monitoring
108-
109-
$(CP) ../VERSION $(1)/etc/openwisp/monitoring/
115+
$(1)/etc/config/openwisp-monitoring
110116

111117
endef
112118

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/dhcp.lua renamed to openwrt-openwisp-monitoring/files/lib/openwisp-monitoring/dhcp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- retrieve dhcp leases
2-
local utils = require('openwisp_monitoring.utils')
2+
local utils = require('openwisp-monitoring.utils')
33
local uci = require('uci')
44
local uci_cursor = uci.cursor()
55
local io = require('io')

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/interfaces.lua renamed to openwrt-openwisp-monitoring/files/lib/openwisp-monitoring/interfaces.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- retrieve interfaces information
2-
local utils = require('openwisp_monitoring.utils')
2+
local utils = require('openwisp-monitoring.utils')
33

44
local cjson = require('cjson')
55
local nixio = require('nixio')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package.path = package.path .. ";../files/lib/?.lua"
2+
3+
local monitoring = {}
4+
5+
monitoring.dhcp = require('openwisp-monitoring.dhcp')
6+
monitoring.interfaces = require('openwisp-monitoring.interfaces')
7+
monitoring.neighbors = require('openwisp-monitoring.neighbors')
8+
monitoring.resources = require('openwisp-monitoring.resources')
9+
monitoring.utils = require('openwisp-monitoring.utils')
10+
monitoring.wifi = require('openwisp-monitoring.wifi')
11+
12+
return monitoring

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/neighbors.lua renamed to openwrt-openwisp-monitoring/files/lib/openwisp-monitoring/neighbors.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- retrieve neighbors information
22
local cjson = require('cjson')
33
local io = require('io')
4-
local utils = require('openwisp_monitoring.utils')
4+
local utils = require('openwisp-monitoring.utils')
55

66
local neighbors = {}
77

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/resources.lua renamed to openwrt-openwisp-monitoring/files/lib/openwisp-monitoring/resources.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- retrieve resources usage
22
local io = require('io')
3-
local utils = require('openwisp_monitoring.utils')
3+
local utils = require('openwisp-monitoring.utils')
44

55
local resources = {}
66

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/utils.lua renamed to openwrt-openwisp-monitoring/files/lib/openwisp-monitoring/utils.lua

File renamed without changes.

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/wifi.lua renamed to openwrt-openwisp-monitoring/files/lib/openwisp-monitoring/wifi.lua

File renamed without changes.

openwrt-openwisp-monitoring/files/lib/openwisp_monitoring/monitoring.lua

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)