[linux] DNS a mrtg

Peter Mikeska mikeska.peter na alcatel.sk
Pátek Březen 21 08:38:35 CET 2003


cafo, dachto xcel davnejsie dake info a nik mu neodpovedal ;)) ja som
to ties riesli tento vikend a vysledok je uplne zuper ;))

>>dns.cfg
WorkDir: /var/www/html/mrtg/dns/pages
IconDir: /var/www/html/mrtg/dns/images                                                                                        
Options[^]: growright                                                                                                         
XSize[_]: 350                                                                                                                 
YSize[_]: 80                                                                                                                  
Colours[_]: LIGHT BLUE#7aafff,BLUE#1000ff,DARK BLUE#000066,VIOLET#ff00ff,GREEN#00ff00                                         
Refresh: 300
Interval: 5                                                                                                                   
                                                                                                                              
Target[dnsreqs]: `/opt/stat/stat.pl dnsreqs`                                                                                  
Options[dnsreqs]: nopercent,growright,perhour                                                                                 
Title[dnsreqs]: DNS: Requests per hour                                                                                        
PageTop[dnsreqs]: <h1>DNS: Requests per hour</h1>                                                                             
MaxBytes[dnsreqs]: 1000000000                                                                                                 
YLegend[dnsreqs]: reqs/hour                                                                                                   
ShortLegend[dnsreqs]: per hour                                                                                                
LegendI[dnsreqs]: &nbsp;Requests:                                                                                             
LegendO[dnsreqs]:                                                                                                             
Legend1[dnsreqs]: Requests per hour
-----------------------------------------------
>>stat.pl
....
} elsif ($s eq "dnsreqs") {
$l = `rm -f /var/named/named.stats`;                                                                                          
$l = `/usr/sbin/rndc stats`;                                                                                                  
$l = `tail -7 /var/named/named.stats | head -1 | sed 's/ / /g' | cut -f 2 -d " "`;                                            
$l =~ /(\d+)/;

rndc sprtavi statistiku, ale treba ho mazat lebo pripisuje na koniec a
to je nad moje zufale programatorske sachopnosti ;))
, a v druhom riadku mas pocet requestov
bind dumpuje subor named.stat do adresara /var/named kde mas subory
ale da sa to nastavit v named.conf
inace vie to (rndc) aj dumpnut dns cache ;)

mno a staci to spustit do cronu
*/15 * * * * /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/dns/dns.cfg 2>&1 >/dev/null

hadm to pomoze dakomu.
7000 req per hour je vela alebo akurat? ;))




Další informace o konferenci linux