Closed atc0005 closed 4 years ago
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/macrolist.html#longserviceoutput
Macro Name Description $SERVICEOUTPUT$
The first line of text output from the last service check (i.e. "Ping OK"). $LONGSERVICEOUTPUT$
The full text output (aside from the first line) from the last service check.
Perhaps this would be a better fit:
type NagiosExitState struct {
LastError error
StatusCode int
ServiceOutput string
LongServiceOutput string
}
Change from earlier variation:
ServiceOutput
field instead of Message
LongServiceOutput
This allows the field names of this type to match the official docs.
I later modified the struct in the atc0005/check-cert project (not yet public, more cleanup needed) to include a field for an optional function call just before application exit. Not sure if that functionality is applicable for normal use cases.
I later modified the struct in the atc0005/check-cert project (not yet public, more cleanup needed) to include a field for an optional function call just before application exit. Not sure if that functionality is applicable for normal use cases.
I think it will be for Nagios projects that I work with, so for now I'll leave it in to see how it works in practice.
From https://github.com/atc0005/check-mail/blob/2d0f8a76772293b2a934904275b198e67287cabd/cmd/check_imap_mailbox/main.go#L38-L42:
I suspect that this can be refined further to cover additional use cases, but as of this writing I've found myself using the same type in two different projects, so it feels like a good idea to add it to this one for near-future refactoring efforts.