Fork of JasonRivers image to incorporate various improvements.
50K+
A fork of JasonRivers' Docker Nagios imageâ that pulls in fixes from the open pull requests on his repo, along with other updates and quality-of-life improvements.
Listed here to give the original authors credit for their work.
Things that I have changed/updated/added to date:
check_mysql and check_mysql_query, kept check_radius working on Ubuntu 26.04, and fixed check_game not being builtNAGIOSADMIN_USER full admin access in the web interfaceNAGIOS_TIMEZONE and NAGIOS_FQDN at startup instead of at build timeNagios Core running on Ubuntu 26.04 LTS with NagiosGraph, NRPE, NCPA, NSCA and NagiosTV.
| Product | Version |
|---|---|
| Nagios Coreâ | 4.5.14 |
| Nagios Pluginsâ | 2.5 |
| NRPEâ | 4.1.3 |
| NCPAâ | 3.5.0 |
| NSCAâ | 2.10.3 |
| NagiosTVâ | 0.9.11 |
All of the standard Nagios Plugins are included, plus the extras listed under Extra Pluginsâ .
Note
`check_radius` is the one exception: Nagios Plugins can't build it on Ubuntu 26.04, so the image includes Ubuntu's build of it from the sister project, Monitoring Plugins, instead. See [Using check_radius](#-using-check_radius) to set it up.
/opt/nagios/etc/opt/nagiosgraph/etc/opt/Custom-Nagios-Plugins (use this path in your command definitions)The images are available on Docker Hubâ and the GitHub Container Registryâ :
docker pull tronyx/nagios
docker pull ghcr.io/tronyx/nagios
| Branch | Image Tag | Notes |
|---|---|---|
| Master | latest, master, master-<nagios version> | Stable. |
| Develop | develop, develop-<nagios version> | My testing/development branch for updates. |
I occasionally create other branches for testing, such as for a new Ubuntu LTS release, but these two are the main ones.
To try it out with the example configuration:
docker run --name nagios -p 8080:80 tronyx/nagios
Tip
Then open `http://localhost:8080/nagios/` and log in as `nagiosadmin`, using the password from the container log (see [Credentials](#-credentials)).
To keep your configuration and data outside the container, mount host directories:
docker run --name nagios \
-v /path/to/nagios/etc:/opt/nagios/etc \
-v /path/to/nagios/var:/opt/nagios/var \
-v /path/to/custom-plugins:/opt/Custom-Nagios-Plugins \
-v /path/to/nagiosgraph/etc:/opt/nagiosgraph/etc \
-v /path/to/nagiosgraph/var:/opt/nagiosgraph/var \
-p 8080:80 tronyx/nagios
Empty directories are filled with the default configuration on first start, and the Nagios and NagiosGraph directories are handed to the container's nagios user (UID/GID 5000) on every start.
A few more options:
tronyx/nagios with ghcr.io/tronyx/nagios.-p 5667:5667.The included docker-compose.ymlâ uses named volumes by default, with a commented-out bind mount alternative and examples for setting the admin password:
docker compose up -d
| Variable | Description |
|---|---|
MAIL_RELAY_HOST | Postfix relay host for outgoing mail. Include the port if it isn't 25, e.g. smtp.example.com:587 |
MAIL_RELAY_USERNAME | Username for the relay host (requires MAIL_RELAY_HOST). Setting it also forces TLS to the relay |
MAIL_RELAY_PASSWORD | Password for the relay host |
MAIL_INET_PROTOCOLS | Postfix's inet_protocols setting, e.g. ipv4 |
NAGIOS_FQDN | The server's fully qualified domain name, used by Postfix and as Apache's ServerName (default nagios.example.com) |
NAGIOS_TIMEZONE | Timezone (default UTC). Written to nagios.cfg on every start, so it overrides any use_timezone you set there |
NAGIOSADMIN_USER | Web interface admin username (default nagiosadmin). Only used on first start |
NAGIOSADMIN_PASS | Web interface admin password. Only used on first start, and has no default (see Credentialsâ ) |
NAGIOSADMIN_PASS_FILE | Path to a file containing the admin password, such as a Docker secret. Takes precedence over NAGIOSADMIN_PASS |
Important
There's no default password. If you don't set one, a random password is generated on first start and printed in the container log.
On first start, the login for NAGIOSADMIN_USER (default nagiosadmin) gets its password from the first of these that's set:
NAGIOSADMIN_PASS_FILENAGIOSADMIN_PASS$ docker logs nagios 2>&1 | grep 'Generated password'
Generated password for nagiosadmin: ddUoZ0rcvn4qe6sbami72LGTVnk3vt
With Docker Compose, a secret keeps the password out of the container's environment, where docker inspect would show it:
services:
nagios:
environment:
NAGIOSADMIN_PASS_FILE: /run/secrets/nagiosadmin_pass
secrets:
- nagiosadmin_pass
secrets:
nagiosadmin_pass:
file: ./nagiosadmin_pass.txt
Note
These settings are only read when `/opt/nagios/etc/htpasswd.users` doesn't exist yet, such as on a fresh volume. Changing them later has no effect, so existing installs keep their current password.
To change the password later (it prompts for the new one):
docker exec -it nagios htpasswd -B /opt/nagios/etc/htpasswd.users nagiosadmin
This also upgrades a password set by an older version of the image to the stronger bcrypt format.
check_radius comes from Ubuntu's Monitoring Plugins package, built against radcliâ , because Nagios Plugins can't build it on Ubuntu 26.04. It takes the same options as before, but needs a radcli configuration listing your RADIUS servers. Copy the default one into your etc volume once:
docker exec nagios sh -c 'cp -r /etc/radcli /opt/nagios/etc/radcli && sed -i "s|/etc/radcli/|/opt/nagios/etc/radcli/|" /opt/nagios/etc/radcli/radiusclient.conf && chown -R nagios:nagios /opt/nagios/etc/radcli && chmod 600 /opt/nagios/etc/radcli/servers'
Then add your servers and shared secrets to /opt/nagios/etc/radcli/servers, and pass -F /opt/nagios/etc/radcli/radiusclient.conf to check_radius.
Warning
The container serves plain HTTP on port 80, and the web interface uses Basic authentication, which sends your password with every request. If it's reachable from anywhere other than a trusted local network, put it behind a reverse proxy that handles TLS, such as Traefik, nginx, Caddy or SWAG.
When setting up the proxy:
https://nagios.example.com/, not a sub-path. Nagios, NagiosGraph and NagiosTV use the absolute paths /nagios/, /cgi-bin/ and /nagiostv/.NAGIOS_FQDN to that hostname.The image's Docker health check reports healthy when Apache is answering requests and Nagios is running. It doesn't log in, so it works whatever password you set.
| Name/Link | Description |
|---|---|
| Nagios NRPEâ | Remotely execute Nagios plugins on other Linux/Unix machines |
| Nagios NCPAâ | Cross-platform monitoring agent |
| Nagios NSCAâ | Integrate passive alerts and checks from remote machines and applications |
| NagiosGraphâ | Graphs performance data from your checks, shown as popups for hosts and services |
| JR-Nagios-Pluginsâ | Custom plugins from Jason Rivers |
| WL-Nagios-Pluginsâ | Custom plugins from William Leibzon |
| JE-Nagios-Pluginsâ | Custom plugins from Justin Ellison |
| DF-Nagios-Pluginsâ | Custom plugins from Dan Fruehauf (check_sql, check_jenkins, check_vpn) |
| check_mssql_collectionâ | MSSQL database and server checks from Nagios Enterprises |
| check_nwc_healthâ | Network component (switch, router, firewall) checks from Gerhard Lausser |
| check_apc.plâ | APC UPS checks via SNMP |
| QStatâ | Game server status query tool, installed at /usr/local/bin/qstat and used by the check_game plugin |
| check-mqttâ | MQTT broker checks from Jan-Piet Mens |
| NagiosTVâ | Monitor your Nagios server on a wall-mounted TV |
Every upstream source is pinned to an exact version: git repositories to a commit (the *_COMMIT build args), the Ubuntu base image to a digest (BASE_IMAGE), and downloaded files to a SHA-256 checksum. Tagged releases are also checked at build time, so the build fails if a tag has been moved.
git, curl and docker buildx. It updates both Dockerfiles and summarises what changed; review the diff before committing. The update-pins workflow runs it every other week and opens a pull request against develop.*_VERSION build arg (e.g. NAGIOS_VERSION) in both Dockerfiles, then run the script to update its commit and checksums.build.yml) and hadolint, shellcheck and actionlint (in lint.yml) are pinned by hand, and the script doesn't update them. Bump them now and then.scripts/smoke-test.sh <image> starts the image and checks logins, the web interface, key plugins, file permissions and a clean shutdown. CI runs it on every build before anything is published.Note
GitHub only runs scheduled and manually triggered workflows from the default branch, so `update-pins` starts working once it's on `master`; until then, run the script by hand. It also needs "Allow GitHub Actions to create and approve pull requests" enabled under Settings â Actions â General.
Content type
Image
Digest
sha256:06b860c8aâĻ
Size
177.2 MB
Last updated
7 days ago
docker pull tronyx/nagios