NETWAYS/go-check

[Feature Request] Generic output formatting with global format parameter

Opened this issue · 5 comments

Idea

Implement the output generating code in a way to have one or multiple parameters to specify the output formatting as a whole.

For example, some monitoring systems still use a single line as output, one might want to have output fitting on a pager or, and this is speculation for the future, properly machine readable output might be a thing.

Ideally, in the end I can do something like this:

# my_check --foo bar
[OK] all ok
  \_ [OK] bar

# my_check --foo bar --output one-line
[OK] all ok - [OK] bar


# my_check --foo bar --output whatever
ok - all ok : ok - bar

I'm not sure if this is something the downstream code should handle or not. Might be too prescriptive.

This would also depend on how this lib is used. E.g when out config module is not used and people use their own CLI libs.

You are right, my idea was more in the direction of having a parameter for overall.GetOutput or somewhere to say: I want to have Icingaweb output format ([OK] and such things are nicely formatted there) or one line output (might be better for naemon/zabbix and similar systems.

Additional idea: sorting the subchecks by criticality to put the worst one at the top

@RincewindsHat you mean for the Overall?

jup, mainly, also this could/should be applied to the printing of the subchecks too.