kpetremann / salt-exporter

Salt Prometheus exporter working out of the box without any configuration on Salt side. Comes with an event watcher TUI.
https://kpetremann.github.io/salt-exporter/
MIT License
30 stars 8 forks source link

Schedule advanced success check #40

Closed kpetremann closed 1 year ago

kpetremann commented 1 year ago

Due to a Salt inconsistency, a failing scheduled job can report to be successful.

For a Scheduled Job, sometimes a failing jobs can have either:

The most precise way to know the real status is to parse the "result" field in Event.Return, meaning get the "result" boolean provided in each function of the state.

For example, if we have the given state:

  dummy test:
    test.nop:
      - name: "nop"

  success:
    test.succeed_with_changes:
      - name: "success"

  failed:
    test.fail_with_changes:
      - name: "failed"

We get the "result", which is a boolean, for the dummy test, success and failed. If one of them returns "false", we consider the state failed.