在zabbix_agentd.conf增加:
#squid
UserParameter=squid.test,echo 1
UserParameter=squid.http_requests,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of HTTP requests received:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.clients,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of clients accessing cache:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.icp_received,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of ICP messages received:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.icp_sent,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of ICP messages sent:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.icp_queued,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of queued ICP replies:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.htcp_received,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of HTCP messages received:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.htcp_sent,/usr/bin/squidclient -p 3130 mgr:info|grep 'Number of HTCP messages sent:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.req_fail_ratio,/usr/bin/squidclient -p 3130 mgr:info|grep 'Request failure ratio:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.avg_http_req_per_min,/usr/bin/squidclient -p 3130 mgr:info|grep 'Average HTTP requests per minute since start:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.avg_icp_msg_per_min,/usr/bin/squidclient -p 3130 mgr:info|grep 'Average ICP messages per minute since start:'|cut -d':' -f2| sed s/[[:space:]]//g
UserParameter=squid.request_hit_ratio,/usr/bin/squidclient -p 3130 mgr:info|grep 'Request Hit Ratios:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.byte_hit_ratio,/usr/bin/squidclient -p 3130 mgr:info|grep 'Byte Hit Ratios:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.request_mem_hit_ratio,/usr/bin/squidclient -p 3130 mgr:info|grep 'Request Memory Hit Ratios:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.request_disk_hit_ratio,/usr/bin/squidclient -p 3130 mgr:info|grep 'Request Disk Hit Ratios:'|cut -d':' -f3|cut -d',' -f1|tr -d ' %'
UserParameter=squid.servicetime_httpreq,/usr/bin/squidclient -p 3130 mgr:info|grep 'HTTP Requests (All):'|cut -d':' -f2|tr -s ' '|awk '{print 1}'
UserParameter=squid.process_mem,/usr/bin/squidclient -p 3130 mgr:info|grep 'Process Data Segment Size via sbrk'|cut -d':' -f2|awk '{print
1}'
UserParameter=squid.cpu_usage,/usr/bin/squidclient -p 3130 mgr:info|grep 'CPU Usage:'|cut -d':' -f2|tr -d '%'|sed s/[[:space:]]//g
UserParameter=squid.cache_size_disk,/usr/bin/squidclient -p 3130 mgr:info|grep 'Storage Swap size:'|cut -d':' -f2|awk '{print 1}'
UserParameter=squid.cache_size_mem,/usr/bin/squidclient -p 3130 mgr:info|grep 'Storage Mem size:'|cut -d':' -f2|awk '{print
1}'
UserParameter=squid.mean_obj_size,/usr/bin/squidclient -p 3130 mgr:info|grep 'Mean Object Size:'|cut -d':' -f2|awk '{print 1}'
UserParameter=squid.filedescr_max,/usr/bin/squidclient -p 3130 mgr:info|grep 'Maximum number of file descriptors:'|cut -d':' -f2|awk '{print
1}'
UserParameter=squid.filedescr_avail,/usr/bin/squidclient -p 3130 mgr:info|grep 'Available number of file descriptors:'|cut -d':' -f2|awk '{print $1}'

导入squid即可。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code