|
É squid com snmp, creio que não seja off-topic, vou postar aqui mesmo: 1 - compilar o squid com suporte a snmp (adiciona --enable-snmp no comando ./configure) 2 - colocar no squid.conf: # snmp snmp_port 3401 acl snmppublic snmp_community public acl acessosnmp src 127.0.0.1 172.16.0.12 snmp_access allow snmppublic acessosnmp snmp_access deny all snmp_incoming_address 0.0.0.0 snmp_outgoing_address 255.255.255.255 No caso acima, 172.16.0.12 é a máquina onde vou gerar os gráficos, se for gerar na mesma maquina, deixe apenas 127.0.0.1 3 - instalar o net-snmp (apenas para o comando snmpwalk): http://sourceforge.net/project/showfiles.php?group_id=12694 4 - instalar o rrdtool, para quem usa slackware, pode baixar o pacote que eu criei www.myauth.com.br/downloads/rrdtool-i386-1.tgz os demais devem instalar conforme suas distros. 5 - Criando banco de dados de estatisticas /usr/local/rrdtool/bin/rrdtool create /opt/hists.rrd --step 60 \ DS:data1:DERIVE:600:0:U \ DS:data2:DERIVE:600:0:U \ RRA:AVERAGE:0.5:1:576 \ RRA:AVERAGE:0.5:6:672 \ RRA:AVERAGE:0.5:24:732 \ RRA:AVERAGE:0.5:144:1460 6 - pegando informações e armazenando no banco de dados, coloque o script abaixo no cron, de 1 em 1 minuto host=127.0.0.1 port=3401 hists=`snmpwalk -v2c -c public $host:$port -m /etc/squid/mib.txt cacheHttpHits | tail -n1 | cut -f2 -d'=' | cut -f2 -d':'` requests=`snmpwalk -v2c -c public $host:$port -m /etc/squid/mib.txt cacheHttpHits | tail -n1 | cut -f2 -d'=' | cut -f2 -d':'` /usr/local/rrdtool/bin/rrdtool update /opt/hists.rrd N:$hits:$requestss 7 - Gerar gráficos, no tempo que quiser graphtype1=AREA color1='#00cc00aa' border1='#05500' gtimes=" 1h:$h1_ini:$h1_end:$h1_step:1_hora 8h:$h8_ini:$h8_end:$h8_step:8_horas day:$day1_ini:$day1_end:$day1_step:1_dia week:$week1_ini:$week1_end:$week1_step:1_semana month:$month1_ini:$month1_end:$month1_step:1_mês year:$year1_ini:$year1_end:$year1_step:1_ano " # gerar graficos for time in $gtimes; do sufix=`echo $time | cut -f1 -d:` start=`echo $time | cut -f2 -d:` end=`echo $time | cut -f3 -d:` step=`echo $time | cut -f4 -d:` gtitle=`echo $time | cut -f5 -d: | sed 's/_/\ /g'` /usr/local/rrdtool/bin/rrdtool graph /op/squid-$sufix.png \ --title="Squid - Hits e requests" \ --start=$start \ --end=$end \ --vertical-label "requisições por segundo" \ --width 400 --height 300 \ --imgformat PNG \ --step $step \ "DEF:data1=/opt/hists.rrd:data1:AVERAGE" \ "DEF:data2=/opt/hists.rrd:data2:AVERAGE" \ COMMENT:" Corrente Máximo Média Mínimo\n" \ AREA:data1$color1:" Total " \ GPRINT:data1:LAST:" %8.0lf" \ GPRINT:data1:MAX:" %8.0lf" \ GPRINT:data1:AVERAGE:" %8.0lf" \ GPRINT:data1:MIN:" %8.0lf\n" \ $graphtype1:data1$border1 \ >/dev/null done att, Patrick Flávio Roberto escreveu: Patrick,__._,_.___ Enviar mensagem: [email protected] Assinar: [EMAIL PROTECTED] Cancelar assinatura: [EMAIL PROTECTED] Proprietário da lista: [EMAIL PROTECTED]
Links do Yahoo! Grupos
__,_._,___ |
- Re: [squid-br] Como saber se o squid est... Patrick
- [squid-br] OFF TOPIC - trocar uma i... Paulo - SYSMATEC
- [squid-br] OFF TOPIC - Administ... Zubulu
- Re: [squid-br] OFF TOPIC - ... Valois Ivan Tomasi - Master Redes
- Re: [squid-br] OFF TOPIC - ... Rafael Tomelin
- Re: [squid-br] OFF TOPI... Patrick
- Re: [squid-br] OFF TOPIC - troc... Cleber P. de Souza
- Re: [squid-br] OFF TOPIC - ... Paulo - SYSMATEC
- Re: [squid-br] Como saber se o squi... Elias Araujo
