No description
Find a file
2021-10-12 09:15:41 +03:00
.github Support multiple architecture selection in bug report template. 2021-08-24 08:38:24 +03:00
overlay Add the ability to override default timezone inside the container and Nagios (#11) 2020-03-01 14:01:59 +02:00
CHANGELOG.md Release build 7. 2021-08-24 09:10:22 +03:00
Dockerfile Progress build label to 7. 2021-10-12 09:15:41 +03:00
README.md Release build 4. 2021-04-20 22:19:58 +03:00

Docker Nagios

Docker image for Nagios, the Industry Standard In IT Infrastructure Monitoring. Nagios Core is running on Alpine Linux, using Apache HTTP as a web server and sSMTP as mail agent for email notifications.

The image is inspired by JasonRivers/Docker-Nagios image (Kudos to Jason!) but follows a different approach targetted to lightweight size and basic features.

Build Status: build status badge Docker pulls badge Docker stars badge

Quick reference

For more information about the image versions you may refer to the CHANGELOG

Running

Run with the example configuration with the following:

docker run --name nagios -p 0.0.0.0:8080:80 manios/nagios:latest

alternatively you can use external Nagios configuration & log data with the following:

docker run --name nagios  \
  -v /path-to-nagios/etc/:/opt/nagios/etc/ \
  -v /path-to-nagios/var:/opt/nagios/var/ \
  -v /path-to-nagios/ssmtp.conf:/etc/ssmtp/ssmtp.conf \
  -v /path-to-custom-plugins:/opt/Custom-Nagios-Plugins \
  -p 0.0.0.0:8080:80 \
  manios/nagios:latest

Notes:

  1. The container populates with default configuration files if the configuration directories are empty.
  2. The path for the custom plugins will be /opt/Custom-Nagios-Plugins, you will need to reference this directory in your configuration scripts.
  3. In order to receive mail notifications, you have to configure SSMTP. You can find example configuration in docker-nagios.

For best results your Nagios container should have access to both IPv4 & IPv6 networks

Credentials

The default credentials for the web interface is nagiosadmin / nagios. However you can define your own credentials by overriding NAGIOSADMIN_USER and NAGIOSADMIN_PASS when you run the container. For example:

docker run --name nagios  \
  -e NAGIOSADMIN_USER="godmode" \
  -e NAGIOSADMIN_PASS="super-Duper-Secret!" \
  -p 0.0.0.0:8080:80 \
  manios/nagios:latest

Timezones

By default the Alpine container and Nagios both use UTC. In order to change the timezone we can pass the tz timezone database name as an environmental variable in docker run such as:

docker run -e "TZ=Europe/Athens" manios/nagios:latest

This will configure and use globally "Europe/Athens" in both container and Nagios process.

Flavours

This Docker image is designed with optimising resources usage in mind and is build for multiple hardware architectures. The following matrix can be used to determine if your hardware architecture is supported:

Hardware Image OS/Arch
PC (32bit) linux/386
PC (64bit) linux/amd64
Raspberry Pi 1 linux/arm/v6
Raspberry Pi 2 linux/arm/v7
Raspberry Pi 3 linux/arm/v7
Raspberry Pi 4 linux/arm/v7 or linux/arm64

Test configuration

To check if your Nagios configuration is OK, you can run the following while your container is running. We assume that you use /opt/nagios/etc/nagios.cfg as your main configuration file.

docker exec -it mynagioscontainer bin/nagios -v etc/nagios.cfg

Troubleshooting

My image does not run on Raspberry Pi

As already mentioned in #17, sometimes, because docker manifest related features are still experimental (after 2+ years of their introduction) it has happened when we tested in Raspberry Pi 1 (arm-v6) and Raspberry Pi 3 (arm-v7) that it does not download the arm image but the amd64.

Thus you can define explicitly which architecture to pull:

docker pull --platform=linux/arm/v6 manios/nagios
# or
docker pull --platform=linux/arm/v7 manios/nagios

and it works. Be advised that the --platform switch requires that you enable the Docker Experimental Features.