Skip to content

Commit

Permalink
readme update, added goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Panszczyk committed Jul 8, 2020
1 parent 10ba291 commit 8c1d4f7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
- arm64
goos:
- linux
- windows
- darwin

project_name: openhab_exporter

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,44 @@ Implementation in Go ready to export [Openhab](https://www.openhab.org/) metrics

Exported are metrics from items types: `Number`, `Dimmer`, `Switch`,`Contact`.

## Installation
## Example usage
Only one parameter is required `--apiurl`, which should be address of your Openhab installation.
```
-> % ./openhab_exporter --apiurl=http://192.168.0.116:8080
level=info ts=2020-07-08T15:34:45.713Z caller=main.go:42 msg="Starting openhab_exporter" version="(version=, branch=, revision=)"
level=info ts=2020-07-08T15:34:45.713Z caller=main.go:43 build_context="(go=go1.14.4, user=, date=)"
level=info ts=2020-07-08T15:34:45.879Z caller=main.go:47 msg="Listening on address" address=:9266
```

Open new terminal window and check results:
```
-> % curl -v localhost:9266/metrics
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9266 (#0)
> GET /metrics HTTP/1.1
> Host: localhost:9266
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; version=0.0.4; charset=utf-8
< Date: Wed, 08 Jul 2020 15:35:24 GMT
< Transfer-Encoding: chunked
<
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
...
# HELP openhab_item_state_current Openhab items current state
# TYPE openhab_item_state_current gauge
openhab_item_state_current{groupnames="",item="ActionsPower",label="Power on/off",tags="",type="Switch"} 0
openhab_item_state_current{groupnames="",item="AlarmAlert",label="Alarm alert",tags="",type="Switch"} 0
openhab_item_state_current{groupnames="",item="Gateway_AddDevice",label="",tags="",type="Switch"} 0
...
```

0 comments on commit 8c1d4f7

Please sign in to comment.