编写shell脚本
#!/bin/bash
A=`cat -n /etc/zabbix/zabbix_proxy.conf | grep StartPollers= | awk '{print $1}'`
B=`cat -n /etc/zabbix/zabbix_proxy.conf | grep StartTrappers= | awk '{print $1}'`
C=`cat -n /etc/zabbix/zabbix_proxy.conf | grep StartDBSyncers= | awk '{print $1}'`
D=`cat -n /etc/zabbix/zabbix_proxy.conf | grep StartPingers= | awk '{print $1}'`
E=`cat -n /etc/zabbix/zabbix_proxy.conf | grep StartPollersUnreachable= | awk '{print $1}'`
F=`cat -n /etc/zabbix/zabbix_proxy.conf | grep StartDiscoverers= | awk '{print $1}'`
H=`cat -n /etc/zabbix/zabbix_proxy.conf | grep HistoryCacheSize= | awk '{print $1}'`
sed -i ''"$A"'c StartPollers=500' /etc/zabbix/zabbix_proxy.conf
sed -i ''"$B"'c StartTrappers=200' /etc/zabbix/zabbix_proxy.conf
sed -i ''"$C"'c StartDBSyncers=50 ' /etc/zabbix/zabbix_proxy.conf
sed -i ''"$D"'c StartPingers=500' /etc/zabbix/zabbix_proxy.conf
sed -i ''"$E"'c StartPollersUnreachable=500' /etc/zabbix/zabbix_proxy.conf
sed -i ''"$F"'c StartDiscoverers=120' /etc/zabbix/zabbix_proxy.conf
sed -i ''"$H"'c HistoryCacheSize=512M' /etc/zabbix/zabbix_proxy.conf
配置文件参数优化
Server=192.168.X.X #zabbix-server的ip
ServerPort=10051
Hostname=zabbix_proxy_192.168.X.X # 一定要和web界面的主机名一致
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
SocketDir=/var/run/zabbix
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=XXXXXX
ProxyLocalBuffer=720
ProxyOfflineBuffer=1
ConfigFrequency=60
DataSenderFrequency=1
StartPollers=1000
StartPollersUnreachable=500
StartTrappers=200
StartPingers=500
StartDiscoverers=120
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
CacheSize=3G
StartDBSyncers=100
HistoryCacheSize=1G
Timeout=30
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
Zabbix_Proxy.conf配置文件参数详解:
ProxyMode //Proxy工作模式,默认为主动模式,主动发送数据至Server;
Server //指定Server端地址;
ServerPort //Server端PORT;
Hostname //Proxy端主机名;
ListenPort //Proxy端监听端口;
LogFile //Proxy代理端日志路径;
PidFile //PID文件的路径;
DBHost //Proxy端数据库主机名;
DBName //Proxy端数据库名称;
DBUser //Proxy端数据库用户;
DBPassword //Proxy端数据库密码;
DBSocket //Proxy数据库SOCKET路径;
DBPort //Proxy数据库端口号;
ConfigFrequency=60 #zabbix proxy从zabbix server取得配置数据的频率
DataSenderFrequency //Proxy向Server发送数据的时间间隔;
StartPollers //Proxy程池数量;
StartDiscoverers //Proxy端自动发现主机的线程数量;
CacheSize //内存缓存配置;
StartDBSyncers //同步数据线程数;
HistoryCacheSize //历史数据缓存大小;
LogSlowQueries //慢查询日志记录,单位为毫秒;
Timeout //超时时间;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。