Public Repository

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description

FROM centos:centos6

cucumber-nagios and nrpe installs

#Base Image START

RUN yum -y update
RUN yum -y install -y git gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib zlib-devel sudo sshd nrpe
RUN yum -y groupinstall "Japanese Support"

#Base image END

#Nagios and nrpe install start
RUN useradd -s /bin/bash -d /home/nagios -m -u 1000 -G wheel nagios && echo '%wheel ALL=(ALL) NOPASSWD: /home/nagios/.rbenv/plugins/ruby-build/install.sh, /etc/init.d/nrpe restart, /etc/init.d/xinetd restart' >> /etc/sudoers.d/wheel
RUN sed -i -e "s/Defaults requiretty.*/ #Defaults requiretty/g" /etc/sudoers
RUN yum install -y epel-release
RUN yum --enablerepo=epel -y install nrpe nagios-plugins-all nagios-plugins-nrpe xinetd
RUN touch /etc/xinetd.d/nrpe
RUN yum -y -q reinstall glibc-common
RUN echo 'LC_ALL=ja_JP.UTF-8\nLANG=ja_JP.UTF-8' >> /etc/environment
RUN localedef -f UTF-8 -i ja_JP ja_JP.UTF-8
RUN service xinetd restart
RUN chown -Rf nagios:nagios /etc/nagios /usr/lib64/nagios
USER nagios
RUN cd /home/nagios
RUN export HOME=/home/nagios
RUN git clone https://github.com/sstephenson/rbenv.git /home/nagios/.rbenv
RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> /home/nagios/.bash_profile
RUN echo 'eval "$(rbenv init -)"' >> /home/nagios/.bash_profile
RUN git clone https://github.com/sstephenson/ruby-build.git $HOME/.rbenv/plugins/ruby-build
RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> $HOME/.bash_profile
RUN source $HOME/.bash_profile
RUN sudo $HOME/.rbenv/plugins/ruby-build/install.sh
ENV CONFIGURE_OPTS --disable-install-doc
ENV PATH /home/nagios/.rbenv/bin:/home/nagios/.rbenv/shims:$PATH
RUN rbenv install 1.9.3-p551
RUN rbenv global 1.9.3-p551
RUN gem install cucumber-nagios

USER root
RUN rpm -ihv http://opensource.is/repo/ok-release.rpm
RUN yum install -y epel-release
RUN yum clean all && yum -y update

#Install Nagios, adagios
RUN yum install -y http://mirror.nethserver.org/nethserver/6.5/updates/x86_64/Packages/webvirtmgr/python-django15-1.5.6-1.el6.noarch.rpm
RUN yum --enablerepo=ok-testing install -y \
pnp4nagios mk-livestatus nagios git adagios okconfig acl nagios-plugins-all \
postfix python-pip

#Install supervisor and supervisor-quick. Service restarts are painfully slow

#otherwise
RUN pip install supervisor
RUN pip install supervisor-quick

Remove cache and default passwd file

RUN rm -rf /var/cache/* /etc/nagios/passwd

Check all permissions

RUN chown -R nagios /etc/nagios/* && \
setfacl -R -m group:nagios:rwx /etc/nagios/ && \
setfacl -R -m d:group:nagios:rwx /etc/nagios/

Adagios will write to /etc/nagios/adagios, ensure directory exists and

nagios.cfg knows about it.

RUN mkdir -p /etc/nagios/adagios && \
pynag config --append cfg_dir=/etc/nagios/adagios

Status view needs broker modules livestatus and pnp4nagios, so configure nagios.cfg

RUN pynag config --append "broker_module=/usr/lib64/nagios/brokers/npcdmod.o config_file=/etc/pnp4nagios/npcd.cfg" && \
pynag config --append "broker_module=/usr/lib64/mk-livestatus/livestatus.o /var/spool/nagios/cmd/livestatus" && \
pynag config --set "process_performance_data=1"

Add nagios to apache group

RUN usermod -G apache nagios

RUN echo "Defaults:www-data !requiretty" >> /etc/sudoers
RUN echo "nagios ALL = (root) NOPASSWD: /etc/init.d/nagios" >> /etc/sudoers

CMD /bin/bash

CMD ["/usr/bin/run.sh"]

EXPOSE 80 22

VOLUME ["/etc/nagios", "/var/log/nagios", "/home/nagios"]

Docker Pull Command
Owner
dartoledo