《Linux运维葵花宝典---Zabbix手册》
目录
-
介绍
-
基础配置
- 高级特性
1、介绍
Zabbix 由 Alexei Vladishev 创建,目前由其成立的公司—— Zabbix SIA 积极的持续开发更新维护, 并为用户提供技术支持服务。
Zabbix 是一个企业级分布式开源监控解决方案。
Zabbix 软件能够监控众多网络参数和服务器的健康度、完整性。Zabbix 使用灵活的告警机制,允许用户为几乎任何事件配置基于邮件的告警。这样用户可以快速响应服务器问题。Zabbix 基于存储的数据提供出色的报表和数据可视化功能。这些功能使得 Zabbix 成为容量规划的理想选择。
Zabbix 支持主动轮询(polling)和被动捕获(trapping)。Zabbix所有的报表、统计数据和配置参数都可以通过基于 Web 的前端页面进行访问。基于 Web 的前端页面确保您可以在任何地方访问您监控的网络状态和服务器健康状况。适当的配置后,Zabbix 可以在监控 IT 基础设施方面发挥重要作用。无论是对于有少量服务器的小型组织,还是拥有大量服务器的大企业而言,同样适用。
Zabbix 是免费的。Zabbix 是根据 GPL 通用公共许可证的第二版编写和发布的。这意味着产品源代码是免费发布的,可供公共使用。
Zabbix公司还为全球用户提供专业的技术支持服务 。
2、配置
# apt-get install -y vim wget curl net-tools gcc build-essential bash tzdata
# ./configure --prefix=/usr/local/nginx \
--pid-path=/usr/local/nginx/nginx.pid \
--error-log-path=/usr/local/nginx/logs/error.log \
--http-log-path=/usr/local/nginx/logs/access.log \
--with-pcre=/opt/Zabbix/pcre-8.41 \
--with-zlib=/opt/Zabbix/zlib-1.2.11 \
--with-openssl=/opt/Zabbix/openssl-1.0.2m\
--with-http_ssl_module
# make -j 8 && make install
# apt-get install -y libpng12-dev autoconf libicu-dev libreadline6 libreadline6-dev libmcrypt-dev git libfreetype6-dev apt-utils pkg-config g++ openssl libssl-dev libxml2-dev make curl libcurl4-openssl-dev libjpeg-dev
# ./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-fpm-user=www --with-fpm-group=www \
--with-mysqli --with-pdo-mysql \
--with-iconv-dir --with-freetype-dir \
--with-jpeg-dir --with-png-dir \
--with-zlib --with-libxml-dir=/usr \
--enable-xml --disable-rpath \
--enable-bcmath --enable-shmop \
--enable-sysvsem --enable-inline-optimization \
--with-curl --enable-mbregex \
--enable-mbstring --with-mcrypt \
--enable-ftp --with-gd --enable-gd-native-ttf \
--with-openssl --with-mhash --enable-pcntl \
--enable-sockets --with-xmlrpc \
--enable-zip --enable-soap \
--without-pear --with-gettext \
--enable-fileinfo --enable-maintainer-zts --enable-fpm
# make -j 8 && make install
# chown -R www.www /usr/local/php
# chown www.www /usr/local/php/include/php/ext/session
# apt-get install -y mysql-server mysql-client libmysqld-dev
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localst identified by 'patpat';
mysql> flush privileges;
# mysql -u root -p zabbix < schema.sql
# mysql -u root -p zabbix < images.sql
# mysql -u root -p zabbix < data.sql
# mkdir -p /var/www/zabbix
# cp -R /opt/Zabbix/zabbix-3.4.4/frontends/php/* /var/www/zabbix/
# cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf_bak
# vim /usr/local/nginx/conf/nginx.conf
user www;
worker_processes 8;
worker_rlimit_nofile 30000;
daemon off;
error_log logs/error.log;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
client_max_body_size 20m;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
include /usr/local/nginx/conf.d/*.conf;
}
# vim /usr/local/nginx/conf.d/zabbix.conf
server {
listen 80;
server_name localhost;
autoindex on;
root /var/www/zabbix;
location / {
index index.html index.htm index.php;
try_files $uri/ /index.php?$query_string;
}
error_page 405 =200 @405;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
# useradd -M www -s /usr/sbin/nologin
# chown -R www.www /usr/local/php/
# cp /opt/Zabbix/php-7.2.0/php.ini-development /usr/local/php/etc/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/zabbix.conf
# vim /usr/local/php/etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = "Asia/Shanghai"
# useradd -M zabbix -s /usr/sbin/nologin
# apt-get install -y openipmi fping libevent-dev libsnmp-dev snmp snmpd libpcre3-dev
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make install
# chown -R zabbix.zabbix /usr/local/zabbix/
# vim /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=patpat
# /usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
# locale-gen zh_CN.UTF-8