From 3bc8431fb5d887b506c9d2d3c643bbbbce8ed558 Mon Sep 17 00:00:00 2001 From: Mark Vartanyan Date: Thu, 26 Jun 2014 19:26:28 +0200 Subject: [PATCH] Initial --- Dockerfile | 32 ++++++++++++++++++++++++ README.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..80686c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# Using LTS ubuntu +FROM ubuntu:14.04 +MAINTAINER "Mark Vartanyan " + +# Const +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 + +# Packages: update & install +ENV DEBCONF_FRONTEND noninteractive +ENV APTGETINSTALL apt-get install -qq -y --no-install-recommends +RUN sed -i 's~.* universe$~\0 multiverse~' /etc/apt/sources.list +RUN apt-get update -qq +RUN $APTGETINSTALL python-pip supervisor build-essential +RUN $APTGETINSTALL apache2 libapache2-mod-php5 snmp-mibs-downloader +RUN $APTGETINSTALL libgd2-xpm-dev libssl-dev wget curl libnet-snmp-perl libperl5.14 libpq5 libradius1 libsensors4 libsnmp-base libsnmp15 libtalloc2 libtdb1 libwbclient0 samba-common samba-common-bin smbclient snmp whois libmysqlclient15-dev +RUN pip install j2cli + +# Users +RUN groupadd -g 3000 nagios +RUN useradd -u 3000 -g nagios -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 +# +# # Install nagios plugins +# RUN mkdir -p /usr/local/src/nagios4-plugins +# RUN cd /usr/local/src/nagios4-plugins && wget $NAGIOS_PLUGINS_TARBALL -O- | tar -zxp --strip-components 1 && ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules --enable-libtap + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..b39c41e --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +Zabbix Server & Web UI +====================== + +Contains: + +* Zabbix Server +* Zabbinx Front-end +* Nginx +* PHP + +Processes are managed by supervisor, including cronjobs + + +Exports +------- + +* Nginx on `80` +* Zabbix Server on `10051` +* `/etc/zabbix/alert.d/` for Zabbix alertscripts + +Variables +--------- + +* `ZABBIX_DB_NAME=zabbix`: Database name to work on +* `ZABBIX_DB_USER=zabbix`: MySQL user +* `ZABBIX_DB_PASS=zabbix`: MySQL password +* `ZABBIX_DB_HOST=localhost`: MySQL host to connect to +* `ZABBIX_DB_PORT=3306`: MySQL port + +* `ZABBIX_INSTALLATION_NAME=`: Zabbix installation name + +Linking: + +* `ZABBIX_DB_LINK=`: Database link name. Example: a value of "DB_PORT_3306" will fill in `ZABBIX_DB_HOST/PORT` variables + +Constants in Dockerfile +----------------------- + +* `ZABBIX_PHP_TIMEZONE=UTC`: Timezone to use with PHP + +Example +------- + +Launch database container: + + $ docker start zabbix-db || docker run --name="zabbix-db" -d -e MYSQL_ROOT_PASSWORD='root' -e MYSQL_DATABASE='zabbix' -e MYSQL_USER='zabbix' -e MYSQL_PASSWORD='zabbix' -e MYSQL_SET_KEYBUF=64M -p localhost::3306 -v /var/lib/mysql:/var/lib/mysql kolypto/mysql + +Install the required tables: + + $ docker run --rm --link zabbix-db:db -e ZABBIX_DB_LINK=DB_PORT_3306 kolypto/zabbix-server /root/run.sh setup-db + +Launch Zabbix container: + + $ docker start zabbix || docker run --name="zabbix" --link zabbix-db:db -e ZABBIX_DB_LINK=DB_PORT_3306 -p 80:80 -p 10051:10051 kolypto/zabbix-server + +By default, you sign in as Admin:zabbix. + +Enjoy! :) + +Configuration Cheat-Sheet +------------------------- + +Things to do at the beginning: + +* Administration > Users, Users: disable guest access (group), setup user accounts & themes +* Administration > Media types: set up notification methods. For custom alertscripts, see [Custom alertscripts](https://www.zabbix.com/documentation/2.4/manual/config/notifications/media/script) +* Administration > Users, Users, "Media" tab: set up notification destinations +* Configuration > Hosts: create a new host and add items, triggers & stuff + +TODO +---- + +* Create a way to set up and update alertscripts: `/etc/zabbix/alert.d/`. Git? Download? Update?