zabbix企业级监控系统
keys:键值
net.if.in[eno16777736]
自定义键值:
被监控端自定义键值
/root/lnmp_soft/zabbix-3.4.4/conf/zabbix_agentd/
/etc/zabbix/zabbix_agentd.d/
自定义一个以.conf结尾的文件
例句:
UserParameter=vfs.dir.size[*],dir="
{dir:-/tmp}" | cut -f1
UserParameter : 固定的
= : 固定的
vfs.dir.size : 键值的名字
, : 固定的。分隔键值名字和执行的命令
dir="
{dir:-/tmp}" | cut -f1 : 执行的命令
自定义监控键值:
mysql的questions值:
UserParameter=mysql.questions,mysqladmin -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 -l
UserParameter=tcp.status.syn_recv,netstat -anuplt | grep :80 | grep -i SYN_RECV | wc -l
UserParameter=tcp.status.fin_wait_2,netstat -anuplt | grep :80 | grep -i FIN_WAIT_2 | wc -l
UserParameter=mem.free,free | awk '/Mem/{print $4}'
升级1.0:
UserParameter=tcp.status[*],netstat -anuplt | grep :80 | grep -i "$1" | wc -l
升级2.0:
UserParameter=tcp.status[*],/root/tcp.status.sh $1
# vim /root/tcp.status.sh
ESTABLISHED (){
UserParameter=tcp.status.establlished,netstat -anuplt | grep :80 | grep -i ESTABLISHED | wc -
}
SYN_RECV () {
UserParameter=tcp.status.syn_recv,netstat -anuplt | grep :80 | grep -i SYN_RECV | wc -l
}
FIN_WAIT_2 (){
UserParameter=tcp.status.fin_wait_2,netstat -anuplt | grep :80 | grep -i FIN_WAIT_2 | wc -l
}
$1