Giter VIP home page Giter VIP logo

docker-nagios's Introduction

Build Status

Docker-Nagios provide Nagios service running on the docker container and a series of solution for Nagios: Adagios for Web Based Nagios Configuration, Grafana for monitor metric & dashboards, Ndoutils for transfer monitor data to MySQL Database, NCPA&NRDP for nagios passive checks.

As the docker-image contains a large number of software, the following describes the various components of the version and the basic information:

  • phusion/baseimage:latest Docker baseimage
  • Nagios Core 4.4.6 Nagios core - the community version
  • Nagios Plugins 2.2.1 Nagios plugins
  • Graphios 2.0.3 Send Nagios spool data to graphite
  • Graphite 1.1.3 Grafana's datasource
  • Grafana 5.1.3 The tool for beautiful monitoring and metric analytics & dashboards for Graphite, InfluxDB & Prometheus & More
  • NDOUtils 2.1.3 Allow you save all the data to MySQL database
  • PyNag 0.9.1-1 A command line tool for managing nagios configuration and provides a framework to write plugins
  • Okconfig 1.3.2-1 Provides a templated Nagios configuration, Adagios can use okconfig to quickly and easily configure Nagios
  • MK-livestatus 1.2.8p20 MK-livestatus can get Nagios status information, loaded as broker module into Nagios configuration, and Adagios uses mk-livestatus to get status information
  • Adagios 1.6.3-2 A web based Nagios configuration interface built to be simple and intuitive in design, exposing less of the clutter under the hood of nagios. Adagios is more lighter UI than Check_MK, based on mod_wsgi(so it cannot be used with Check_MK, Check_MK based on mod_python, already deprecated and conflict with mod_wsgi)
  • NRDP 1.5.2 A flexible data transport mechanism and processor for Nagios. It uses standard ports protocols (HTTP(S) and XML for api response) and can be implemented as a replacement for NSCA. Used with NCPA, omg, those bloody names(nrpe,ncpa,nrds,nrdp,nsti...).
  • NCPA 2.1.3 The Nagios Cross-Platform Agent; a single monitoring agent that installs on all major operating systems. NCPA with a built-in web GUI, we will use ncpa for passive checks.

Quick start

Ad-hoc run nagios in docker.

$ docker run --name nagios -p 80:80 -p 3000:3000 -d ethnchao/nagios

Accessing nagios and Adagios:

If you need to use a custom login user name and password, you can run the container with the environment variables: NAGIOSADMIN_USER and NAGIOSADMIN_PASS.

$ docker run --name nagios -p 9001:80 -p 3000:3000 \
  -e NAGIOSADMIN_USER=john \
  -e NAGIOSADMIN_PASS=secret_code \
  -d ethnchao/nagios

Run with docker-compose

We recommend that you use docker-compose to run Nagios with MySQL containers, check this docker-compose.yml

Setting advertise address

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

Store data files in local

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

Store monitoring data in MySQL

If you need to store the monitoring information in MySQL database, you need to enable Ndoutils, which there are two cases:

  1. 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
  1. 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

Setting E-Mail

By setting heirloom-mailx, you'll be able to send email with s-nail command in nagios/adagios interface.

  1. Set /etc/s-nail.rc, adding these line:
set [email protected]
set smtp=smtps://demo.com:465
set [email protected]
set smtp-auth-password=your-email-password
set smtp-auth=login

Build from source

Build the Nagios image from github source.

$ docker build -t nagios .

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-pipgitpython-dev

System services:

runitsudoparallel

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

docker-nagios's People

Contributors

ethnchao avatar miqueet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-nagios's Issues

Add environment variables for UID/GID when running docker as non-root user

When running docker as a non-root users, docker will still by default create files as uid/gid 0, which means these files cannot be accessed without superuser privilege. Please add a couple of environment variables, e.g. VUID/VGID, so that files created by docker can be created using a different uid/gid.

Container won't start

Hi there - this looks like an extremely useful image: just what I was looking for. However, I'm getting:

 * Starting Grafana Server
   ...done.
Starting nagios: done.
Started runsvdir, PID is 135
Error processing config file '/usr/local/nagios/etc/ndo2db.cfg'.

on start. Have I missed configuration step?

Many thanks.

Persisting a new contact in mysql

I started the container with --enable-ndo --create-db, so the database were created. After that I started only with --enable-ndo and created a new contact, checked and the contact was there in mysql, but when I restarted the container, the contact wasn't there. I don't know if this is an issue with this container or with the mysql container used by your container.

Objects with okconfig. Where are they written?

I am trying to figure this out. I will go in a clean installation add hosts using okconfig. The hosts are visible in adagios, in nagios, and in okconfig, but I cannot figure out where they are being written. I need to have access to those files to be able to backup. I am not using ndo-utils. I have searched up and down the file system of the container and I cannot find any of the files generated. Please help.

how to use grafana

hi,

can someone please tell me, how i can use grafana with this build ?
i see that´s enabled, I can call the dashboard, but there is nothing configured and I don´t know what needs to be changed.
is grafana used here to show something that is stored in the MySQL database ??

thanks for any help!

Creating a new contact

After creating a contact, the file appears inside the directory but is not inserted in the database, showing an error message . If I changed the admin email, the value is changed correctly.

Sending E-Mail

When I use the option "Send out mail for selected items" to send a manual notification email, this dont work, the api request response 200 but the mail never go out, no error. Just "mail sent!".

Also, ..I was thinking in add ssmtp server (https://wiki.archlinux.org/index.php/SSMTP) to allow use gmail, sendgrid, aws ses, etc... to send email notifications.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.