Nagios Core monitoring service built under Alpine for multiple platforms
9.6K
Nagios Core monitoring service built under Alpine for multiple platforms
This is Nagios Core 4.x and the primary plugins, served by nginx in an efficient Alpine image. Here in this codebase find an example docker-compose.yml which will launch 3 services: this instantlinux/nagios image, the NagiosQL image and another nginx server which provides SSL termination. To round out the monitoring solution, this setup is compatible with the free easyNag mobile app.
To support plugins that you might want to add as a volume-mount, the image includes bash, the mariadb client, perl, python3, samba client, and sudo.
Steps:
docker-compose upThis will generate a nagios.cfg.proto; it will be copied to /etc/nagios/nagios.cfg only the first time the volume is mounted, after which you will have to edit it manually.
If version 4.4.7 won't start due to segfault, see note below for nagios.cfg workaround.
Note: if using NagiosQL for the first time, manual edits of nagios.cfg plus cleaning up distributed files (e.g. printer.cfg, windows.cfg) will most likely be required before nagios configuration check passes.
This will run under docker-compose or kubernetes using the bridge network; if you need to use certain plugins like check_dhcp which require direct host network, use the NGINX_PORT parameter to override the default port 80 to specify port (or ip:port if desired).
This repo has complete instructions for building a kubernetes cluster where you can deploy kubernetes.yaml using make and customizing Makefile.vars after cloning this repo:
git clone https://github.com/instantlinux/docker-tools.git
cd docker-tools/k8s
make nagios
Tips:
| Variable | Default | Description |
|---|---|---|
| ADMIN_PATH | /opt | Path on localhost (for adding local plugins, etc) |
| AUTHORIZED_USERS | nagiosadmin | List of users |
| CONFIG_CHECK | yes | Whether to halt on startup if config-check fails |
| HTPASSWD_SECRETNAME | nagios-htpasswd | Secret holding basic-auth user/passwords |
| MAIL_RELAY_HOST | smtp:25 | FQDN and port of SMTP relay |
| MAIL_RELAY_SECRETNAME | nagios-mail-secret | Name of secret containing mail password |
| MAIL_RELAY_USER | Auth for SMTP relay provider | |
| MAIL_USE_TLS | yes | Whether to encrypt with TLS and STARTTLS |
| NAGIOS_MAIL_RELAY | smtp | DNS name for nagios email sending |
| NAGIOS_FQDN | nagios.docker | server_name for nginx |
| NGINX_PORT | 80 | listen port (or ip:port) for nginx |
| PERF_ENABLE | yes | Whether to generate performance logs |
| TZ | UTC | local timezone |
Mount these path names to persistent storage:
| Path | Description |
|---|---|
| /etc/nagios | Configuration, as managed by NagiosQL |
| /opt/nagios/plugins | Any custom ($USER2$) plugins you want to add |
| /var/nagios | Logs and status |
Some other important path names are:
| Path | Description |
|---|---|
| /usr/lib/nagios/plugins | System plugins ($USER1$) |
Note for version 4.4.7: there is a bug (issue #861) which causes segfault on startup. Make sure to set check_for_updates=0 in the nagios.cfg file mounted to /etc/nagios.
| Secret | Description |
|---|---|
| nagios-htpasswd | Web UI basic-auth passwords |
| nagios-mail-secret | Auth secret for smtp provider |
This is almost-but-not-quite compatible (minus nagiosgraph) with the jasonriver/nagios image previously used by the services here. Here's what you need to know if you want to use this in place of that image:
sed -i -e 's:/opt/nagios/etc:/etc/nagios:' \
-e 's:/opt/nagios/var:/var/nagios:' nagios.cfg
sed -i -e 's:/opt/nagios/etc:/etc/nagios:' cgi.cfg
sed -i -e 's:/opt/nagios/libexec:/usr/lib/nagios/plugins:' resource.cfg
If you want to make improvements to this image, see CONTRIBUTING.
If you want nagiosgraph or other features added, please submit an issue with suggestions on implementation.
Content type
Image
Digest
sha256:a1eaa1621…
Size
85 MB
Last updated
17 days ago
docker pull instantlinux/nagios