編寫shell腳本
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:域名與空間、網(wǎng)絡(luò)空間、營銷軟件、網(wǎng)站建設(shè)、臨武網(wǎng)站維護(hù)、網(wǎng)站推廣。
#!/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
配置文件參數(shù)優(yōu)化
Server=192.168.X.X ? ? ?#zabbix-server的ip
ServerPort=10051
Hostname=zabbix_proxy_192.168.X.X ? # 一定要和web界面的主機(jī)名一致
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配置文件參數(shù)詳解:
ProxyMode //Proxy工作模式,默認(rèn)為主動模式,主動發(fā)送數(shù)據(jù)至Server;
Server //指定Server端地址;
ServerPort //Server端PORT;
Hostname //Proxy端主機(jī)名;
ListenPort //Proxy端監(jiān)聽端口;
LogFile //Proxy代理端日志路徑;
PidFile //PID文件的路徑;
DBHost //Proxy端數(shù)據(jù)庫主機(jī)名;
DBName //Proxy端數(shù)據(jù)庫名稱;
DBUser //Proxy端數(shù)據(jù)庫用戶;
DBPassword //Proxy端數(shù)據(jù)庫密碼;
DBSocket //Proxy數(shù)據(jù)庫SOCKET路徑;
DBPort //Proxy數(shù)據(jù)庫端口號;
ConfigFrequency=60 #zabbix proxy從zabbix server取得配置數(shù)據(jù)的頻率
DataSenderFrequency //Proxy向Server發(fā)送數(shù)據(jù)的時間間隔;
StartPollers //Proxy程池數(shù)量;
StartDiscoverers //Proxy端自動發(fā)現(xiàn)主機(jī)的線程數(shù)量;
CacheSize //內(nèi)存緩存配置;
StartDBSyncers //同步數(shù)據(jù)線程數(shù);
HistoryCacheSize //歷史數(shù)據(jù)緩存大??;
LogSlowQueries //慢查詢?nèi)罩居涗?,單位為毫秒?br />Timeout //超時時間;