Somar e exibir resultados gerados pelo monitoramento do DNS

Publicado por Nandor 19/09/2006

[ Hits: 4.838 ]

Homepage: http://www.solucoesnandor.com.br/

Download dns.sh




Como havia mensionado no meu artigo sobre monitoria de DNS, aqui está o script que lê o arquivo gerado, soma e exibe separadamente as requisições gravadas. Ex: A: 131075, AAAA: 5092, PTR: 194236, MX: 14518, NS: 10602, CNAME: 32, SOA: 10217, SRV: 56, TOTAL: 234753.

  



Esconder código-fonte

###########################################################################
###########################################################################
###########################################################################
###################### Script gerado por Nandor Fehér #####################
#################### Nandor Feher - Solucoes Inteligentes #################
#################### Fique tranquilo eu tenho a solucao !!#################
###########################################################################
###########################################################################
###########################################################################
#
#Criticas, duvidas, elogios ou sugestoes favor enviar para o e-mail solucoesnandor@yahoo.com.br
#
#Por favor comentar qualquer alteracao
#
#!/bin/bash

# Criando as variaveis com os respectivos nomes
statname="A"
statname2="AAAA"
statname3="PTR"
statname4="MX"
statname5="NS"
statname6="CNAME"
statname7="SOA"
statname8="SRV"
statname9="TOTAL"

#Fazendo a leitura dos arquivos, separando por categoria e contando os mesmos
stat=`grep 'IN A' /var/named/var/named/dump/query-log | wc --line`
stat2=`grep 'IN AAAA' /var/named/var/named/dump/query-log | wc --line`
stat3=`grep 'IN PTR' /var/named/var/named/dump/query-log | wc --line`
stat4=`grep 'IN MX' /var/named/var/named/dump/query-log | wc --line`
stat5=`grep 'IN NS' /var/named/var/named/dump/query-log | wc --line`
stat6=`grep 'IN CNAME' /var/named/var/named/dump/query-log | wc --line`
stat7=`grep 'IN SOA' /var/named/var/named/dump/query-log | wc --line`
stat8=`grep 'IN SRV' /var/named/var/named/dump/query-log | wc --line`


# Exibindo o resultado na tela com os nomes e somatorias
echo $statname: $stat
echo $statname2: $stat2
echo $statname3: $stat3
echo $statname4: $stat4
echo $statname5: $stat5
echo $statname6: $stat6
echo $statname7: $stat7
echo $statname8: $stat8
echo $statname9: $(($stat1+$stat2+$stat3+$stat4+$stat5+$stat6+$stat7+$stat8))

Scripts recomendados

Backup automático MySQL + arquivos do servidor web

java_firefox

Baixar jSMS no Gutsy

MGME - Mythic Game Master Emulator

Instalar e ativar o tema aero-aio do superkaramba


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts