Tuesday, February 7, 2017

Continuous Monitoring - Configuring Nagios Server and Nagios Host in Docker Containers

DevOps:Continuous Monitoring:Nagios in Docker Containers


Install Nagio server image in docker container

Select a Nagios image -> download the image (docker pull appcontainers/Nagios) -> Create the docker container (docker run -d -it --name nagiosserver -h nagios -p 8181:80 appcontainers/Nagios) -> Configure a Nagio user in Nagios server command prompt (htpasswd -c -b /etc/nagios/passwd username password) -> Login to Nagios server from browser with the help of user created in previous step (http://localhost:8181/nagios/) ->


Install & configure a Nagios host in docker container

Download a server(ubuntu/centos) image (docker pull nuagebec/Ubuntu) -> Create the docker container (docker run -d -p 0.0.0.0:2222:22 nuagebec/Ubuntu)-> Install NRPE server plugin in the server container (sudo apt-get install nagios-nrpe-server nagios-plugins)-> Update server address and port in nrpe.cfg file (server_address=172.17.0.02, server_port=8181) ->


Configure Nagios host in Nagios server

Update server folder location in Nagios.cfg file in Nagios server (cfg_dir=/etc/nagios/servers) -> Add server folder in Nagios server (mkdir -p /etc/nagios/servers ) -> Create a configuration file in Nagios host and save in the server folder (vim /etc/nagios/servers/ubuntu_host.cfg ) ->


Test the Nagios host configuration update

Restart NRPE service server in Nagios host (service nagios-nrpe-server restart)-> Restart Nagios service in Nagios server (service nagios restart)-> Open the Nagios server browser and verify Nagios host has been added.


2 comments: