refactor: make internals easier to test and add unit tests #2
2 changed files with 19 additions and 18 deletions
|
@ -11,24 +11,6 @@ import (
|
|||
"nocternity.net/gomonop/pkg/perfdata"
|
||||
)
|
||||
|
||||
// Status represents the return status of the monitoring plugin. The
|
||||
// corresponding integer value will be used as the program's exit code,
|
||||
// to be interpreted by the monitoring system.
|
||||
type Status int
|
||||
|
||||
// Plugin exit statuses.
|
||||
const (
|
||||
OK Status = iota
|
||||
WARNING
|
||||
CRITICAL
|
||||
UNKNOWN
|
||||
)
|
||||
|
||||
// String representations of the plugin statuses.
|
||||
func (s Status) String() string {
|
||||
return [...]string{"OK", "WARNING", "ERROR", "UNKNOWN"}[s]
|
||||
}
|
||||
|
||||
// Plugin represents the monitoring plugin's state, including its name,
|
||||
// return status and message, additional lines of text, and performance
|
||||
// data to be encoded in the output.
|
||||
|
|
19
pkg/plugin/status.go
Normal file
19
pkg/plugin/status.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package plugin // import nocternity.net/gomonop/pkg/perfdata
|
||||
|
||||
// Status represents the return status of the monitoring plugin. The
|
||||
// corresponding integer value will be used as the program's exit code,
|
||||
// to be interpreted by the monitoring system.
|
||||
type Status int
|
||||
|
||||
// Plugin exit statuses.
|
||||
const (
|
||||
OK Status = iota
|
||||
WARNING
|
||||
CRITICAL
|
||||
UNKNOWN
|
||||
)
|
||||
|
||||
// String representations of the plugin statuses.
|
||||
func (s Status) String() string {
|
||||
return [...]string{"OK", "WARNING", "ERROR", "UNKNOWN"}[s]
|
||||
}
|
Loading…
Reference in a new issue