• 幕客老师召集小伙伴
  • 运维高手36项修炼
  • python自动化运维项目实战
  • nginx从入门到实战
  • 阿里云与Centos7实战

zabbix监控系统-安装篇

 

一、安装类型

1、源码安装

http://www.zabbix.com/download.php

 

2、zabbix模版下载

https://share.zabbix.com/

 

3、编译

./configure --prefix=/usr/local --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
./configure --prefix=/usr/local --enable-proxy --with-net-snmp --with-mysql --with-ssh2
./configure --prefix=/usr/local --enable-agent

//agent 可以不需要数据库

 

4、配置zabbix_server的数据库连接

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

 

5、启动

shell> zabbix_server
shell> zabbix_agentd
shell> zabbix_proxy

 

6、安装前端界面

1)安装支持

yum install -y php

 

yum install -y php-fpm

 

yum install -y mariadb-server

 

yum install -y mariadb-devel

 

yum install -y libxml2-devel

 

yum install -y net-snmp

 

yum install -y net-snmp-devel

 

yum install -y curl

 

yum install -y curl-devel

 

yum install -y java

 

2) Nginx

 

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

yum install -y nginx

 

3) Nginx config配置

 

server {

    listen       80;

    server_name  localhost;

 

    #charset koi8-r;

    #access_log  /var/log/nginx/host.access.log  main;

    root /usr/local/www/zabbix;

 

    location / {

        #root   /usr/share/nginx/html;

        index  index.php index.html index.htm;

    }

 

    #error_page  404              /404.html;

 

    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {

        root   /usr/share/nginx/html;

    }

 

    # proxy the PHP scripts to Apache listening on www.iaskjob.com:80

    #

    #location ~ \.php$ {

    #    proxy_pass   http://www.iaskjob.com;

    #}

 

    # pass the PHP scripts to FastCGI server listening on www.iaskjob.com:9000

    #

    location ~ \.php$ {

        fastcgi_pass   www.iaskjob.com:9000;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        fastcgi_buffer_size 128k;

        fastcgi_buffers 32 32k;

        include        fastcgi_params;

    }

 

    # deny access to .htaccess files, if Apache's document root

    # concurs with nginx's one

    #

    #location ~ /\.ht {

    #    deny  all;

    #}

}

 

4)建立程序目录

mkdir /usr/local/www/zabbix -p
cd {源码下载目录}/frontends/php
cp -a . /usr/local/www/zabbix

5)启动服务

 

php-fpm systemctl start php-fpm.service

nginx -tc /etc/nginx/nginx.conf

 

6)安装界面 

 

浏览器访问:http://192.168.6.54/setup.php

参考邀请,点击安装并初始化。

 

需要安装软件包如下:

Minimum required size of PHP post is 16M (configuration option "post_max_size").

//修改php.ini   post_max_size = 16M

Minimum required limit on execution time of PHP scripts is 300 (configuration option "max_execution_time").

//修改php.ini   max_execution_time = 300

//max_input_time = 300

Time zone for PHP is not set (configuration parameter "date.timezone").

//"date.timezone

date.timezone=Asia/Shanghai

// ntpdate ntp1.aliyun.com

At least one of MySQL, PostgreSQL, Oracle, SQLite3 or IBM DB2 should be supported.

//启动mariadb systemctl start mariadb.service

//yum install -y php-mysql

PHP bcmath extension missing (PHP configuration parameter --enable-bcmath).

// yum install -y php-bcmath

PHP mbstring extension missing (PHP configuration parameter --enable-mbstring).

// yum install -y php-mbstring

PHP gd extension missing (PHP configuration parameter --with-gd).

// yum install -y php-gd*

PHP gd PNG image support missing.

PHP gd JPEG image support missing.

PHP gd FreeType support missing.

//yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

PHP xmlwriter extension missing.

PHP xmlreader extension missing.

// yum -y install php-xml php-xmlrpc

 

7、数据库操作

//my.cnf修改数据库字符集

[mysqld]

character-set-server=utf8

 

参考官方文档:https://www.zabbix.com/documentation/current/manual/appendix/install/db_scripts

 

 

//新建数据库

MariaDB [(none)]> create database zabbix;

Query OK, 1 row affected (0.00 sec)

 

MariaDB [(none)]> grant all on zabbix.* to zabbix@'%' identified by 'zabbix'

    -> ;

Query OK, 0 rows affected (0.00 sec)

 

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

 

 

# mysql -uzabbix -p'zabbix' -hlocalhost  zabbix </opt/download/zabbix-3.2.7/database/mysql/schema.sql

root@localhost:/opt/download/zabbix-3.2.7/database

# mysql -uzabbix -p'zabbix' -hlocalhost  zabbix </opt/download/zabbix-3.2.7/database/mysql/images.sql

root@localhost:/opt/download/zabbix-3.2.7/database

# mysql -uzabbix -p'zabbix' -hlocalhost  zabbix </opt/download/zabbix-3.2.7/database/mysql/data.sql

root@localhost:/opt/download/zabbix-3.2.7/

 

 

完结

zabbix监控系统-安装篇

Pingbacks已打开。

引用地址

暂无评论

发表评论