Pull nagios image from DockerHub
$ docker pull ethnchao/nagios Build the Nagios image from github source
$ docker build -t nagios . Run Nagios with docker
$ docker run --name nagios -p 80:80 -p 3000:3000 -d ethnchao/nagios Addresses:
https://ncpa-agent-address:5693/ Nagios web login:
username: nagiosadmin
password: nagios
Grafana web login:
username: admin
password: admin
If you need to use a custom login user name and password, you can run the container with the environment variables: NAGIOSADMIN_USER andNAGIOSADMIN_PASS.
$ docker run --name nagios -p 9001:80 -p 3000:3000
-e NAGIOSADMIN_USER=john
-e NAGIOSADMIN_PASS=secret_code
-d ethnchao/nagios
In some features, such as using the Adagios - Okconfig - Install Agent, you need to configure the NRDP server address in the remote client. The IP + port of the address is also the address of the Nagios server, but when you use the Docker to run the container, Nagios Do not know what their own server address, so when we run the container, passing the server address to it.
$ docker run --name nagios -p 9001:80 -p 3000:3000 -d ethnchao/nagios --server-url http://172.17.242.190:9001 You can choose to mount additional configuration files, plugin, okconfig-example to the container, such as the additional configuration file on /data/conf, plugin on /data/plugin, okconfig-example on /data/example.
$ docker run --name nagios -p 80:80 -p 3000:3000
-v /data/conf:/usr/local/nagios/etc/mount
-v /data/plugin:/data/plugin
-v /data/example:/data/example
-d ethnchao/nagios
If you need to store the monitoring information to the MySQL database, you need to enable Ndoutils, which there are two cases:
If you already executed the Ndoutils database initialization script in the MySQL database, then run this container with option: --enable-ndo.
$ docker run --name nagios -p 80:80 -p 3000:3000
-e MYSQL_USER=nagios -e MYSQL_PASSWORD=nagios
-e MYSQL_ADDRESS=172.17.242.178 -e MYSQL_DATABASE=nagios
-d ethnchao/nagios --enable-ndo
If you did not execute the Ndoutils initalization script in the MySQL database, you can run this container with option: --enable-ndo --create-db
$ docker run --name nagios -p 80:80 -p 3000:3000
-e MYSQL_USER=nagios -e MYSQL_PASSWORD=nagios
-e MYSQL_ADDRESS=172.17.242.178 -e MYSQL_DATABASE=nagios
-d ethnchao/nagios --enable-ndo --create-db
Finally we recommend using docker-compose to run Nagios with MySQL containers, check this docker-compose.yml 。
Configuration file location Software Config file location Nagios /usr/local/nagios/etc Adagios /etc/adagios Okconfig /etc/okconfig.conf NRDP /usr/local/nrdp Graphios /etc/graphios/graphios.cfg Graphite /opt/graphite/conf/ Packages Dependency To reduce the size of the docker-image, we use the apt and pip to install a lot of packages in the same RUN instruction, each software(like adagios/nagios-plugins) only depends on some of the packages, the following records the software depends on which packages, dependencies all come from official documents of the software, some from the actual operation of the adjustment.
Nagioscore needs the following dependencies: (The software list is less than the official documents, some of the official website of the software has been dependent on each other, no need to write)
apache2
apache2-utils
autoconf
bc
build-essential
dc
gawk
gettext
gperf
libapache2-mod-php
libgd2-xpm-dev
libmcrypt-dev
libssl-dev
unzip
Nagios command: notify-by-mail
bsd-mailx The following dependencies are required for the Nagios-Plugin compilation installation:
m4
gettext
automake
autoconf
The dependencies that may be used when the Nagios plugin is running:
iputils-ping
fping
postfix
libnet-snmp-perl
smbclient
snmp
snmpd
snmp-mibs-downloader
netcat
Software installation related:
python-pip、 git、 python-dev
System services:
runit、 sudo、 parallel
The following dependencies are required for the Graphite installation:
apache2
apache2-utils
build-essential
libcairo2-dev
libffi-dev
libapache2-mod-wsgi
The following dependencies are required for the Graphios installation:
sudo The following dependencies are required for the Ndoutils installation:
mysql-client
libmysql++-dev
libmysqlclient-dev
The following dependencies are required for the Nrpe installation:
build-essential The following dependencies are required when the NRDP is running:
php7.0-xml
Content type
Image
Digest
Size
458.1 MB
Last updated
about 7 years ago
docker pull abdsrv/nagios