自定义键值:
被监控自定义键值
/ root/ 1nmp_ soft/ zabbix-3.4.4/ conf/ zabbix agentd/
/etc/ zabbix/ zabbix_ agentd. d/
自定义一个以.conf结尾的文件
例句:
UserParameter=vfs .dir .size[*],dir="
1
"
;
d
u
−
S
−
B
1
"
1"; du -S -B 1 "
1";du−S−B1"{dir:-/tmp}"| cut -f1
UserParameter :固定的
= :固定的
vfs .dir .size :键值的名字
, :固定的。分隔键值名字和执行的命令
dir="
1
"
;
d
u
−
S
−
B
1
"
1"; du -S -B 1 "
1";du−S−B1"{dir:-/tmp}"| cut -f1 :执行的命令
自定义监控键值:
mysql的questions值:
UserParameter-mysql. questions,mysql admin -uroot status awk '{print $6}'
UserParameter=agent . hostname,hostname
Userparameter=agent. version, zabbix_ agentd -V | awk 'NR==1{ print$4}'
TCP连接:
三次握手, 四次断开,十种状态
UserParameter=tcp . status . establlished, netstat - anuplt | grep :80 | grep -i ESTABLISHED | wc -1
UserParameter-tcp. status. syn_ recv , netstat - anuplt | grep :80 | grep -i SYN_ RECV | wc -1
UserParameter-tcp. status.fin wait_ 2, netstat - anuplt | grep :80 | grep -i FIN_ WAIT_ 2 | wc -1
升级1.0:
UserParameter=tcp . status[*], netstat -anuplt | grep :80 | grep -i "$1"| wc. -
升级2.0:
UserParameter=tcp. status[*],/root/tcp. status.sh $1
# vim /root/ tcp. status. sh
ESTABLISHED ( ){
UserPar ameter=tcp . status . establlished, netstat - anuplt | grep :80 | grep -i ESTABLISHED | wc -1
SYN_ RECV ( ) {
UserParameter-tcp. status . syn_ recv, netstat -anuplt | grep :80 | grep -i SYN_ RECV | wc -1
}
FIN WAIT_ _2 ( ){
Userparameter=tcp. status .fin wait_ 2, netstat -anuplt | grep :801 grep -i FIN_ WAIT_ 2| wc -1
}
$1