Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added debug_mode in monitoring config #79

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ UCI configuration options must go in ``/etc/config/openwisp-monitoring``.

- ``monitored_interfaces``: interfaces that needs to be monitored, defaults to ``*`` for all interfaces.
- ``interval``: time after which device data should be sent to server, defaults to ``300``.
- ``verbose_mode``: can be enabled (set to ``1``) to ease `debugging <#debugging>`__ in case of issues, defaults to ``0`` (disabled).
- ``debug_mode``: can be enabled (set to ``1``) to ease `debugging <#debugging>`__ in case of issues, defaults to ``0`` (disabled).
- ``required_memory``: available memory required to save data temporarily, defaults to ``0.05`` (5 percent).
- ``max_retries``: maximum number of retries in case of failures to send data to server in case of failure, defaults to ``5`` retries.

Expand Down Expand Up @@ -155,7 +155,7 @@ Debugging *openwisp-monitoring package* can be easily done by using the ``logrea

logread | grep openwisp-monitoring

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

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

Expand Down
2 changes: 1 addition & 1 deletion openwrt-openwisp-monitoring/files/monitoring.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config monitoring 'monitoring'
option monitored_interfaces '*'
option interval '300'
option verbose_mode '0'
option debug_mode '0'
option required_memory '0.05'
option max_retries '5'
4 changes: 3 additions & 1 deletion openwrt-openwisp-monitoring/files/monitoring.init
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ start_service() {
config_get monitored_interfaces monitoring monitored_interfaces "*"
config_get interval monitoring interval "300"
config_get_bool verbose_mode monitoring verbose_mode "0"
config_get_bool debug_mode monitoring debug_mode "0"
config_get required_memory monitoring required_memory "0.05"
config_get max_retries monitoring max_retries "5"

Expand All @@ -70,6 +71,7 @@ start_service() {
fi
interval="--interval $interval"
verbose="--verbose_mode ${verbose_mode:-0}"
debug="--debug_mode ${debug_mode:-0}"
set -- --monitored_interfaces \""$monitored_interfaces"\"
monitored_interfaces="$*"
required_memory="--required_memory $required_memory"
Expand All @@ -79,7 +81,7 @@ start_service() {
# shellcheck disable=SC2086
procd_set_param command $PROG $interval $monitored_interfaces $verbose $required_memory --mode collect
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
[ "$verbose_mode" -eq "1" ] && procd_set_param stdout 1 && procd_set_param stderr 1
[ "$debug_mode" -eq "1" ] && procd_set_param stdout 1 && procd_set_param stderr 1
procd_close_instance

procd_open_instance "openwisp-monitoring_send_data"
Expand Down