Skip to content

Commit cfcbfcb

Browse files
authored
Merge pull request #17 from atc0005/i16-restore-original-plugin-status-output-format
Update status output to match original plugin
2 parents 37b3e93 + d330ef1 commit cfcbfcb

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

CHANGELOG.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ The following types of changes will be recorded in this file:
2626

2727
- placeholder
2828

29+
## [v0.1.2] - 2020-02-06
30+
31+
### Fixed
32+
33+
- Update status output to reflect the same format used in the original Python
34+
2 plugin.
35+
- For reasons I've yet to spend sufficient time to figure out, the
36+
double-quoting used for elements of the "folders" list is lost when sent
37+
by Teams or email notifications. It is easier to go ahead and just revert
38+
the format for now so it is consistent in each format (console, Teams or
39+
email).
40+
2941
## [v0.1.1] - 2020-02-06
3042

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

60-
[Unreleased]: https://github.com/atc0005/check-mail/compare/v0.1.1...HEAD
72+
[Unreleased]: https://github.com/atc0005/check-mail/compare/v0.1.2...HEAD
73+
[v0.1.2]: https://github.com/atc0005/check-mail/releases/tag/v0.1.2
6174
[v0.1.1]: https://github.com/atc0005/check-mail/releases/tag/v0.1.1
6275
[v0.1.0]: https://github.com/atc0005/check-mail/releases/tag/v0.1.0

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ required via `stdout`.
130130

131131
```ShellSession
132132
$ /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
133-
OK: tacotuesdays@example.com: No messages found in folders: ["Inbox" "Junk Email"]
133+
OK: tacotuesdays@example.com: No messages found in folders: Inbox, Junk Email
134134
```
135135

136136
### Output

config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (i *multiValueFlag) String() string {
2828
return ""
2929
}
3030

31-
return strings.Join(*i, ",")
31+
return strings.Join(*i, ", ")
3232
}
3333

3434
// Set is called once by the flag package, in command line order, for each

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ func main() {
309309
// Give the all clear: no mail was found
310310
log.Debug().Msg("No messages found to report")
311311
nagiosExitState.LastError = nil
312-
nagiosExitState.Message = fmt.Sprintf("OK: %s: No messages found in folders: %q",
312+
nagiosExitState.Message = fmt.Sprintf("OK: %s: No messages found in folders: %s",
313313
config.Username,
314-
config.Folders,
314+
config.Folders.String(),
315315
)
316316
nagiosExitState.StatusCode = nagios.StateOK
317317

0 commit comments

Comments
 (0)