zabbix3.0 on CentOS7

11856 단어 zabbix

목적



Centos7에 Zabbix3.0 설치

환경


  • AWS (검증 용이므로 낮은 사양 유형 사용)
  • EC2:t2.nano
  • gp2:8GB

  • RDS:db.t2.micro
  • gp2 : 30GB> 이론 값으로 90IOPS


  • CentOS Linux release 7.2.1511 (Core)
  • zabbix-server-mysql-3.0.1-1.el7.x86_64

  • 설정



    CentOS


    $ sudo localectl set-locale LANG=ja_JP.utf8
    $ localectl status
       System Locale: LANG=ja_JP.utf8
           VC Keymap: us
          X11 Layout: us
    
    $ timedatectl list-timezones | grep Tokyo
    Asia/Tokyo
    $ sudo timedatectl set-timezone Asia/Tokyo
    $ timedatectl status
    
    $ hostnamectl set-hostname <hostname>
    
    $ sudo useradd <user>
    $ sudo passwd <user>
    $ sudo usermod -G wheel <user>
    $ cat /etc/group
    (snip)
    wheel:x:10:centos,<user>
    (snip)
    
    $ sudo visudo
    (snip)
    ## Allows people in group wheel to run all commands
    %wheel   ALL=(ALL)       ALL
    (snip)
    

    /etc/login.defs
    (snip)
    #Only wheelgroup can login
    SU_WHEEL_ONLY        yes
    (snip)
    

    /etc/pam.d/su
    #アンコメントしてgroup=wheelを記述
    
    #%PAM-1.0
    auth            sufficient      pam_rootok.so
    # Uncomment the following line to implicitly trust users in the "wheel" group.
    #auth           sufficient      pam_wheel.so trust use_uid
    # Uncomment the following line to require a user to be in the "wheel" group.
    auth            required        pam_wheel.so use_uid group=wheel
    auth            substack        system-auth
    auth            include         postlogin
    account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
    account         include         system-auth
    password        include         system-auth
    session         include         system-auth
    session         include         postlogin
    session         optional        pam_xauth.so
    


    zabbix3.0



    MySQL 리포지토리


  • mariadb를 사용하지 않으므로 제거
  • $ sudo yum list installed | grep maria
    mariadb-libs.x86_64                        1:5.5.47-1.el7_2            @updates
    $ sudo yum remove mariadb-libs.x86_64
    
  • MySQL Repositories 등록
  • $ wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
    $ sudo rpm -Uvh mysql57-community-release-el7-7.noarch.rpm
    $ sudo yum install mysql-community-client
    

    RDS



  • 서버에 접속하는 밸러미터 그룹의 파라미터 편집으로 로그 취득할 수 있도록 플래그 1을 세운다
  • slow_query_log
  • general_log


  • zabbix 프런트 엔드의 일본어 문자 화 대책으로서 명시적으로 utf8로 한다
  • character_set_database
  • character_set_server

  • 확인
  • mysql> show variables like 'character_set%';
    +--------------------------+-------------------------------------------+
    | Variable_name            | Value                                     |
    +--------------------------+-------------------------------------------+
    | character_set_client     | utf8                                      |
    | character_set_connection | utf8                                      |
    | character_set_database   | utf8                                      |
    | character_set_filesystem | binary                                    |
    | character_set_results    | utf8                                      |
    | character_set_server     | utf8                                      |
    | character_set_system     | utf8                                      |
    | character_sets_dir       | /rdsdbbin/mysql-5.7.10.R1/share/charsets/ |
    +--------------------------+-------------------------------------------+
    8 rows in set (0.10 sec)
    
    mysql> 
    

    zabbix-server


  • 리포지토리 등록 및 설치
  • $ sudo rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
    $ sudo yum install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese zabbix-agent zabbix-get
    
  • 초기 스키마와 데이터 가져 오기 (2 시스템과 약간 다른 방법)
  • $ cd /usr/share/doc/zabbix-server-mysql-3.0.1
    $ zcat create.sql.gz | mysql -h <rds-endpoint> <db> -u <user> -p
    
  • zabbix-server.conf (dbname, dbuser는 기본 zabbix이므로 변경 없음)

  • /etc/zabbix/zabbix_server.conf
    82a83,84
    > DBHost=<rds-endpoint>
    > 
    115a118,119
    > 
    > DBPassword=<rds-password>
    
  • 여기에 정의 된 값을/etc/php.ini에 적용

  • /etc/httpd/conf.d/zabbix.conf
    (snip)
    <Directory "/usr/share/zabbix">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
    
        <IfModule mod_php5.c>
            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 always_populate_raw_post_data -1
            # php_value date.timezone Europe/Riga
        </IfModule>
    </Directory>
    (snip)
    

    /etc/php.ini
    384c384
    < max_execution_time = 30
    ---
    > max_execution_time = 300
    394c394
    < max_input_time = 30
    ---
    > max_input_time = 300
    698c698
    < ; always_populate_raw_post_data = On
    ---
    > always_populate_raw_post_data = -1
    878c878
    < ; date.timezone = Europe/Riga
    ---
    > date.timezone = Asia/Tokyo
    
  • zabbix-agent.conf

  • /etc/zabbix/zabbix_agentd.conf
    96a97
    >
    104a106,107
    > ListenPort=10050
    >
    147c150
    < Hostname=Zabbix server
    ---
    > #Hostname=Zabbix server
    155c158
    < # HostnameItem=system.hostname
    ---
    > HostnameItem=system.hostname
    
  • Apache

  • /var/www
    $ sudo ln -s /usr/share/zabbix zabbix
    

    /etc/httpd/conf/httpd.conf
    119c119
    < DocumentRoot "/var/www/html"
    ---
    > DocumentRoot "/var/www/zabbix"
    125c125
    <     AllowOverride None
    ---
    >     AllowOverride All
    131c131
    < <Directory "/var/www/html">
    ---
    > <Directory "/var/www/zabbix">
    144c144
    <     Options Indexes FollowSymLinks
    ---
    >     Options FollowSymLinks
    151c151
    <     AllowOverride None
    ---
    >     AllowOverride All
    
  • 프런트 엔드
  • $ sudo systemctl enable httpd.service && sudo systemctl enable zabbix-server.service && sudo systemctl enable zabbix-agent.service
    $ sudo systemctl start httpd && sudo systemctl start zabbix-server && sudo systemctl start zabbix-agent
    















    좋은 웹페이지 즐겨찾기