-
Notifications
You must be signed in to change notification settings - Fork 21
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
[fix] Fix errors in package and improve debugging #42
Conversation
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}" | ||
procd_set_param stderr 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this to log all errors in the instance so that it can be accessed using logread
@@ -52,8 +52,9 @@ start_service() { | |||
monitored_interfaces="--monitored_interfaces $monitored_interfaces" | |||
|
|||
procd_open_instance "openwisp_monitoring_monitoring" | |||
procd_set_param command $PROG "$base_url" "$uuid" "$key" "$verify_ssl" "$interval" "$monitored_interfaces" | |||
procd_set_param command $PROG $base_url $uuid $key $verify_ssl $interval $monitored_interfaces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverting quotes as this was causing monitoring.agent
to read --url http://www.....
as one word
b294b0b
to
d860640
Compare
d860640
to
5cde9f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this patch, the daemon sends data to OpenWISP Monitoring 👍 .
Here's the issues I found during testing.
Non verbose mode
I see these two lines in non-verbose mode:
Fri Jul 16 10:32:36 2021 daemon.info monitoring: Collecting NetJSON Monitoring data
Fri Jul 16 10:32:38 2021 daemon.info monitoring: Data sent successfully.
But this output should not be shown in non-verbose mode, otherwise logs will be filled with irrelevant lines.
Traffic stats seem missing
I don't see traffic stats being collected on the device I am using for testing, once I installed this branch and remove the old monitoring scripts, the traffic charts are flat zero.
Did you test this?
Verbose mode testing
Here's a few problems I see with verbose mode.
Identifeir different
The logread output uses different identifiers: monitoring, openwisp_monitoring, openwisp_monitoring[]. This is bad because log collectors will interpret these as different programs, can you make sure this is always the same? monitoring
seems to generic, I think it should be openwisp_monitoring
.
Logged response can be improved
Here's an example output: Data not sent successfully. Response code is {"detail":"Authentication credentials were not provided."}403.
. The message is readable but it's weird. The response body is {"detail":"Authentication credentials were not provided."}
while the response status code is 403. Can you turn this into something like:
The response received was: 403 {"detail":"Authentication credentials were not provided."}
?
Run with verbose mode redundant
This is showing up with verbose mode:
Fri Jul 16 10:53:31 2021 daemon.err monitoring: Run with verbose mode to find more.
Fri Jul 16 10:53:31 2021 daemon.err openwisp_monitoring[4023]: monitoring: Run with verbose mode to find more.
- we're already in verbose mode so we don't need to send this output.
- if we're not in verbose mode, ensure the output is not repeated twice
- do you see how one log line is identified by
daemon.err monitoring
and the otehr one bydaemon.err openwisp_monitoring[4023]
? This was mentioned in one of the previous review sections but please make sure to avoid it.
@@ -1,3 +1,4 @@ | |||
config monitoring 'monitoring' | |||
option monitored_interfaces '*' | |||
option monitored_interfaces '"*"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requiring the user to remember to wrap the value around double quotes is really bad and weird. I think we can do better than this.
@@ -50,10 +51,12 @@ start_service() { | |||
fi | |||
interval="--interval $interval" | |||
monitored_interfaces="--monitored_interfaces $monitored_interfaces" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does
monitored_interfaces="--monitored_interfaces \"$monitored_interfaces\""
allow us to not having to wrap the value in quotes in the UCI config file?
Added default value of version to silent sh: out of range error and replaced == with 0 to follow POSIX notations as it can break on some systems.
5cde9f2
to
de8ee00
Compare
de8ee00
to
535df1f
Compare
535df1f
to
617b25a
Compare
Thanks for testing this. I made some changes as follows: Non Verbose Mode Traffic stats Identifier Redundant Log Messages |
d6ff7a2
to
ff2d98b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #41
*
is passed