fixes
This commit is contained in:
parent
3f16e88bab
commit
eabab7fec7
14
Dockerfile
14
Dockerfile
|
@ -19,6 +19,7 @@ ENV NAGIOS_PHP_TIMEZONE UTC
|
|||
ENV NAGIOS_TARBALL http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.7.tar.gz
|
||||
ENV NAGIOS_PLUGINS_TARBALL http://www.nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
|
||||
ENV NAGIOS_NRPE_TARBALL http://kent.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
|
||||
ENV NAGIOS_NSCA_TARBALL http://prdownloads.sourceforge.net/sourceforge/nagios/nsca-2.7.2.tar.gz
|
||||
# Using manual: https://raymii.org/s/tutorials/Nagios_Core_4_Installation_on_Ubuntu_12.04.html
|
||||
|
||||
|
||||
|
@ -30,6 +31,7 @@ RUN useradd -u 3000 -g nagios -G www-data -m -s /bin/bash nagios
|
|||
# Install nagios
|
||||
RUN mkdir -p /usr/local/src/nagios4
|
||||
RUN cd /usr/local/src/nagios4 && wget $NAGIOS_TARBALL -O- | tar -zxp --strip-components 1 && ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagios && make all && make install install-init install-config install-commandmode
|
||||
RUN ln -s /usr/local/nagios/etc /etc/nagios
|
||||
|
||||
# Install nagios plugins
|
||||
RUN mkdir -p /usr/local/src/nagios4-plugins
|
||||
|
@ -37,7 +39,12 @@ RUN cd /usr/local/src/nagios4-plugins && wget $NAGIOS_PLUGINS_TARBALL -O- | tar
|
|||
|
||||
# Install nagios NRPE
|
||||
RUN mkdir -p /usr/local/src/nagios4-nrpe
|
||||
RUN cd /usr/local/src/nagios4-nrpe && wget $NAGIOS_NRPE_TARBALL -O- | tar -zxp --strip-components 1 && ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu && make all && make install
|
||||
RUN cd /usr/local/src/nagios4-nrpe && wget $NAGIOS_NRPE_TARBALL -O- | tar -zxp --strip-components 1 && ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu && make all && make install install-plugin install-daemon install-daemon-config
|
||||
|
||||
# Install nagios NSCA
|
||||
RUN mkdir -p /usr/local/src/nagios4-nsca
|
||||
RUN cd /usr/local/src/nagios4-nsca && wget $NAGIOS_NSCA_TARBALL -O- | tar -zxp --strip-components 1 && ./configure --with-nsca-user=nagios --with-nsca-grp=nagios && make all
|
||||
RUN cd /usr/local/src/nagios4-nsca && cp sample-config/nsca.cfg sample-config/send_nsca.cfg /etc/nagios/ && cp src/send_nsca src/nsca /usr/local/bin/
|
||||
|
||||
# Clean-up
|
||||
RUN rm -rf /usr/local/src/nagios*
|
||||
|
@ -55,6 +62,7 @@ RUN php5enmod custom
|
|||
ADD conf/apache2-site.conf /etc/apache2/sites-available/nagios.conf
|
||||
RUN a2dissite 000-default
|
||||
RUN a2ensite nagios
|
||||
RUN a2enmod cgi
|
||||
|
||||
# Configure: supervisor
|
||||
ADD conf/supervisor-all.conf /etc/supervisor/conf.d/
|
||||
|
@ -63,9 +71,10 @@ ADD conf/supervisor-all.conf /etc/supervisor/conf.d/
|
|||
|
||||
|
||||
# Configure: nagios
|
||||
RUN ln -s /usr/local/nagios/etc /etc/nagios
|
||||
RUN bash -c 'mkdir -p /etc/nagios/conf.d /etc/nagios/conf.d/{hosts,services,timeperiods,templates,hostgroups,servicegroups,contacts}'
|
||||
|
||||
RUN echo 'cfg_dir=/etc/nagios/conf.d/' >> /etc/nagios/nagios.cfg
|
||||
RUN sed -i 's~^url_html_path=.*~url_html_path=/~' /etc/nagios/cgi.cfg
|
||||
|
||||
|
||||
|
||||
|
@ -79,6 +88,7 @@ ADD run.sh /root/run.sh
|
|||
VOLUME ["/etc/nagios/", "/usr/local/nagios/var/"]
|
||||
EXPOSE 80
|
||||
EXPOSE 5666
|
||||
EXPOSE 5667
|
||||
|
||||
CMD ["/root/run.sh"]
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ Contains:
|
|||
* Nagios Core
|
||||
* Nagios Plugins
|
||||
* Nagios NPRE (Remote Plugin Execution)
|
||||
* Nagios NSCA (passive checks)
|
||||
* Apache
|
||||
* PHP
|
||||
|
||||
|
@ -17,14 +18,15 @@ Exports
|
|||
|
||||
* Nginx on `80`
|
||||
* Nagios NRPE on `5666`
|
||||
* Nagios NSCA on `5667`
|
||||
* `/etc/nagios`: configuration
|
||||
* `/usr/local/nagios/var/`: nagios runtime
|
||||
|
||||
Variables
|
||||
---------
|
||||
|
||||
* `NAGIOS_USER=nagios`: Web UI username
|
||||
* `NAGIOS_PASS=nagios`: Web UI password
|
||||
* `NAGIOS_USER=nagiosadmin`: Web UI username
|
||||
* `NAGIOS_PASS=nagiosadmin`: Web UI password
|
||||
|
||||
Constants in Dockerfile
|
||||
-----------------------
|
||||
|
@ -33,6 +35,7 @@ Constants in Dockerfile
|
|||
* `NAGIOS_TARBALL`: Nagios tarball URL
|
||||
* `NAGIOS_PLUGINS_TARBALL`: Nagios Plugins tarball URL
|
||||
* `NAGIOS_NRPE_TARBALL`: Nagios NRPE tarball URL
|
||||
* `NAGIOS_NSCA_TARBALL`: Nagios NSCA tarball URL
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
DocumentRoot /usr/local/nagios/share/
|
||||
|
||||
ScriptAlias /cgi-bin/ /usr/local/nagios/sbin/
|
||||
ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
|
||||
<Directory /usr/local/nagios/sbin/>
|
||||
Options +ExecCGI
|
||||
</Directory>
|
||||
|
||||
<DirectoryMatch (/usr/local/nagios/share/|/usr/local/nagios/sbin/|/usr/local/nagios/share/stylesheets)>
|
||||
<DirectoryMatch (/usr/local/nagios/share/|/usr/local/nagios/sbin/)>
|
||||
Options FollowSymLinks
|
||||
|
||||
DirectoryIndex index.php index.html
|
||||
|
|
|
@ -8,3 +8,7 @@ command = /bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -D
|
|||
[program:nagios]
|
||||
user = nagios
|
||||
command = /usr/local/nagios/bin/nagios /etc/nagios/nagios.cfg
|
||||
|
||||
[program:nsca]
|
||||
user = nagios
|
||||
command = /usr/local/bin/nsca -c /etc/nagios/nsca.cfg
|
||||
|
|
4
run.sh
4
run.sh
|
@ -2,8 +2,8 @@
|
|||
set -eu # exit on error or undefined variable
|
||||
|
||||
# Variables
|
||||
export NAGIOS_USER=${NAGIOS_USER:-"nagios"}
|
||||
export NAGIOS_PASS=${NAGIOS_PASS:-"nagios"}
|
||||
export NAGIOS_USER=${NAGIOS_USER:-"nagiosadmin"}
|
||||
export NAGIOS_PASS=${NAGIOS_PASS:-"nagiosadmin"}
|
||||
|
||||
# Templating
|
||||
htpasswd -cb /etc/nagios/htpasswd.users $NAGIOS_USER $NAGIOS_PASS
|
||||
|
|
Loading…
Reference in New Issue