aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-10-09 17:43:35 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2019-10-09 17:43:35 +0300
commit11bdce3bc880f7b21c2aff6945673f9bfa7409db (patch)
tree3df5069080285718a13b47e023f9419f67843e9b
parent79b0eb417b0431e316964e003a9efe6b6725b94a (diff)
downloadcertmon-11bdce3bc880f7b21c2aff6945673f9bfa7409db.tar.gz
certmon-11bdce3bc880f7b21c2aff6945673f9bfa7409db.tar.bz2
Add Makefile
-rw-r--r--Makefile18
-rw-r--r--certmon.go7
2 files changed, 24 insertions, 1 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0daf0c1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,18 @@
+PREFIX = /usr/local
+BINDIR = $(PREFIX)/bin
+
+all:
+ @go build -o certmon certmon.go
+
+clean:
+ @go clean
+
+install:
+ @GOBIN=$$(if test -n "$(NAGIOS_CONF)" && \
+ test -f "$(NAGIOS_CONF)/resource.cfg"; \
+ then \
+ sed -n '/^\$$USER1\$$=/s///p' $$NAGIOS_CONF; \
+ else \
+ echo $(BINDIR); \
+ fi) \
+ go install .
diff --git a/certmon.go b/certmon.go
index 155ff0f..36a520d 100644
--- a/certmon.go
+++ b/certmon.go
@@ -149,13 +149,18 @@ func (res CertResult) FormatPerfData() {
int(res.Ttl.Seconds()),
int(warnLimit.Seconds()),
int(critLimit.Seconds()))
}
func (rl CertResultList) Format() {
- //'label'=value[UOM];[warn];[crit];[min];[max]
+ // For details about Nagios plugin output format, refer to:
+ // https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/pluginapi.html
+ // and
+ // https://nagios-plugins.org/doc/guidelines.html
+ // In particular, performance data format is:
+ // 'label'=value[UOM];[warn];[crit];[min];[max]
fmt.Printf("%s - %s ", statusString[rl.Status], rl.Address)
rl.Result[0].FormatHR()
fmt.Printf(" | ")
rl.Result[0].FormatPerfData()
if len(rl.Result) > 1 {
for _, res := range rl.Result[1:] {

Return to:

Send suggestions and report system problems to the System administrator.