2024-07-19 23:50:50 +02:00
|
|
|
package plugin // import nocternity.net/gomonop/pkg/plugin
|
2021-01-03 10:33:21 +01:00
|
|
|
|
2024-07-20 00:20:28 +02:00
|
|
|
import "nocternity.net/gomonop/pkg/results"
|
2021-02-19 12:47:00 +01:00
|
|
|
|
2024-07-20 00:20:28 +02:00
|
|
|
// Plugin represents the interface to a monitoring plugin.
|
|
|
|
type Plugin interface {
|
|
|
|
// Results accesses the results of the monitoring plugin.
|
|
|
|
Results() *results.Results
|
2021-01-03 10:33:21 +01:00
|
|
|
|
2024-07-20 00:20:28 +02:00
|
|
|
// CheckArguments ensures that the arguments that were passed to the plugin
|
|
|
|
// actually make sense. Errors should be stored in the plugin's results.
|
|
|
|
CheckArguments() bool
|
2024-07-19 22:01:34 +02:00
|
|
|
|
2024-07-20 00:20:28 +02:00
|
|
|
// RunCheck actually runs whatever checks are implemented by the plugin and
|
|
|
|
// updates the results accordingly.
|
|
|
|
RunCheck()
|
2021-01-03 10:33:21 +01:00
|
|
|
}
|
|
|
|
|
2024-07-20 00:20:28 +02:00
|
|
|
// Builder is a function that can be called in order to instantiate a plugin.
|
|
|
|
type Builder func() Plugin
|