閱讀118 返回首頁    go 中電雲集


使用 Mrtg 監控 squid

今天花了一上午的時間,總算做成了Mrtg對Squid的監控.我把我的配置過程貼出來.希望對大家有幫助

(1)我們需要修改squid

vi /etc/squid/squid.conf

acl snmppublic snmp_community public (設置snmp監控的共同體為public)

snmp_port 3401(設置snmp監控端口)

snmp_access allow snmppublic all(允許所有的計算機訪問snmppublic)

然後從新啟動squid /etc/rc.d/init.d/squid restart

(2)把/etc/squid/mib.txt 複製到/etc/mrtg/squid.mib

cp /etc/squid/mib.txt /etc/mrtg/squid.mib

(3)然後修改/etc/mrtg/mrtg.cfg

加入LoadMIBs: /etc/mrtg/squid.mib

(4)在/etc/mrtg/mrtg.cfg加入如下

Target[proxy-hit]: cacheHttpHits&cacheServerRequests:public@x.x.x.x:3401(x.x.x.x為你機器的IP地址)

MaxBytes[proxy-hit]: 100000

Title[proxy-hit]: HTTP Hits

PageTop[proxy-hit]: <H1>;proxy Cache Statistics: HTTP Hits/Requests</H1>;

<TABLE>;

<TR>;<TD>;System:</TD>;<TD>;redhat.grandunion.com.cn</TD>;</TR>;

<TR>;<TD>;Maintainer:</TD>;<TD>;Serassio Guido</TD>;</TR>;

<TR>;<TD>;Description:</TD>;<TD>;Squid Proxy server</TD>;</TR>;

</TABLE>;

Suppress[proxy-hit]: y

LegendI[proxy-hit]:  HTTP hits

LegendO[proxy-hit]:  HTTP requests

Legend1[proxy-hit]:  HTTP hits

Legend2[proxy-hit]:  HTTP requests

YLegend[proxy-hit]: perminute

ShortLegend[proxy-hit]: req/min

Options[proxy-hit]: nopercent, perminute, dorelpercent, unknaszero

Target[proxy-srvkbinout]: cacheServerInKb&cacheServerOutKb:public@x.x.x.x:3401(x.x.x.x為你機器的IP地址)

MaxBytes[proxy-srvkbinout]: 2000(這兒為你的真實網絡帶寬xxxK)

Title[proxy-srvkbinout]: Cache Server Traffic In/Out

PageTop[proxy-srvkbinout]: <H1>;Cache Statistics: Server traffic volume (In/Out)</H1>;

<TABLE>;

<TR>;<TD>;System:</TD>;<TD>;redhat.grandunion.com.cn</TD>;</TR>;

<TR>;<TD>;Maintainer:</TD>;<TD>;Serassio Guido</TD>;</TR>;

<TR>;<TD>;Description:</TD>;<TD>;Squid Proxy server</TD>;</TR>;

</TABLE>;

Suppress[proxy-srvkbinout]: y

LegendI[proxy-srvkbinout]:  Traffic In

LegendO[proxy-srvkbinout]:  Traffic Out

Legend1[proxy-srvkbinout]:  Traffic In

Legend2[proxy-srvkbinout]:  Traffic Out

YLegend[proxy-srvkbinout]: per minute

ShortLegend[proxy-srvkbinout]: b/min

kMG[proxy-srvkbinout]: k,M,G,T

kilo[proxy-srvkbinout]: 1024

Options[proxy-srvkbinout]: nopercent, perminute, unknaszero

保存文件,並運行mrtg mrtg.cfg

然後運行indexmaker mrtg.cfg >; /var/www/mrtg/index.hmtl

這樣你就可是隨時監控你的SQUID運行情況

後記:使用mrtg也可以監控cpu load disk等等,可以參考

https://www.leeshow.com/?v=soft&s_v=linux&s_s_v=&art_id=108

這樣你就可以對Squid進行全麵的監控…!

:em02:

snmp_port 3401

acl snmppublic snmp_community pc109237

snmp_access allow snmppublic all

proxy -v 2c -c pc109237 localhost:3401 .1.3.6.1.4.1.3495.1

最後更新:2017-01-04 22:34:31

  上一篇:go Shell 和 Shell Script基礎
  下一篇:go CentOS5架設freeradius+mysql的radius服務器