Ada banyak cara untuk melihat query dari DNS server kita secara grafik, diantarnya menggunakan cacti,nagios dll. MRTG lumayan ampuh&mudah dari pada yang lainnya…tergantung pengguna masing2 denk…hehehe…

Ato mungkin temen2 ada cara jitu lainnya sok tuangkan dikomentar anda…

Untuk lebih jelasnya baca daholo sebelumnya artikel tentang MRTG yang sebelumnya.

· PDNS Query

Tambahkan file berikut ke mrtg.cfg

#nano /etc/mrtg/mrtg.cfg

Target[udp-queries]: ‘/etc/init.d/pdns mrtg udp-queries udp-answers’

Options[udp-queries]: growright,nopercent,perminute

MaxBytes[udp-queries]: 600000

AbsMax[udp-queries]: 600000

Title[udp-queries]: Queries per minute

PageTop[udp-queries]: <h1>PDNS Queries per minute</h1>

WithPeak[udp-queries]: ymwd

YLegend[udp-queries]: queries/minute

ShortLegend[udp-queries]: q/m

LegendI[udp-queries]: udp-questions

LegendO[udp-queries]: udp-answers

Target[perc-failed]: ‘/etc/init.d/pdns mrtg udp-queries udp-answers’

Options[perc-failed]: growright,dorelpercent,perminute

MaxBytes[perc-failed]: 600000

AbsMax[perc-failed]: 600000

Title[perc-failed]: Queries per minute, with percentage success

PageTop[perc-failed]: <h1>PDNS Queries per minute, with percentage success</h1>

WithPeak[perc-failed]: ymwd

YLegend[perc-failed]: queries/minute

ShortLegend[perc-failed]: q/m

LegendI[perc-failed]: udp-questions

LegendO[perc-failed]: udp-answers

Target[packetcache-rate]: ‘/etc/init.d/pdns mrtg packetcache-hit udp-queries’

Options[packetcache-rate]: growright,dorelpercent,perminute

Title[packetcache-rate]: packetcache hitrate

MaxBytes[packetcache-rate]: 600000

AbsMax[packetcache-rate]: 600000

PageTop[packetcache-rate]: <h1>PDNS packetcache hitrate</h1>

WithPeak[packetcache-rate]: ymwd

YLegend[packetcache-rate]: queries/minute

ShortLegend[packetcache-rate]: q/m

LegendO[packetcache-rate]: total

LegendI[packetcache-rate]: hit

Target[packetcache-missrate]: ‘/etc/init.d/pdns mrtg packetcache-miss udp-queries’

Options[packetcache-missrate]: growright,dorelpercent,perminute

Title[packetcache-missrate]: packetcache MISSrate

MaxBytes[packetcache-missrate]: 600000

AbsMax[packetcache-missrate]: 600000

PageTop[packetcache-missrate]: <h1>PDNS packetcache MISSrate</h1>

WithPeak[packetcache-missrate]: ymwd

YLegend[packetcache-missrate]: queries/minute

ShortLegend[packetcache-missrate]: q/m

LegendO[packetcache-missrate]: total

LegendI[packetcache-missrate]: MISS

Target[latency]: ‘/etc/init.d/pdns mrtg latency’

Options[latency]: growright,nopercent,gauge

MaxBytes[latency]: 600000

AbsMax[latency]: 600000

Title[latency]: Query/answer latency

PageTop[latency]: <h1>PDNS Query/answer latency</h1>

WithPeak[latency]: ymwd

YLegend[latency]: usec

ShortLegend[latency]: usec

LegendO[latency]: latency

LegendI[latency]: latency

Target[recursing]: ‘/etc/init.d/pdns mrtg recursing-questions recursing-answers’

Options[recursing]: growright,nopercent,gauge

MaxBytes[recursing]: 600000

AbsMax[recursing]: 600000

Title[recursing]: Recursive questions/answers

PageTop[recursing]: <h1>PDNS Recursing questions/answers</h1>

WithPeak[recursing]: ymwd

YLegend[recursing]: queries/minute

ShortLegend[recursing]: q/m

LegendO[recursing]: recursing-questions

LegendI[recursing]: recursing-answers

  • BIND Query

Sama seperti halnya pada PDNS Query,pada BIND query MRTG juga akan membaca log file pada bind yang terletak pada /var/named/chroot/var/named/data/named_stats.txt

Buat file bind.pl di /etc/mrtg/

# nano /etc/mrtg/bind.pl

#!/usr/bin/perl

$hostname = “local”;

$uptime = ‘uptime’;

$uptime =~ /up (.*?),/;

$uptime = $1;

$start =’/usr/sbin/rndc stats’;

$log =”/var/named/chroot/var/named/data/named_stats.txt”;

@stat = ‘tail -n 15 $log’;

$last_success = $stat[0];

$last_success =~ tr/^[0-9]\ //cd;

$last_failure = $stat[5];

$last_failure =~ tr/^[0-9]\ //cd;

$latest_success = $stat[8];

$latest_success =~ tr/^[0-9]\ //cd;

$latest_failure = $stat[13];

$latest_failure =~ tr/^[0-9]\ //cd;

$success = $latest_success – $last_success;

unless ($success lt “0”){ $success ++; }

$failure = $latest_failure – $last_failure;

unless ($failure lt “0”){ $failure ++; }

print “$success\n$failure\n$uptime\n$hostname\n”;

exit;

Setelah selesai tambahkan file dibawah ini ke mrtg.cfg

#nano /etc/mrtg/mrtg.cfg

Target[dns]: ‘/etc/mrtg/bind.pl’

Options[dns]: gauge,absolute,integer,nopercent,growright

MaxBytes[dns]: 100000000

Title[dns]: DNS Queries

PageTop[dns]: <h1> BIND QUERY </h1>

YLegend[dns]: DNS Queries

ShortLegend[dns]: q/m

LegendI[dns]: # of successful queries:

LegendO[dns]: # of failed queries:

Legend1[dns]: Successful queries

Legend2[dns]: Failed queries

  • Jangan lupa jika sudah selesai buat kembali file index.html nya..

#/usr/bin/indexmaker /etc/mrtg/mrtg.cfg >/var/www/mrtg/index.html

Now Look at your web browser http://localhost/mrtg/

mrtg