You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,48 @@ UCI configuration options must go in ``/etc/config/monitoring``.
40
40
- ``monitored_interfaces``: interfaces that needs to be monitored, defaults to ``*`` for all interfaces.
41
41
- ``interval``: time after which device data should be sent to server, defaults to ``300``.
42
42
- ``verbose_mode``: can be enabled (set to ``1``) to ease `debugging <#debugging>`__ in case of issues, defaults to ``0`` (disabled).
43
+
- ``required_memory``: available memory required to save data temporarily, defaults to ``0.05`` (5 percent).
44
+
- ``max_retries``: maximum number of retries in case of failures to send data to server in case of failure, defaults to ``5`` retries.
45
+
46
+
In case, `maximum retries are reached <#send-mode>`_, agent will try sending data again in next cycle.
47
+
48
+
Collecting vs Sending
49
+
---------------------
50
+
51
+
We use two procd services in `monitoring agent <https://github.com/openwisp/openwrt-openwisp-monitoring/blob/master/openwrt-openwisp-monitoring/files/monitoring.agent>`_, one for collecting the data and other for sending the data.
52
+
53
+
This helps handle failure in sending the data in more flexible way. Old data saved during network connectivity issues can be sent while new data is being collected. If old data has piled up and takes several minutes to be uploaded, new data will be collected without waiting for the sending to complete.
54
+
55
+
Monitoring agent uses two different modes to handle this, ``send`` and ``collect``.
56
+
57
+
Collect Mode
58
+
~~~~~~~~~~~~
59
+
60
+
If openwisp_monitoring agent is called with this mode, then the agent will keep charge of collecting and saving data.
61
+
62
+
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).
63
+
64
+
Once the data is saved, a signal will be sent to the other agent to ensure data is sent as soon as it is collected.
65
+
66
+
**Note:** Date and time on device should be set correctly. Otherwise, data will be saved with wrong timestamp in timeseries database.
67
+
68
+
Send Mode
69
+
~~~~~~~~~
70
+
71
+
If openwisp_monitoring agent is called with this mode, then the agent will keep charge of sending data.
72
+
73
+
Agent will check if any data file is available in temporary storage.
74
+
75
+
If there is no data file, the agent will sleep for the time interval and check for the data file again. This will be continued until a data file is found.
76
+
If a signal is received from the other agent, then the sleep will be interrupted and agent will start sending data.
77
+
78
+
If agent fails to send data to the server, an exponential backoff will be used to retry until `max_retries` is reached.
79
+
If all attempts of sending data failed, the agent will try to send data in the next cycle.
80
+
81
+
If data is sent successfully, then the data file will be deleted and agent will look for another file.
82
+
83
+
**SIGUSR1** signals are used to instantly send the data when collected. However, the service will keep trying
84
+
to send data periodically.
43
85
44
86
Compiling openwrt-openwisp-monitoring
45
87
-------------------------------------
@@ -96,7 +138,6 @@ you will need to select the *openwisp-monitoring* variant and *netjson-monitorin
96
138
./scripts/feeds update -a
97
139
./scripts/feeds install -a
98
140
make menuconfig
99
-
# go to Base system, then select rpcd
100
141
# go to Administration > admin > openwisp and select the packages you need interactively
101
142
make tools/install
102
143
make toolchain/install
@@ -124,6 +165,7 @@ If you are in that doubt openwisp-monitoring is running at all or not, you can c
124
165
125
166
You should see something like::
126
167
168
+
2712 root 1224 S /bin/sh /usr/sbin/openwisp_monitoring --interval 300 --monitored_interfaces ...
127
169
2713 root 1224 S /bin/sh /usr/sbin/openwisp_monitoring --url http://192.168.1.195:8000 ...
128
170
129
171
You can inspect the version of openwisp-monitoring currently installed with::
0 commit comments