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

Use command line argument parsing instead of / in addition to UCI #13

Open
jonesmz opened this issue Feb 6, 2020 · 3 comments
Open

Comments

@jonesmz
Copy link

jonesmz commented Feb 6, 2020

Instead of using a UCI driven configuration for pingcheck, I would rather be able to provide it a series of commandline arguments to describe the behavior that I want from it.

This doesn't need to mean the UCI parsing is removed, they can both live side by side.

@br101
Copy link
Owner

br101 commented Feb 11, 2020

As pingcheck will always be running on OpenWRT (it uses ubus), there will always be UCI, so I don't see a real usecase for that. Let me know it there is a real reason besides personal preference...

@jonesmz
Copy link
Author

jonesmz commented Feb 11, 2020

Here's some personal preference reasons:

  1. Good engineering practice, it increases the test-ability of the tool by providing for an additional interface that can be used to drive the tools behavior.
  2. OpenWRT may not use uBus or UCI in the future.
  3. The UCI api is a pile of hot garbage, though it does technically work (most of the time). Honestly it'd be less of a concern to me if pingcheck talked to UCI over ubus via rpcd. But rpcd crashes a lot, so that might not be a good choice either.

Here's my real reason:

I have a program that runs on my device and actively monitors various conditions. I don't always want pingcheck running continuously, and instead bring it up and down based on changing environmental conditions. Sometimes it stays online for more than 10 minutes, sometimes less than a minute. It all depends on what the end-user does with the thing.

So ideally I would be able to do the following:

  1. Be able to run pingcheck with the list of interfaces I want to talk to without first writing to UCI. Among other things, this reduces the wear and tear on flash.
  2. Be able to tell pingcheck to, e.g. ping all the interfaces in question some specific number of times.
  3. Be able to ask Pingcheck for machine readable output.

E.g. json. Both with live output mode, and also with single summary output mode. E.g. something like: pingcheck --itf=wan --itf=wwan --tcp --port=80 --host=google.com --interval=1 --count=2 --json-output --summary-only, and then get output like:
{ "global" : "ONLINE", "wan" : "OFFLINE", "wwan" : "ONLINE" }

@br101
Copy link
Owner

br101 commented Feb 12, 2020

Hey, your real reason is valid, but I personally don't have the time/motivation to do the changes. Patches are welcome, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants