This commit is contained in:
Mark Vartanyan 2014-06-26 19:26:28 +02:00
commit 3bc8431fb5
2 changed files with 105 additions and 0 deletions

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
# Using LTS ubuntu
FROM ubuntu:14.04
MAINTAINER "Mark Vartanyan <kolypto@gmail.com>"
# 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

73
README.md Normal file
View File

@ -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?