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

Support for lightweight monitors via projects #542

Closed
andrewvc opened this issue Jun 29, 2022 · 4 comments · Fixed by #593
Closed

Support for lightweight monitors via projects #542

andrewvc opened this issue Jun 29, 2022 · 4 comments · Fixed by #593
Labels
discussion Discuss about API changes, enhancements enhancement New feature or request

Comments

@andrewvc
Copy link
Contributor

andrewvc commented Jun 29, 2022

With project monitors we now let users manage browser based monitors easily from the CLI, but that story does not extend to lightweight monitors. This limits the utility of our overall solution since users need multiple workflows, when they ideally could use project monitors for everything if desired.

This issue proposes supporting the YAML format used in heartbeat's monitor.d directory with project monitors. These would act the same as browser based monitors, only their definitions would be YAML based and included in the source tree. An example is listed below.

- type: http 
  id: my-http-monitor
  name: Lightweight HTTP Monitor
  schedule: '@every 5s' 
  hosts: ["https://www.elastic.co"]
  # New keys for service listed below
  locations: ["us-west", "japan"]

Why YAML?

  • Users will need to migrate existing configs, this being the exact same format they already use makes migration a breeze.
  • Lightweight monitors are more frequently used by administrators who are more comfortable with YAML than JS/TS and Node. Asking users with those personas to use JS/TS may hinder adoption.
  • Ease of implementation, should be a simple translation to the API

Gotchas / Known issues

  • The IDs are not exactly portable since project monitors include the space and journey in the monitor ID. We could add a special config key preserve_exact_monitor_id: true|false to handle this situation.
  • We won't be able to support cron syntax, or, if we do, we should support the subset that is translatable to @every syntax (the regex (\*(\/\d)? )(\*(\/\d)? )\* \* \* should match and capture cron jobs meant to run every N minutes or every N hours.
  • Running locally is something we'll need to determine in the future. I propose that we initially just validate these and allow them to be pushed. Later we can determine a strategy for running these locally. Perhaps the simplest answer would be to just invoke docker run in run_once mode. For now, we could just validate the syntax of these monitors locally and mark them in some sort of skipped status.
@andrewvc andrewvc added enhancement New feature or request discussion Discuss about API changes, enhancements labels Jun 29, 2022
@dominiqueclarke
Copy link
Contributor

Kibana api for projects does currently assume browser monitor type, so updates to the api would be necessary to parse the type appropriately.

@andrewvc
Copy link
Contributor Author

See also: #599 and elastic/kibana#140864

@awahab07
Copy link

Post FF Testing

init'd a project using the latest build and tried the push command with one browser and one lightweight monitor and it behaved as expected.

  1. Returns the error for unsupported fields. For the following yaml config:

    - type: http
      ...
      check.response:
        status: [200]
        body:
          - Text

    it returns
    image

  2. For duplicate ids, it returns
    image

  3. When validation passes, it pushes the monitors as expected.

  4. However, it always shows the following warning regardless of the schedule value.
    image

@awahab07 awahab07 removed their assignment Sep 29, 2022
@vigneshshanmugam
Copy link
Member

However, it always shows the following warning regardless of the schedule value.

Yeah this is expected - See #612 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discuss about API changes, enhancements enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants