LoginSignup
3
4

More than 5 years have passed since last update.

Zabbix 2.2 インストール(CentOS 7.X)

Last updated at Posted at 2015-08-20

1、事前準備

■作業権限の確認
管理者権限(root)ユーザーでログイン

■以下のファイルが指定の場所に配置されているかを確認
# cd /tmp
# ls -l zabbix-release-2.2-1.el7.noarch.rpm
# ls -l RPM-GPG-KEY-ZABBIX

※以下から落としておく
http://repo.zabbix.com/zabbix/2.2/rhel/7/x86_64/zabbix-release-2.2-1.el7.noarch.rpm

◇事前確認
# yum info
※yum を使用しネットワーク環境からパッケージを取得できるか確認

# getenforce
※SELinux は無効化か
※SELinux が起動している場合は以下
# setenforce 0
# vi /etc/selinux/config

/etc/selinux/config
SELINUX=enforcing
↓
SELINUX=disabled

# systemctl status firewalld
※firewalled は無効化されているか
※firewalled が起動している場合は以下
# systemctl stop firewalld
# systemctl disable firewalld

2、パッケージ入れる

# cd /tmp
# rpm --import RPM-GPG-KEY-ZABBIX
# rpm -ihv zabbix-release-2.2-1.el7.noarch.rpm
# echo 'exclude=gnutls' >> /etc/yum.conf

# yum -y install mariadb mariadb-server mariadb-devel mariadb-libs
# yum -y install zabbix zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql \
zabbix-web-japanese zabbix-agent zabbix-java-gateway zabbix-get

3、MariaDB設定

■構成ファイルの編集
# cd /etc
# cp -p my.cnf my.cnf.org
# vi my.cnf

以下の様に編集

/etc/my.cnf
[mysqld] 
↓↓追記 
character-set-server=utf8 
skip-character-set-client-handshake 
innodb_buffer_pool_size = XXG 
innodb_log_files_in_group = 2 
innodb_log_file_size = 128M 
max_allowed_packet=16M 
innodb_file_per_table 
log-error=/var/log/mariadb/mariadb.log 

innodb_flush_log_at_trx_commit = 2 
↑↑ここまで 

[mysqld_safe] 
log-error=/var/log/mariadb/mariadb.log 
pid-file=/var/run/mariadb/mariadb.pid 

↓↓以下追記 
[mysqldump] 
socket=/var/lib/mysql/mysql.sock 
max_allowed_packet=16M 

[client] 
socket=/var/lib/mysql/mysql.sock 
↑↑ここまで 

■MariaDB起動 及び 自動起動設定
# systemctl start mariadb
# systemctl status mariadb
# systemctl enable mariadb
# systemctl is-enabled mariadb

■DBの作成
# mysqladmin -uroot create zabbix --default-character-set=utf8

■DBアカウント作成
# mysql -uroot
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbixpassword';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> quit

■ZABBIXの初期データベースをインポート
# cd /usr/share/doc/`rpm -qa | grep zabbix-server-mysql|cut -d"-" -f1,2,3,4`/create
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql

4、httpd基本設定 apache起動

# cd /etc/httpd/conf
# cp -p httpd.conf httpd.conf.org
# vi httpd.conf

以下を追記

/etc/httpd/conf/httpd.conf
ServerName <ホスト名FQDN>
ServerTokens Prod
ServerSignature Off
TraceEnable off

■httpd起動 及び 自動起動設定
# systemctl start httpd
# systemctl status httpd
# systemctl enable httpd
# systemctl is-enabled httpd

5、snmptrapd設定

#cd /etc/snmp
#vi snmptrapd.conf

以下の様に追記

/etc/snmp/snmptrapd.conf
authCommunity log,execute,net <CommunityName>
perl do "/usr/sbin/snmptthandler-embedded";

■snmptrapd起動 及び 自動起動設定
# systemctl start snmptrapd
# systemctl status snmptrapd
# systemctl enable snmptrapd
# systemctl is-enabled snmptrapd

6、zabbix_server設定

# cd /etc/zabbix
# cp -p zabbix_server.conf zabbix_server.conf.org22
# vi zabbix_server.conf

/etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbixpassword
SNMPTrapperFile=/var/log/snmptt/snmptt.log
StartSNMPTrapper=1
ListenIP=0.0.0.0
Timeout=30

■zabbix_server起動 及び 自動起動設定
# systemctl start zabbix-server
# systemctl status zabbix-server
# systemctl enable zabbix-server
# systemctl is-enabled zabbix-server

7、管理画面の設定

■メインページの表示
# cd /etc/httpd/conf.d
# vi zabbix.conf

以下の様に編集

/etc/httpd/conf.d/zabbix.conf
# Zabbix monitoring system php web frontend
#

Alias /zabbix /usr/share/zabbix

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Require all granted

    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">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
    Require all denied
</Directory>

■index 画面変更
# cd /etc/zabbix/web
# vi zabbix.conf.php

/etc/zabbix/web/zabbix.conf.php
---- 以下をべた貼り --------------------------------
<?php
// Zabbix GUI configuration file
global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'localhost';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'zabbixpassword';

// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'localhost';
$ZBX_SERVER_PORT = '10051';
exec("uname -n", \$UNAME);
$ZBX_SERVER_NAME  = $UNAME[0];

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>

# systemctl reload httpd

■Zabbix GUI にアクセス

http://<ZabbixサーバIPアドレス>/zabbix/
ユーザー名:admin
パスワード:zabbix

※ 正常に表示されることを確認する。

おしまい

3
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4