zabbix server

前提环境:

CentOS 6

Lnmp

php需要的包(bcmath,mbstring,sockets,gd,libxml,xmlwriter,xmlreader,ctype,session,gettext)  # gettext多语言支持

版本:Zabbix-3.2.3

server安装

yum install -y net-snmp \
net-snmp-devel
cd /usr/local/src/zabbix-3.2.
./configure --prefix=/usr/local/zabbix \
--enable-server \
--enable-agent \
--with-mysql=/usr/local/mysql/bin/mysql_config \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--with-openssl
make && make install

--enable-server zabbix服务端

--enable-agent zabbix客户端

修改php配置文件(php.ini)

memory_limit=128M
post_max_size=16M
upload_max_filesize=2M
max_execution_time=
max_input_size=
session.auto_start = 0
mbstring.func_overload = 0
always_populate_raw_post_data = -1

创建用户(服务器端 客户端都需要创建 默认运行用户是zabbix)

useradd -M -s /sbin/nologin zabbix

初始化数据库
zabbix server,proxy需要数据库
agent不需要
proxy只需要导入一个sql文件,server需要导入三个sql文件
proxy:
database/mysql/schema.sql
server:
database/mysql/schema.sql
database/mysql/images.sql
database/mysql/data.sql

配置zabbix server

/usr/local/zabbix/etc/zabbix_server.conf

LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=
DBSocket=/tmp/mysql.sock

启动zabbix server

/usr/local/zabbix/sbin/zabbix_server

配置zabbix server访问站点

copy前端文件
mkdir /storage/www/zabbix
cp -rp frontends/php/* /storage/www/zabbix

/usr/local/nginx/conf/nginx.conf

server
{
listen ;
server_name monitor.zabbix.com;
#access_log off;
root /storage/www/;
error_page /50x.html;
location = /50x.html {
root html;
}
location /
{
     index index.php index.html;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}

配置访问zabbix

一、在线配置(图形界面形式 最终程序也是写入参数到zabbix.conf.php 会有各模块错误检查)

用户zabbix需要对zabbix.conf.php的写权限

monitor.zabbix.com

二、直接手动修改zabbix.conf.php配置文件

/storage/www/zabbix/conf/zabbix.conf.php

<?php
// Zabbix GUI configuration file.
global $DB; $DB['TYPE'] = 'MYSQL';    # 数据库类型
$DB['SERVER'] = 'localhost'; # mysql host
$DB['PORT'] = '';       # mysql port 我们设置的是unix socket访问方式 所以不需要修改为3306
$DB['DATABASE'] = 'zabbix';    # 具体数据库
$DB['USER'] = 'root'; # mysql user
$DB['PASSWORD'] = '123456'; # mysql pass ?>

登录语言选择

查看配置中是否开启了中文

include/locales.inc.php

  'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true],

中文乱码解决

找到本地C:\Windows\Fonts\simkai.ttf(楷体)上传到服务器zabbix网站目录fonts目录下

修改配置文件

cd /storage/www/zabbix && sed -i 's/DejaVuSans/simkai/g' ./include/defines.inc.php

zabbix agent

agent安装

cd /usr/local/src/zabbix-3.2.3
./configure --prefix=/usr/local/zabbix-agent \
--enable-agent
make && make install

创建用户(服务器端 客户端都需要创建 默认运行用户是zabbix)

useradd -M -s /sbin/nologin zabbix

配置zabbix agent

/usr/local/zabbix-agent/etc/zabbix_agentd.conf

LogFile=/tmp/zabbix_agentd.log
Server=172.18.2.196 # zabbix server ip
#ServerActive=172.18.2.196 # 主动模式
Hostname=test6 # 客户端主机名(执行hostname命令所得)
Include=/usr/local/zabbix-agent/etc/zabbix_agentd.conf.d/ # 其它监控模块的路径

启动zabbix agent

/usr/local/zabbix-agent/sbin/zabbix_agentd

ALL(server,agent)

启动脚本

misc/init.d  有多个linux发行版的init脚本(需要自行修改程序路径)

测试

server(zabbix_get 获取客户端item值)

zabbix_get -s (agent ip) -p (agent port) -k "item-key"

example:  zabbix_get -s 127.0.0.1 -p 10050 -k "system.uname"

agent(zabbix_agentd 获取item值)

zabbix_agentd -t "item-key"

example: zabbix_agentd -t "system.uname"

ps:本文所有的相对路径以源码解压缩路径(/usr/local/src/zabbix-3.2.3)为起点

参考:https://www.zabbix.com/documentation/3.2/manual/installation/install

最新文章

  1. [Java][Weblogic] weblogic.net.http.SOAPHttpsURLConnection incompatible with javax.net.ssl.HttpsURLConnection解决办法
  2. 每天一个Linux命令(3):pwd命令
  3. Valid Sudoku leetcode
  4. jad安装
  5. [改善Java代码]让工具类不可实例化
  6. FPGA同步复位异步复位
  7. ZOJ 3820 2014ACM/ICPC牡丹江司B称号
  8. C语言中的内存管理
  9. My Eclipse Security Alert
  10. Inno Setup入门(二)&mdash;&mdash;修改安装过程中的图片
  11. 常用FastJSON的SerializerFeature特性及日期转换格式
  12. JavaScript的数据结构和算法
  13. Codeforces 1108F MST Unification(最小生成树性质)
  14. MacBook Air 装win10系统 by DODUI
  15. Ubuntu 16.04 ROS环境配置
  16. Java-大数据方向学习和已掌握知识点整理
  17. 利用sys.dm_db_index_physical_stats查看索引大小/碎片等信息
  18. 如何设置Android手机的sqlite3命令环境
  19. linux kernel 卡在提示信息Waiting for root device /dev/mmcblk0p1...处
  20. linux每天一小步---tail命令详解

热门文章

  1. CentOS7安装GNOME可视化界面
  2. eclipse 工程没有build path
  3. Servlet3.0整合Springmvc(注解版)
  4. 客户端发一个post请求
  5. 04_Storm编程上手_WordCount集群模式运行
  6. Spring Boot与Spring的区别
  7. int数组的下标为n
  8. js今日小结—Ajax、前端安全、GET&amp;POST、闭包、HTTPS
  9. centos 6.6 配置xdmcp远程桌面
  10. How to find per-process I/O statistics on Linux