Skip to content

Commit

Permalink
Merge pull request #17 from atc0005/i16-restore-original-plugin-statu…
Browse files Browse the repository at this point in the history
…s-output-format

Update status output to match original plugin
  • Loading branch information
atc0005 authored Feb 6, 2020
2 parents 37b3e93 + d330ef1 commit cfcbfcb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ The following types of changes will be recorded in this file:

- placeholder

## [v0.1.2] - 2020-02-06

### Fixed

- Update status output to reflect the same format used in the original Python
2 plugin.
- For reasons I've yet to spend sufficient time to figure out, the
double-quoting used for elements of the "folders" list is lost when sent
by Teams or email notifications. It is easier to go ahead and just revert
the format for now so it is consistent in each format (console, Teams or
email).

## [v0.1.1] - 2020-02-06

### Fixed
Expand Down Expand Up @@ -57,6 +69,7 @@ monitor mail-related resources.
- TLS/SSL IMAP4 connectivity via `emerson/go-imap` package
- Go modules (vs classic `GOPATH` setup)

[Unreleased]: https://github.com/atc0005/check-mail/compare/v0.1.1...HEAD
[Unreleased]: https://github.com/atc0005/check-mail/compare/v0.1.2...HEAD
[v0.1.2]: https://github.com/atc0005/check-mail/releases/tag/v0.1.2
[v0.1.1]: https://github.com/atc0005/check-mail/releases/tag/v0.1.1
[v0.1.0]: https://github.com/atc0005/check-mail/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ required via `stdout`.

```ShellSession
$ /usr/lib/nagios/plugins/check_imap_mailbox -folders "Inbox, Junk Email" -server imap.example.com -username "tacotuesdays@example.com" -port 993 -password "coconuts" -log-level disabled
OK: tacotuesdays@example.com: No messages found in folders: ["Inbox" "Junk Email"]
OK: tacotuesdays@example.com: No messages found in folders: Inbox, Junk Email
```

### Output
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (i *multiValueFlag) String() string {
return ""
}

return strings.Join(*i, ",")
return strings.Join(*i, ", ")
}

// Set is called once by the flag package, in command line order, for each
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ func main() {
// Give the all clear: no mail was found
log.Debug().Msg("No messages found to report")
nagiosExitState.LastError = nil
nagiosExitState.Message = fmt.Sprintf("OK: %s: No messages found in folders: %q",
nagiosExitState.Message = fmt.Sprintf("OK: %s: No messages found in folders: %s",
config.Username,
config.Folders,
config.Folders.String(),
)
nagiosExitState.StatusCode = nagios.StateOK

Expand Down

0 comments on commit cfcbfcb

Please sign in to comment.