Skip to content

Commit

Permalink
Merge pull request #41 from wbollock/ci/docker
Browse files Browse the repository at this point in the history
ci: publish dockerimage
  • Loading branch information
wbollock authored Mar 8, 2023
2 parents bad7b23 + 2074bc5 commit 74a5edb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
32 changes: 26 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ builds:
ldflags:
- -X main.Version={{.Version}} -X main.Commit={{.Commit}} -X main.BuildDate={{ .CommitDate }}
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else if eq .Arch "darwin" }}Darwin
{{- else if eq .Arch "linux" }}Linux
{{- else if eq .Arch "windows" }}Windows
{{- else }}{{ .Arch }}{{ end }}
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -32,6 +35,23 @@ changelog:
exclude:
- '^docs:'
- '^test:'
dockers:
# build latest and specific tag version images
- image_templates:
- "ghcr.io/wbollock/{{.ProjectName}}:{{ .Tag }}"
- "ghcr.io/wbollock/{{.ProjectName}}:latest"
goos: linux
goarch: amd64
use: docker
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/wbollock/nagios_exporter"
- "--label=org.opencontainers.image.description='A Prometheus Exporter for Nagios'"
- "--label=org.opencontainers.image.licenses=MIT"
nfpms:
- id: default
formats:
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# taken from https://github.com/prometheus/haproxy_exporter/blob/d4aba878f043fd3ad0bcacd0149e7d75e67c0faa/Dockerfile
ARG ARCH="amd64"
ARG OS="linux"
# they don't tag versions only latest
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
# https://github.com/prometheus/busybox
LABEL maintainer="Will Bollock <[email protected]>"

COPY nagios_exporter /bin/nagios_exporter

EXPOSE 9927
USER nobody
ENTRYPOINT [ "/bin/nagios_exporter" ]
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This exporter does not output Nagios check results as Prometheus metrics; it is
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Debian/RPM package](#debianrpm-package)
- [Docker](#docker)
- [Binary](#binary)
- [Source](#source)
- [Configuration](#configuration)
Expand Down Expand Up @@ -59,6 +60,17 @@ wget https://github.com/wbollock/nagios_exporter/releases/download/v{{ version }
{dpkg,rpm} -i prometheus-nagios-exporter_{{ version }}_linux_amd64.{deb,rpm}
```

### Docker

Populate `config.toml` with your `APIKey = NagiosXIAPIKey`

```console
sudo docker run \
-v ./config.toml:/etc/prometheus-nagios-exporter/config.toml \
ghcr.io/wbollock/nagios_exporter \
--nagios.scrape-uri http://localhost
```

### Binary

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

0 comments on commit 74a5edb

Please sign in to comment.