Public Repository

Last pushed: 4 months ago
Short Description
Docker Image based on CentOS Linux, running Nagios, hosted on lighttpd.
Full Description

Docker Image based on CentOS Linux, running Nagios

  • Based on CentOS Linux 7.3.1611
  • Includes confd to configure services
  • Hosted on a lighttpd server

ENV VARIABLES

NAGIOS_OBJECTS_COMMANDS

JSON formatted list of commands for Nagios to use.

Syntax:
{
    "commands": [{
        "command_name": "check-nrpe",
        "command_line": "$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666"
    }]
}

NAGIOS_OBJECTS_CONTACTS

JSON formatted list of contacts for Nagios to use, as well as notification options.

Syntax:
{
    "contacts": [{
        "contact_name": "user",
        "use": "generic-contact",
        "email": "user@demo.com",
        "service_notification_commands": "notify-service-by-email",
        "host_notification_commands": "notify-host-by-email"
    }]
}

NAGIOS_OBJECTS_CONTACTS_ADMIN_EMAIL

Admin email address for Nagios (e.g. user@demo.com)

NAGIOS_OBJECTS_SERVICES

JSON fomatted list (array) of services for nagios as well as check and notification options for them.

Syntax:
{
    "services": [{
        "host_name": "nagios_agent",
        "check_command": "check-nrpe!<IP_ADDRESS>",
        "service_description": "check-nrpe",
        "notification_interval": "30",
        "notification_period": "24x7",
        "notification_options": "w,c,r",
        "check_period": "24x7",
        "check_interval": "5",
        "retry_interval": "3",
        "max_check_attempts": "5"
    }]
}

NAGIOS_OBJECTS_HOSTS

JSON formatted list (array) of hosts, as well as check options for them.

Syntax:
{
    "hosts": [{
        "host_name": "nagios_agent",
        "address": "<IP_ADDRESS>",
        "check_command": "check-host-alive",
        "use": "linux-server",
        "max_check_attempts": "5"
    }]
}

NAGIOS_CONFIG

JSON formatted configuration options for Nagios

Syntax:
{
    "log_file": "/var/log/nagios/nagios.log"
}

NAGIOS_WEB_PASSWORD

Htpasswd fomatted password (not including the username).

Example Usage
 docker run -d --name="nagios" \
 -e NAGIOS_OBJECTS_COMMANDS='{"commands":[{"command_name": "check-nrpe", "command_line": "$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666"}]}' \
 -e NAGIOS_OBJECTS_CONTACTS='{"contacts":[{"contact_name": "John Smith", "use": "generic-contact", "email": "user@demo.com", "service_notification_commands": "notify-service-by-email", "host_notification_commands": "notify-host-by-email"}]}' \
 -e NAGIOS_OBJECTS_CONTACTS_ADMIN_EMAIL="user@demo.com", \
 -e NAGIOS_OBJECTS_SERVICES='{"services":[{"host_name": "nagios_agent", "check_command": "check-nrpe!<IP_Address>", "service_description": "check-nrpe", "notification_interval":"30","notification_period": "24x7","notification_options": "w,c,r", "check_period": "24x7", "check_interval": "5", "retry_interval": "3", "max_check_attempts": "5"}]}' \
 -e NAGIOS_OBJECTS_HOSTS='{"hosts":[{"host_name": "nagios_agent", "address": "<IP_ADDRESS>", "check_command": "check-host-alive", "use": "linux-server", "max_check_attempts": "5"}]}' \
 -e NAGIOS_CONFIG='{"log_file": "/var/log/nagios/nagios.log"}' \
 -p "81:5000" \
 insightsoftware/nagios:1.1.0

Dockerfile

FROM centos:7.3.1611

MAINTAINER Hubble Infrastructure <hubble.infrastructure@insighsoftware.com>

ENV CONFD_VERSION=0.12.0-alpha3
ENV CONFD_SHA1=437524fe3334bd9d0424ed0ece265472e789d19e

RUN yum install -y wget \
    && wget https://github.com/kelseyhightower/confd/releases/download/v$CONFD_VERSION/confd-$CONFD_VERSION-linux-amd64 -O /usr/local/bin/confd \
    && chmod +x /usr/local/bin/confd \
    && echo "$CONFD_SHA1  /usr/local/bin/confd" |  sha1sum -c - \
    && wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm \
    && rpm -ivh epel-release-7-9.noarch.rpm \
    && yum install -y nagios \
    && yum install -y nagios-plugins* \
    && rm /etc/nagios/nagios.cfg \
    && chmod +r /etc/nagios/passwd

COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
COPY ./confd /etc/confd
EXPOSE 80
ENTRYPOINT /entrypoint.sh
Docker Pull Command
Owner
insightsoftware