Skip to content

Commit 74a5edb

Browse files
authored
Merge pull request #41 from wbollock/ci/docker
ci: publish dockerimage
2 parents bad7b23 + 2074bc5 commit 74a5edb

File tree

3 files changed

+52
-7
lines changed

3 files changed

+52
-7
lines changed

.goreleaser.yaml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ builds:
1616
ldflags:
1717
- -X main.Version={{.Version}} -X main.Commit={{.Commit}} -X main.BuildDate={{ .CommitDate }}
1818
archives:
19-
- replacements:
20-
darwin: Darwin
21-
linux: Linux
22-
windows: Windows
23-
386: i386
24-
amd64: x86_64
19+
- name_template: >-
20+
{{ .ProjectName }}_
21+
{{- title .Os }}_
22+
{{- if eq .Arch "amd64" }}x86_64
23+
{{- else if eq .Arch "386" }}i386
24+
{{- else if eq .Arch "darwin" }}Darwin
25+
{{- else if eq .Arch "linux" }}Linux
26+
{{- else if eq .Arch "windows" }}Windows
27+
{{- else }}{{ .Arch }}{{ end }}
2528
checksum:
2629
name_template: 'checksums.txt'
2730
snapshot:
@@ -32,6 +35,23 @@ changelog:
3235
exclude:
3336
- '^docs:'
3437
- '^test:'
38+
dockers:
39+
# build latest and specific tag version images
40+
- image_templates:
41+
- "ghcr.io/wbollock/{{.ProjectName}}:{{ .Tag }}"
42+
- "ghcr.io/wbollock/{{.ProjectName}}:latest"
43+
goos: linux
44+
goarch: amd64
45+
use: docker
46+
build_flag_templates:
47+
- "--pull"
48+
- "--label=org.opencontainers.image.created={{.Date}}"
49+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
50+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
51+
- "--label=org.opencontainers.image.version={{.Version}}"
52+
- "--label=org.opencontainers.image.source=https://github.com/wbollock/nagios_exporter"
53+
- "--label=org.opencontainers.image.description='A Prometheus Exporter for Nagios'"
54+
- "--label=org.opencontainers.image.licenses=MIT"
3555
nfpms:
3656
- id: default
3757
formats:

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# taken from https://github.com/prometheus/haproxy_exporter/blob/d4aba878f043fd3ad0bcacd0149e7d75e67c0faa/Dockerfile
2+
ARG ARCH="amd64"
3+
ARG OS="linux"
4+
# they don't tag versions only latest
5+
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
6+
# https://github.com/prometheus/busybox
7+
LABEL maintainer="Will Bollock <wbollock@gmail.com>"
8+
9+
COPY nagios_exporter /bin/nagios_exporter
10+
11+
EXPOSE 9927
12+
USER nobody
13+
ENTRYPOINT [ "/bin/nagios_exporter" ]

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This exporter does not output Nagios check results as Prometheus metrics; it is
3232
- [Table of Contents](#table-of-contents)
3333
- [Installation](#installation)
3434
- [Debian/RPM package](#debianrpm-package)
35+
- [Docker](#docker)
3536
- [Binary](#binary)
3637
- [Source](#source)
3738
- [Configuration](#configuration)
@@ -59,6 +60,17 @@ wget https://github.com/wbollock/nagios_exporter/releases/download/v{{ version }
5960
{dpkg,rpm} -i prometheus-nagios-exporter_{{ version }}_linux_amd64.{deb,rpm}
6061
```
6162

63+
### Docker
64+
65+
Populate `config.toml` with your `APIKey = NagiosXIAPIKey`
66+
67+
```console
68+
sudo docker run \
69+
-v ./config.toml:/etc/prometheus-nagios-exporter/config.toml \
70+
ghcr.io/wbollock/nagios_exporter \
71+
--nagios.scrape-uri http://localhost
72+
```
73+
6274
### Binary
6375

6476
```bash
@@ -108,7 +120,7 @@ To see all available configuration flags:
108120
| `---config.path` | Configuration file path, only for API key | /etc/prometheus-nagios-exporter/config.toml ||
109121
| `--log.level` | Minimum log level like "debug" or "info" | info ||
110122
| `--nagios.check-updates` | Enable optional `nagios_update_available_info` metric | false ||
111-
| `--nagios.config_path` | Nagios configuration path for use with nagiostats binary | `/usr/local/nagios/etc/nagios.cfg ` ||
123+
| `--nagios.config_path` | Nagios configuration path for use with nagiostats binary | `/usr/local/nagios/etc/nagios.cfg` ||
112124
| `--nagios.scrape-uri` | Nagios application address to scrape | `http://localhost ` ||
113125
| `--nagios.ssl-verify` | SSL certificate validation | false ||
114126
| `--nagios.stats_binary` | Path of nagiostats binary and configuration (e.g `/usr/local/nagios/bin/nagiostats`) | ||

0 commit comments

Comments
 (0)