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

[refactor] Refactored agent with main and help function #33 #47

Merged
merged 3 commits into from
Sep 19, 2021

Conversation

devkapilbansal
Copy link
Member

@devkapilbansal devkapilbansal commented Aug 9, 2021

Closes #33

@devkapilbansal devkapilbansal force-pushed the issues/33-refactor-script branch 2 times, most recently from e89e46f to f43081b Compare August 9, 2021 19:14
@devkapilbansal devkapilbansal changed the title Refactored agent and fixed error with popen [refactor] Refactored agent with a main function #33 Aug 9, 2021
@devkapilbansal devkapilbansal force-pushed the issues/33-refactor-script branch 2 times, most recently from ee7a0e9 to f9f54b3 Compare August 11, 2021 22:11
@devkapilbansal devkapilbansal changed the title [refactor] Refactored agent with a main function #33 [refactor] Refactored agent with main and help function #33 Aug 11, 2021
@devkapilbansal devkapilbansal force-pushed the issues/29-temporarily-store-data branch 3 times, most recently from e758837 to 7dcbb87 Compare August 15, 2021 21:55
@devkapilbansal devkapilbansal deleted the branch master August 22, 2021 20:32
@devkapilbansal devkapilbansal changed the base branch from issues/29-temporarily-store-data to gsoc21 August 22, 2021 22:18
@devkapilbansal devkapilbansal changed the base branch from gsoc21 to master September 1, 2021 15:23
@devkapilbansal devkapilbansal force-pushed the issues/33-refactor-script branch 2 times, most recently from f7bfff9 to 6364369 Compare September 3, 2021 07:42
@devkapilbansal devkapilbansal marked this pull request as ready for review September 3, 2021 07:45
@devkapilbansal
Copy link
Member Author

Converting this to draft as it will result in merge conflicts with #53

@devkapilbansal devkapilbansal marked this pull request as draft September 3, 2021 08:57
@devkapilbansal devkapilbansal force-pushed the issues/33-refactor-script branch 2 times, most recently from 2f4e478 to ecbcb80 Compare September 6, 2021 16:36
@devkapilbansal devkapilbansal marked this pull request as ready for review September 6, 2021 17:06
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feckert WDYT?

@@ -69,7 +69,6 @@ start_service() {
exit 1
fi
interval="--interval $interval"
monitored_interfaces="--monitored_interfaces \"$monitored_interfaces\""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was left by mistake. Removed now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

printf " --uuid <uuid>\t\t\t\t: UUID of the device.\n"
printf " --key <key>\t\t\t\t: Key for the device.\n"
printf " --verify_ssl <0, 1>\t\t\t: Whether SSL Authentication should be enabled or not.\n"
printf "Openwisp Monitoring config options:\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Openwisp > OpenWISP here and above

@@ -69,7 +69,6 @@ start_service() {
exit 1
fi
interval="--interval $interval"
monitored_interfaces="--monitored_interfaces \"$monitored_interfaces\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

exit 0
}

show_version() {
VERSION=$(cat /etc/openwisp/monitoring/VERSION)
echo "openwisp-monitoring $VERSION"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use here
echo "$(basename "$0") $VERSION)" so we have always the real name of the file


INTERVAL=${INTERVAL:-300}
VERBOSE_MODE=${VERBOSE_MODE:-0}
TMP_DIR="/tmp/openwisp/monitoring"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not create this dir with mkdir -p ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am doing in save_data function

# make directory
mkdir -p "$TMP_DIR"

@nemesifier nemesifier merged commit bac6d54 into master Sep 19, 2021
@devkapilbansal devkapilbansal deleted the issues/33-refactor-script branch September 19, 2021 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[refactor] Refactor script with a main and help function
3 participants