ネットワーク上にあるServerやネットワーク機器の死活監視などを行うため、Zabbixという統合監視ソフトウェアが人気のようです。
Zabbixでは、次の監視が可能になるとのことです。
- 稼動監視
- リソース監視
- アプリケーション監視
私もセットアップしたいと思い、とりあえず、vagrant環境のCentOS7へインストールしてみました!
セットアップ手順
1. Vangrant構築
> vagrant box add centOS71min https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box
> mkdir C:\vagrant\hosts\centos71_zabbix24
> cd C:\vagrant\hosts\centos71_zabbix24
> vagrant init centOS71min
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
- 作成されたVagrantfileを編集します。メモ帳などで開き、1行のコメント行を有効にします。
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10" <<< 有効化(#を削除する)
起動
> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centOS71min'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: centos71_zabbix24_default_1434
_83258
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes..
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if its present...
default: Key inserted! Disconnecting and reconnecting using new SSH
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/vagrant/hosts/centos71_zabbix24
c:\vagrant\hosts\centos71_zabbix24>
host: 127.0.0.1
port: 2222
user: vagrant
pass: vagrant
# timedatectl set-timezone Asia/Tokyo
# timedatectl
Local time: Sun 2015-06-14 19:51:49 JST
Universal time: Sun 2015-06-14 10:51:49 UTC
RTC time: Sun 2015-06-14 10:51:48
Timezone: Asia/Tokyo (JST, +0900)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
4.各種パッケージのアップデート
# yum -y update
# vi /etc/selinux/config
# systemctl list-unit-files | grep firewall
firewalld.service enabled
# systemctl disable firewalld.service
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
# systemctl list-unit-files | grep firewall
firewalld.service disabled
7. Zabbix SIAのリポジトリ登録
# yum install http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
8. Zabbix関連のパッケージインストール
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese zabbix-agent
:
Installed:
zabbix-agent.x86_64 0:2.4.5-1.el7
zabbix-server-mysql.x86_64 0:2.4.5-1.el7
zabbix-web-japanese.noarch 0:2.4.5-1.el7
zabbix-web-mysql.noarch 0:2.4.5-1.el7
Dependency Installed:
OpenIPMI-libs.x86_64 0:2.0.19-11.el7
OpenIPMI-modalias.x86_64 0:2.0.19-11.el7
apr.x86_64 0:1.4.8-3.el7
apr-util.x86_64 0:1.5.2-6.el7
dejavu-fonts-common.noarch 0:2.33-6.el7
dejavu-sans-fonts.noarch 0:2.33-6.el7
fontpackages-filesystem.noarch 0:1.44-8.el7
fping.x86_64 0:3.10-1.el7
freetype.x86_64 0:2.4.11-10.el7_1.1
httpd.x86_64 0:2.4.6-31.el7.centos
httpd-tools.x86_64 0:2.4.6-31.el7.centos
iksemel.x86_64 0:1.4-2.el7.centos
libX11.x86_64 0:1.6.0-2.1.el7
libX11-common.noarch 0:1.6.0-2.1.el7
libXau.x86_64 0:1.0.8-2.1.el7
libXpm.x86_64 0:3.5.10-5.1.el7
libjpeg-turbo.x86_64 0:1.2.90-5.el7
libpng.x86_64 2:1.5.13-5.el7
libtool-ltdl.x86_64 0:2.4.2-20.el7
libxcb.x86_64 0:1.9-5.el7
libxslt.x86_64 0:1.1.28-5.el7
libzip.x86_64 0:0.10.1-8.el7
lm_sensors-libs.x86_64 0:3.3.4-11.el7
mailcap.noarch 0:2.1.41-2.el7
mariadb-libs.x86_64 1:5.5.41-2.el7_0
net-snmp.x86_64 1:5.7.2-20.el7
net-snmp-agent-libs.x86_64 1:5.7.2-20.el7
net-snmp-libs.x86_64 1:5.7.2-20.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7
php.x86_64 0:5.4.16-23.el7_0.3
php-bcmath.x86_64 0:5.4.16-23.el7_0.3
php-cli.x86_64 0:5.4.16-23.el7_0.3
php-common.x86_64 0:5.4.16-23.el7_0.3
php-gd.x86_64 0:5.4.16-23.el7_0.3
php-mbstring.x86_64 0:5.4.16-23.el7_0.3
php-mysql.x86_64 0:5.4.16-23.el7_0.3
php-pdo.x86_64 0:5.4.16-23.el7_0.3
php-xml.x86_64 0:5.4.16-23.el7_0.3
t1lib.x86_64 0:5.1.2-14.el7
unixODBC.x86_64 0:2.3.1-10.el7
vlgothic-p-fonts.noarch 0:20130607-2.el7
zabbix.x86_64 0:2.4.5-1.el7
zabbix-server.x86_64 0:2.4.5-1.el7
zabbix-web.noarch 0:2.4.5-1.el7
# yum install mariadb-server
:
Installed:
mariadb-server.x86_64 1:5.5.41-2.el7_0
Dependency Installed:
mariadb.x86_64 1:5.5.41-2.el7_0
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-5.el7
perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
# vi /etc/my.cnf.d/server.cnf
[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
skip-character-set-client-handshake
innodb_file_per_table
# systemctl start mariadb
# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
# mysql -uroot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix' ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
# mysql -uroot zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/schema.sql
# mysql -uroot zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/images.sql
# mysql -uroot zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/data.sql
11. Zabbix設定ファイル更新
# vi /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
12. ZabbixのWebインターフェース用設定ファイル更新
# vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Tokyo
13. 各種デーモン起動
# systemctl start zabbix-server
Job for zabbix-server.service failed. See 'systemctl status zabbix-server.service' and 'journalctl -xn' for details.
失敗しました!
こちらのサイトを参考にさせてもらいました。
# rpm -Uvh https://kojipkgs.fedoraproject.org/packages/trousers/0.3.11.2/3.fc20/x86_64/trousers-0.3.11.2-3.fc20.x86_64.rpm
Retrieving https://kojipkgs.fedoraproject.org/packages/trousers/0.3.11.2/3.fc20/x86_64/trousers-0.3.11.2-3.fc20.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:trousers-0.3.11.2-3.fc20 ################################# [ 50%]
Cleaning up / removing...
2:trousers-0.3.11.2-3.el7 ################################# [100%]
# systemctl restart zabbix-server
# systemctl start zabbix-agent
# systemctl start httpd
# systemctl enable zabbix-server
# systemctl enable zabbix-agent
# systemctl enable httpd
14. Webコンソールへアクセス
- Version2.4の導入前に、2.2を入れたためにキャッシュが残っていたので、画面は「Welcome to Zabbix 2.2」となっていますw
これでセットアップは完了です!
http://192.168.33.10/zabbix/ へアクセスできるようになりました!!!
参考にさせていただいたサイト
TNKの気になること: ZabbixをCentOS 7にインストール
qiita.comCentOS7にZabbix2.2をインストール - Qiita