Skip to content

Commit

Permalink
output metrics in influxdb line protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
danielb42 committed Aug 5, 2020
1 parent ea6249e commit 2a6aedb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
Binary file removed artifacts/sensu-webwhois_v1.2.4_linux_amd64.tar.gz
Binary file not shown.
1 change: 0 additions & 1 deletion artifacts/sensu-webwhois_v1.2.4_sha512_checksums.txt

This file was deleted.

Binary file not shown.
1 change: 1 addition & 0 deletions artifacts/sensu-webwhois_v2.0.0_sha512_checksums.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bccfa992c122981f5613c8bbb64e1b391377ace4baf21e1f94b06c08b774c244b6c06347f70ced74a2af33d574a1889f8c0df64229fe19d06f038af2e2ce7a55 sensu-webwhois_v2.0.0_linux_amd64.tar.gz
Binary file modified bin/sensu-webwhois
Binary file not shown.
19 changes: 13 additions & 6 deletions cmd/sensu-webwhois/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ func main() {

if strings.Contains(string(bodyBytes), stringToLookFor) {
log.Printf("OK: webwhois output contains '%s'\n\n", stringToLookFor)
fmt.Printf("%s %d %d\n", "sensu.webwhois.registered", 1, timeBegin.Unix())
fmt.Printf("%s %d %d\n", "sensu.webwhois.duration", webwhoisResponseTime, timeBegin.Unix())
fmt.Printf("%s %d %d\n", "sensu.webwhois.responsecode", httpResp.StatusCode, timeBegin.Unix())
fmt.Printf("extmon,service=%s %s=%d,%s=%d,%s=%d %d\n",
"webwhois",
"registered", 1,
"duration", webwhoisResponseTime,
"responsecode", httpResp.StatusCode,
timeBegin.Unix())
} else {
printFailMetricsAndExit("webwhois output did not contain", "'"+stringToLookFor+"'")
}
Expand All @@ -81,9 +84,13 @@ func printFailMetricsAndExit(errors ...string) {
}

log.Printf("%s\n\n", errStr)
fmt.Printf("%s %d %d\n", "sensu.webwhois.registered", 0, timeBegin.Unix())
fmt.Printf("%s %d %d\n", "sensu.webwhois.duration", 0, timeBegin.Unix())
fmt.Printf("%s %d %d\n", "sensu.webwhois.responsecode", statusCode, timeBegin.Unix())

fmt.Printf("extmon,service=%s %s=%d,%s=%d,%s=%d %d\n",
"webwhois",
"registered", 0,
"duration", 0,
"responsecode", statusCode,
timeBegin.Unix())

os.Exit(2)
}
4 changes: 2 additions & 2 deletions sensu/asset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ api_version: core/v2
metadata:
name: sensu-webwhois
spec:
sha512: b4906a82feba9c4cb707fb23c2f1fd6bbb53a19afb33bf91a4e059a94616c7bf7fe81c4d96fffc65e6e685a15297e9973e8a05eb8259ce4d8f26188c72f4956d
url: https://github.com/DENICeG/sensu-webwhois/releases/download/v1.2.4/sensu-webwhois_v1.2.4_linux_amd64.tar.gz
sha512: bccfa992c122981f5613c8bbb64e1b391377ace4baf21e1f94b06c08b774c244b6c06347f70ced74a2af33d574a1889f8c0df64229fe19d06f038af2e2ce7a55
url: https://github.com/DENICeG/sensu-webwhois/releases/download/v2.0.0/sensu-webwhois_v2.0.0_linux_amd64.tar.gz

0 comments on commit 2a6aedb

Please sign in to comment.