Zabbix on a docker container (Inside CoreOS) .. setup log

このエントリーをはてなブックマークに追加
はてなブックマーク - Zabbix on a docker container (Inside CoreOS) ..  setup log
Share on Facebook
Post to Google Buzz
Bookmark this on Yahoo Bookmark
Bookmark this on Livedoor Clip
Share on FriendFeed

  • CoreOS:607.0.0 (/etc/os-release)
  • Docker:version 1.5.0, build a8a31ef-dirty
  • Image:phusion/baseimage   0.9.16
  • Zabbix 2.4
core@coreos0 ~ $ docker run -itd --name zabbix -p 8081:80 phusion/baseimage:latest /bin/bash
58e286c670b84e57ecb6eca767d061f7b738940359c03cbcfe9b11f032dee4ad

core@coreos0 ~ $ docker exec -it zabbix bash

root@58e286c670b8:/# dpkg-reconfigure tzdata

Current default time zone: 'Asia/Tokyo'
Local time is now:      Sun Apr  5 11:45:31 JST 2015.
Universal Time is now:  Sun Apr  5 02:45:31 UTC 2015.

# apt-get update
# apt-get install wget
# wget http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.4-1+trusty_all.deb
# dpkg -i zabbix-release_2.4-1+trusty_all.deb
Selecting previously unselected package zabbix-release.
(Reading database ... 16802 files and directories currently installed.)
Preparing to unpack zabbix-release_2.4-1+trusty_all.deb ...
Unpacking zabbix-release (2.4-1+trusty) ...
Setting up zabbix-release (2.4-1+trusty) ...

# apt-get update

# apt-get install zabbix-server-mysql zabbix-frontend-php

* Input MySQL Admin root/root
* Input for zabbix-server-mysql root/root
* 途中アボートするので、MySQLを手動で立ち上げ(service mysql start)て、retry

root@58e286c670b8:/etc/apache2/conf-available# cd
root@58e286c670b8:~# ls -ltr /etc/apache2/conf-available/
total 24
-rw-r--r-- 1 root root 2190 Jan 3 2014 security.conf
-rw-r--r-- 1 root root 189 Jan 3 2014 other-vhosts-access-log.conf
-rw-r--r-- 1 root root 3224 Jan 3 2014 localized-error-pages.conf
-rw-r--r-- 1 root root 315 Jan 3 2014 charset.conf
-rw-r--r-- 1 root root 455 Jan 7 2014 serve-cgi-bin.conf
lrwxrwxrwx 1 root root 23 Apr 5 02:15 zabbix.conf -> /etc/zabbix/apache.conf

-rw-r--r-- 1 root root 2190 Jan 3 2014 security.conf
-rw-r--r-- 1 root root 189 Jan 3 2014 other-vhosts-access-log.conf
-rw-r--r-- 1 root root 3224 Jan 3 2014 localized-error-pages.conf
-rw-r--r-- 1 root root 315 Jan 3 2014 charset.conf
-rw-r--r-- 1 root root 455 Jan 7 2014 serve-cgi-bin.conf
lrwxrwxrwx 1 root root 23 Apr 5 02:15 zabbix.conf -> /etc/zabbix/apache.conf
root@58e286c670b8:/etc/apache2/conf-available# more zabbix.conf
# Define /zabbix alias, this is the default
<IfModule mod_alias.c>
Alias /zabbix /usr/share/zabbix
</IfModule>

<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone Asia/Tokyo
</Directory>

<Directory "/usr/share/zabbix/conf">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>

<Directory "/usr/share/zabbix/api">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>

<Directory "/usr/share/zabbix/include">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>

<Directory "/usr/share/zabbix/include/classes">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>

service mysql start
service mysql status
service apache2 start
service apache2 status

root@58e286c670b8:~# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 02:17 ? 00:00:00 /bin/bash
root 19 0 0 02:18 ? 00:00:00 bash
root 93 0 0 02:19 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 443 93 1 02:19 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --l
root 511 0 0 02:19 ? 00:00:00 [debian-start] <defunct>
root 649 0 1 02:19 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 653 649 0 02:19 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 654 649 0 02:19 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 655 649 0 02:19 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 656 649 0 02:19 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 657 649 0 02:19 ? 00:00:00 /usr/sbin/apache2 -k start
root 661 19 0 02:19 ? 00:00:00 ps -ef

http://coreos.tk.net:8081/
Access      http://coreos.tk.net:8081/zabbix

    • Pre-Requisites => all ok
    • DB connection => ok

Zabbix server name “empty”

  • Pre-Installation sumary
  • Install => OK => Finish

 

Login : Admin/zabbix

root@58e286c670b8:/# service zabbix-server start

ここまで、docker commit しておく

あとは、/etc/my_init.d 以下にスクリプト用意

 

::::::::::::::
01_mysqld
::::::::::::::
#!/bin/sh
exec /usr/bin/mysqld_safe > /dev/null 2>&1 &
::::::::::::::
02_apache2
::::::::::::::
#!/bin/sh
exec apache2ctl start
::::::::::::::
03_zabbix-server
::::::::::::::
#!/bin/sh
exec  /usr/sbin/zabbix_server

docker run 時に /sbin/my_init 指定してオシマイ。

UIを日本語にしたいなら、 apt-get install language-pack-ja しとく
ロケール変更は、右上のProfileから。

Back To Top