【运维笔记】zabbix

基础环境

centos、nginx、MySQL、PHP

创建用户、组

group zabbix
user  zabbix

安装依赖

yum install gcc pcre pcre-devel net-snmp curl curl-devel net-snmp net-snmp-devel libxml libxml2-devel

zabbix agent配置文件

Hostname  ### 跟监控主机名一致
Server  ### passive mode 	--10050
ActiveServer  ### active mode  
RefreshActiveChecks  ### 主动监控检查刷新时间
StarAgents:  # 模式选择,设为0关闭被动模式,关闭10050端口
	If set to 0, disables passive checks and the agent will not listen on any TCP port

zabbix proxy配置

## 导入sql文件
	./database/mysql/schema.sql

## 安装
./configure --prefix=/usr/local/zabbix --enable-proxy --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

## 配置文件
Server
Hostname	--agent proxy
ProxyMode	0主动模式	1被动模式
ConfigFrequency=            # Proxy 向 Zabbix Server请求监控项间隔
DataSenderFrequency=        # Proxy 向 Zabbix Server发送监控数据间隔
10051

zabbix server配置

## 安装
./configure --prefix=/usr/local/zabbix --with-mysql --enable-server --with-net-snmp --with-libcurl --with-libxml

## 数据库配置
	create database zabbix;  #### 创建数据库
	grant all privileges on zabbix.* on 'zabbix'@'%' identified by 'password';  ### 设置权限
	 ./database/mysql/schema.sql  images.sql  data.sql  ### 导入sql文件

## nginx配置
	cp -r ./frontends/php/  /usr/local/nginx/html/zabbix
	FpingLocation=/usr/local/sbin/fping  ## fping路径
	AlertScriptsPath=/usr/local/zabbix/alertscripts  ## 告警脚本路径
	zabbix.conf.php/

zabbix web inteface

Proxies --zabbix proxy
Media types	--Script	--script name	--Script parameters
User groups  --Permissions
User	--Media  -Send to
		--User type
Host groups
Hosts	--Hostname	--Agent interfaces --SNMP interfaces --Monitored by proxy
		--Linked templates	
Items	--type zabbix agent(active)  
SNMPv2 agent	--Key(key自定义)
				--SNMP OID
				--SNMP community
Trigger		--Expression
ACtions		--Conditions	
			--Operations	-Default subject -Default message 
			--Recovery operations
Discovery rule	--SNMPVALUE		--SNMPINDEX

于主机上执行远程命令(EnableRemoteCommands=1)

配置-动作-操作(步奏、明细)
自定义脚本 -- 执行在zabbix客户端

error

-------------
configure: error: Unable to use libevent (libevent check failed)

解决办法如下:
	yum install libevent-devel  -y
	

--------------------
error while loading shared libraties:libmysqlclient.so.20:cannot open

解决方法:
vim /etc/ld.so.conf
	/usr/local/mysql/lib

ldconfig

------------------------
Starting MySQL.2018-01-04T06:27:54.940783Z mysqld_safe error: log-error set to '/var/log/mariadb/mariadb.log', however file don't exists. Create wr... user 'mysql'.

解决方法:
卸载mariadb
rpm -e --nodeps


-------------------------
Cannot open include file: 'mysql/mysql.h': No such file or directory

解决方法:
设置mysql到环境变量
export mysql_home=/usr/local/mysql/bin
export PATH=${PATH}:${mysql_home}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值