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

Introduce a "command" monitorable for arbitrary executables #409

Open
Karunamon opened this issue Sep 6, 2022 · 0 comments
Open

Introduce a "command" monitorable for arbitrary executables #409

Karunamon opened this issue Sep 6, 2022 · 0 comments

Comments

@Karunamon
Copy link

This is a feature request to add a monitorable which would execute commands, and update the tile based on the command's output and/or exit code.

Rationale: This would be the final word in extensibility. If the backend is capable of running commands, then it is possible and fairly easy to monitor almost anything without more specialized monitors needing to be written. Go already has decent tools for running commands with the standard library os\exec package.

I understand that a "proxy" monitorable is in the works; I wanted to float this idea as a either simpler version of, or complementary to that. This monitorable would be the steak knife to HTTP proxy's scalpel. Blunter, but easier to use for the end-user.

The use case I had in mind for this is monitoring a DNS server. While the PORT monitorable will tell me if the daemon is running, it's not a very good functional test. I would prefer to run dig or nslookup and examine the exit code of the command.

Suggested implementation details

Configuration

  • Similar semantics to the HTTP-* family of monitorables, for example:
{
  "type": "COMMAND-STATUS",
  "params": {
    "command": "/usr/bin/nslookup example.com",
    "exitCodeMax": 0
  }
}
  • Identical regex and formatting options for -raw and -formatted
  • Exit code max is implicitly 0
  • Would probably need a timeout env variable, defaulting to something like 10,000 ms

Backend

  • In the name of keeping things simple for the user, implicitly pass the command through to a shell (sh or bash); this saves the need from having to separate the command from its arguments at configuration, and also gains some niceties like easily settable environment variables and such.
  • Call .start, come back and call .wait to collect the results
  • Not sure what happens if a command goes out to lunch; is the backend then stuck waiting on a routine forever? Could result in scary resource consumption if the command, say, uses something on network storage that has disappeared. Would need to introduce a way to ensure that only one instance of the command is running at a time.
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

No branches or pull requests

1 participant