[mrtg] mrtg + dns statistics
Philipp Werder
philipp.werder at gmz.migros.ch
Tue Feb 11 13:05:19 MET 2003
hello
I'm trying to use the the script stat.pl to monitor DNS-queries (bind 8.2.2 on Solaris).
when I run the script, I get the following error:
Use of uninitialized value in concatenation (.) or string at ./stat.pl line 156.
Use of uninitialized value in concatenation (.) or string at ./stat.pl line 156.
As I'm not familiar with perl script, I'm not able to solve the problem.
Below you'll find the output from my named.stats and the script stat.pl
perl script stat.pl:
--------------------------------
#!/usr/bin/perl -w
# $Id: stat.pl,v 1.6 1999/07/27 08:27:13 v072863 Exp $
####################
# New updates for stat.pl
####################
%D_STAT=(
RQ => 0,
RR => 1,
RIQ => 2,
RNXD => 3,
RFwdQ => 4,
RFwdR => 5,
RDupQ => 6,
RDupR => 7,
RFail => 8,
RFErr => 9,
RErr => 10,
RTCP => 11,
RAXFR => 12,
RLame => 13,
ROpts => 14,
SSysQ => 15,
SAns => 16,
SFwdQ => 17,
SDupQ => 18,
SFail => 19,
SFErr => 20,
SErr => 21,
RNotNsq => 22,
SNaAns => 23,
SNXD => 24,
);
# This file is to feed mrtg with right information.
# You could do this more fancy with up-time and stuff like that,
# but that will be maybe in a couple of versions upward.
# This works and i dont want to be like other big companys that gives out
# Programs that want work but is all that fancy.
#
# Any way please do change this files so the right PATH to youre scripts
# are there.
# Requirements:
# this scripts require MRTG (of course), i wont get in how to configure this,
# because im not sure how to do it correctly, i manged to get it to work.
# but i sugest you take a real good look how to configure MRTG.
# more requirement is , perl version 5.004_05. Look at the documentation
# on MRTG this one needs you to have some patches for some OS.
#
# If you want to use getting iformation from a remote DNS, sure you could use
# my script dns.named but beware that this is NOT safe maybe you should use
# If you want to use getting iformation from a remote DNS, sure you could use
# scp to get youre file, but if not, be sure to set the rights so no non-auth
# could see what password is.
# dns.named requires expect version 5.26.0 (i havent tested on other versions)
#
# im not the greatest script maker but i managed this to work, but if
# you have any comments or you have some great changes please be free to send them to calle at volvo.se
# HOSTNAME youre domain this will show up in the web-page
#
# OK now to this new version of this program
# $LOG is where you find youre named.stats *
# in Bind 8.2.1 the way to get youre named.stats is "ndc stats"
# in Bind 4.9.3 kill -ABRT `cat /var/run/named.pid`
# in Bind kill -ILL `cat /var/run/named.pid`
#
# $RUN you have to set that to where youre script is set to run ex my $RUN = "/home/myhomeaccount/";
#
# now to the real new thing that is you can have 2 graphs in one MRTG session
# you have to set the $INCOMING and $OUTGOING, $INCOMING = $D_STAT{"RQ"}; <-- this one needs to be set to look
# for wich Data you want to see on the first Graph (RQ is Requested Queries)
#
# now to the other $OUTGOING = $D_STAT{"RFail"}; i set default but can be changed for what you want
# RFail Requested Failure i done a short list of What some of them means , but if you want to have a complete list
# you could look into the DNS and Bind book from O'reilly page 166
#
# Short list of some of the things you could pull out
#
# RQ: Requested Queries.
# RR: Count of responses recieved from relay.
# RIQ: Count of reverse queries recieved from relay.
# RNXD: Count of "no such domain" answeres.
# RFwdQ: Count of queries received from relay that nedded more processing
# RFwdR: Count of is the reponses recived from relay that answered the
# original query and were passed back to application.
# RDupR: Is the count of duplicat response from relay.
# RFail: Is the count of SERVFAIL response from relay.
# RFErr: is the count of FORMERR response from relay.
# RErr: is the count of errors that werent either SERVFAIL or FORMERR
# RLame: Count of lame DELEGATIONS.
# and so on read the book.
my $HOSTNAME = "dns1t";
my $LOG = "/usr/local/mrtg-2/contrib/stat/";
my $RUN = "/usr/local/mrtg-2/contrib/stat/";
my $INCOMING = $D_STAT{"RQ"};
my $OUTGOING = $D_STAT{"RFail"};
#######################################
#### Please Dont toch this part
######################################
my $QUE_P_MIN =();
my $QUE_P_OTHER = ();
my @N_STATS=();
my @OLD_S=();
my $UPTIME = ();
sub HIST {
open (STAT , "$LOG") or die "could not find or open file $LOG";
@N_STAT = <STAT>;
close (STAT);
open (V_OLD , "$RUN/OLD");
my @OLD_S = <V_OLD>;
close (V_OLD);
my $G_FLAG = "no";
foreach $line (@N_STAT) {
if ( $line =~ m/^([0-9]+)\s+\S+\s+\S+\sreset/ ){
$UPTIME = $1;
}
if ( $G_FLAG =~ /yes/) {
my @NUM_QUE=split ' ',$line;
open ( LOGGER , "> $RUN/OLD");
print LOGGER "$NUM_QUE[$INCOMING]\n";
print LOGGER "$NUM_QUE[$OUTGOING]\n";
close ( LOGGER );
$QUE_P_MIN = $NUM_QUE[$INCOMING]-$OLD_S[0];
$QUE_P_OTHER = $NUM_QUE[$OUTGOING]-$OLD_S[1];
$G_FLAG = "no";
}
if ($line =~ /(Global)/) {
$G_FLAG = "yes";
}
}
print "$QUE_P_MIN\n$QUE_P_OTHER\n$UPTIME\n$HOSTNAME\n";
}
&HIST();
-------------------------------
named.stats:
-----------------------------
+++ Statistics Dump +++ (1044964525) Tue Feb 11 12:55:25 2003
5454 time since boot (secs)
5454 time since reset (secs)
0 Unknown query types
45 A queries
0 NS queries
0 MD queries
0 MF queries
0 CNAME queries
0 SOA queries
0 MB queries
0 MG queries
0 MR queries
0 NULL queries
0 WKS queries
16 PTR queries
0 HINFO queries
0 MINFO queries
2 MX queries
0 TXT queries
0 RP queries
0 AFSDB queries
0 X25 queries
0 ISDN queries
0 RT queries
0 NSAP queries
0 NSAP_PTR queries
0 SIG queries
0 KEY queries
0 PX queries
0 GPOS queries
2 AAAA queries
0 LOC queries
0 NXT queries
0 EID queries
0 NIMLOC queries
0 SRV queries
0 ATMA queries
0 NAPTR queries
0 KX queries
0 CERT queries
0 38 queries
0 39 queries
0 40 queries
0 41 queries
0 42 queries
0 43 queries
0 44 queries
0 45 queries
0 46 queries
0 47 queries
0 48 queries
0 49 queries
0 50 queries
0 51 queries
0 52 queries
0 53 queries
0 54 queries
0 55 queries
0 56 queries
0 57 queries
0 58 queries
0 59 queries
0 60 queries
0 61 queries
0 62 queries
0 63 queries
0 64 queries
0 65 queries
0 66 queries
0 67 queries
0 68 queries
0 69 queries
0 70 queries
0 71 queries
0 72 queries
0 73 queries
0 74 queries
0 75 queries
0 76 queries
0 77 queries
0 78 queries
0 79 queries
0 80 queries
0 81 queries
0 82 queries
0 83 queries
0 84 queries
0 85 queries
0 86 queries
0 87 queries
0 88 queries
0 89 queries
0 90 queries
0 91 queries
0 92 queries
0 93 queries
0 94 queries
0 95 queries
0 96 queries
0 97 queries
0 98 queries
0 99 queries
0 100 queries
0 101 queries
0 102 queries
0 103 queries
0 104 queries
0 105 queries
0 106 queries
0 107 queries
0 108 queries
0 109 queries
0 110 queries
0 111 queries
0 112 queries
0 113 queries
0 114 queries
0 115 queries
0 116 queries
0 117 queries
0 118 queries
0 119 queries
0 120 queries
0 121 queries
0 122 queries
0 123 queries
0 124 queries
0 125 queries
0 126 queries
0 127 queries
0 128 queries
0 129 queries
0 130 queries
0 131 queries
0 132 queries
0 133 queries
0 134 queries
0 135 queries
0 136 queries
0 137 queries
0 138 queries
0 139 queries
0 140 queries
0 141 queries
0 142 queries
0 143 queries
0 144 queries
0 145 queries
0 146 queries
0 147 queries
0 148 queries
0 149 queries
0 150 queries
0 151 queries
0 152 queries
0 153 queries
0 154 queries
0 155 queries
0 156 queries
0 157 queries
0 158 queries
0 159 queries
0 160 queries
0 161 queries
0 162 queries
0 163 queries
0 164 queries
0 165 queries
0 166 queries
0 167 queries
0 168 queries
0 169 queries
0 170 queries
0 171 queries
0 172 queries
0 173 queries
0 174 queries
0 175 queries
0 176 queries
0 177 queries
0 178 queries
0 179 queries
0 180 queries
0 181 queries
0 182 queries
0 183 queries
0 184 queries
0 185 queries
0 186 queries
0 187 queries
0 188 queries
0 189 queries
0 190 queries
0 191 queries
0 192 queries
0 193 queries
0 194 queries
0 195 queries
0 196 queries
0 197 queries
0 198 queries
0 199 queries
0 200 queries
0 201 queries
0 202 queries
0 203 queries
0 204 queries
0 205 queries
0 206 queries
0 207 queries
0 208 queries
0 209 queries
0 210 queries
0 211 queries
0 212 queries
0 213 queries
0 214 queries
0 215 queries
0 216 queries
0 217 queries
0 218 queries
0 219 queries
0 220 queries
0 221 queries
0 222 queries
0 223 queries
0 224 queries
0 225 queries
0 226 queries
0 227 queries
0 228 queries
0 229 queries
0 230 queries
0 231 queries
0 232 queries
0 233 queries
0 234 queries
0 235 queries
0 236 queries
0 237 queries
0 238 queries
0 239 queries
0 240 queries
0 241 queries
0 242 queries
0 243 queries
0 244 queries
0 245 queries
0 246 queries
0 247 queries
0 248 queries
0 249 queries
0 TSIG queries
0 IXFR queries
0 AXFR queries
0 MAILB queries
0 MAILA queries
2 ANY queries
++ Name Server Statistics ++
(Legend)
RR RNXD RFwdR RDupR RFail
RFErr RErr RAXFR RLame ROpts
SSysQ SAns SFwdQ SDupQ SErr
RQ RIQ RFwdQ RDupQ RTCP
SFwdR SFail SFErr SNaAns SNXD
(Global)
67 10 22 0 0 0 11 0 0 0 41 57 14 4 0 67 0 0 0 0 22 0 0 4 8
-- Name Server Statistics --
--- Statistics Dump --- (1044964525) Tue Feb 11 12:55:25 2003
+++ Statistics Dump +++ (1044964539) Tue Feb 11 12:55:39 2003
5468 time since boot (secs)
5468 time since reset (secs)
0 Unknown query types
45 A queries
0 NS queries
0 MD queries
0 MF queries
0 CNAME queries
0 SOA queries
0 MB queries
0 MG queries
0 MR queries
0 NULL queries
0 WKS queries
16 PTR queries
0 HINFO queries
0 MINFO queries
2 MX queries
0 TXT queries
0 RP queries
0 AFSDB queries
0 X25 queries
0 ISDN queries
0 RT queries
0 NSAP queries
0 NSAP_PTR queries
0 SIG queries
0 KEY queries
0 PX queries
0 GPOS queries
2 AAAA queries
0 LOC queries
0 NXT queries
0 EID queries
0 NIMLOC queries
0 SRV queries
0 ATMA queries
0 NAPTR queries
0 KX queries
0 CERT queries
0 38 queries
0 39 queries
0 40 queries
0 41 queries
0 42 queries
0 43 queries
0 44 queries
0 45 queries
0 46 queries
0 47 queries
0 48 queries
0 49 queries
0 50 queries
0 51 queries
0 52 queries
0 53 queries
0 54 queries
0 55 queries
0 56 queries
0 57 queries
0 58 queries
0 59 queries
0 60 queries
0 61 queries
0 62 queries
0 63 queries
0 64 queries
0 65 queries
0 66 queries
0 67 queries
0 68 queries
0 69 queries
0 70 queries
0 71 queries
0 72 queries
0 73 queries
0 74 queries
0 75 queries
0 76 queries
0 77 queries
0 78 queries
0 79 queries
0 80 queries
0 81 queries
0 82 queries
0 83 queries
0 84 queries
0 85 queries
0 86 queries
0 87 queries
0 88 queries
0 89 queries
0 90 queries
0 91 queries
0 92 queries
0 93 queries
0 94 queries
0 95 queries
0 96 queries
0 97 queries
0 98 queries
0 99 queries
0 100 queries
0 101 queries
0 102 queries
0 103 queries
0 104 queries
0 105 queries
0 106 queries
0 107 queries
0 108 queries
0 109 queries
0 110 queries
0 111 queries
0 112 queries
0 113 queries
0 114 queries
0 115 queries
0 116 queries
0 117 queries
0 118 queries
0 119 queries
0 120 queries
0 121 queries
0 122 queries
0 123 queries
0 124 queries
0 125 queries
0 126 queries
0 127 queries
0 128 queries
0 129 queries
0 130 queries
0 131 queries
0 132 queries
0 133 queries
0 134 queries
0 135 queries
0 136 queries
0 137 queries
0 138 queries
0 139 queries
0 140 queries
0 141 queries
0 142 queries
0 143 queries
0 144 queries
0 145 queries
0 146 queries
0 147 queries
0 148 queries
0 149 queries
0 150 queries
0 151 queries
0 152 queries
0 153 queries
0 154 queries
0 155 queries
0 156 queries
0 157 queries
0 158 queries
0 159 queries
0 160 queries
0 161 queries
0 162 queries
0 163 queries
0 164 queries
0 165 queries
0 166 queries
0 167 queries
0 168 queries
0 169 queries
0 170 queries
0 171 queries
0 172 queries
0 173 queries
0 174 queries
0 175 queries
0 176 queries
0 177 queries
0 178 queries
0 179 queries
0 180 queries
0 181 queries
0 182 queries
0 183 queries
0 184 queries
0 185 queries
0 186 queries
0 187 queries
0 188 queries
0 189 queries
0 190 queries
0 191 queries
0 192 queries
0 193 queries
0 194 queries
0 195 queries
0 196 queries
0 197 queries
0 198 queries
0 199 queries
0 200 queries
0 201 queries
0 202 queries
0 203 queries
0 204 queries
0 205 queries
0 206 queries
0 207 queries
0 208 queries
0 209 queries
0 210 queries
0 211 queries
0 212 queries
0 213 queries
0 214 queries
0 215 queries
0 216 queries
0 217 queries
0 218 queries
0 219 queries
0 220 queries
0 221 queries
0 222 queries
0 223 queries
0 224 queries
0 225 queries
0 226 queries
0 227 queries
0 228 queries
0 229 queries
0 230 queries
0 231 queries
0 232 queries
0 233 queries
0 234 queries
0 235 queries
0 236 queries
0 237 queries
0 238 queries
0 239 queries
0 240 queries
0 241 queries
0 242 queries
0 243 queries
0 244 queries
0 245 queries
0 246 queries
0 247 queries
0 248 queries
0 249 queries
0 TSIG queries
0 IXFR queries
0 AXFR queries
0 MAILB queries
0 MAILA queries
2 ANY queries
++ Name Server Statistics ++
(Legend)
RR RNXD RFwdR RDupR RFail
RFErr RErr RAXFR RLame ROpts
SSysQ SAns SFwdQ SDupQ SErr
RQ RIQ RFwdQ RDupQ RTCP
SFwdR SFail SFErr SNaAns SNXD
(Global)
67 10 22 0 0 0 11 0 0 0 41 57 14 4 0 67 0 0 0 0 22 0 0 4 8
-- Name Server Statistics --
--- Statistics Dump --- (1044964539) Tue Feb 11 12:55:39 2003
--------------------
thanks a'lot for any help
Philipp
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list