【运维笔记】zabbix
基础环境centos、nginx、MySQL、PHP创建用户、组group zabbixuserzabbix安装依赖yum install gcc pcre pcre-devel net-snmp curl curl-devel net-snmp net-snmp-devel libxml libxml2-develzabbix agent配置文件Hostname##...
·
基础环境
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}
更多推荐
已为社区贡献1条内容
所有评论(0)