阅读118 返回首页    go 小米 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服务器