Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
monitors:retds [2015/03/17 10:24] – [retds.pl] wnelis | monitors:retds [2015/03/18 20:30] (current) – [Credits] jez | ||
---|---|---|---|
Line 9: | Line 9: | ||
===== Description ===== | ===== Description ===== | ||
- | Script retds.pl retrieves the DNS statistics of both BIND named servers and windows DNS servers. A table within this script specifies which statistics are to be extracted and defines the RRD file name and the DS name of these statistics at the same time. The DNS servers to be monitored by this script are defined in the Xymon hosts.cfg file, using keyword RNAMED. | + | |
+ | Script retds.pl retrieves the DNS statistics of both BIND named servers | ||
Script retds.pl is a rewrite (in Perl) of script xymon-rnamedstats.sh written by Jerimy Laidman. It is extended to handle Windows DNS servers as well. | Script retds.pl is a rewrite (in Perl) of script xymon-rnamedstats.sh written by Jerimy Laidman. It is extended to handle Windows DNS servers as well. | ||
Line 17: | Line 18: | ||
Although script retds.pl is a server-side script, there is some work to do at the client-side as well. | Although script retds.pl is a server-side script, there is some work to do at the client-side as well. | ||
+ | |||
=== Client side on a BIND server === | === Client side on a BIND server === | ||
Line 24: | Line 26: | ||
For example, the statistics could be collected using the following crontab entry of user root: | For example, the statistics could be collected using the following crontab entry of user root: | ||
0-55/5 * * * * / | 0-55/5 * * * * / | ||
- | The associated RNAMED keyword in the Xymon hosts.cfg is: | + | |
- | RNAMED: | + | |
=== Client side on a Windows DNS server === | === Client side on a Windows DNS server === | ||
Line 39: | Line 40: | ||
copy c: | copy c: | ||
- | This information is retrieved by Xymon using the following RNAMED keyword: | ||
- | RNAMED: | ||
=== Server side === | === Server side === | ||
+ | |||
+ | Script detds.pl will typically be placed in directory $XYMONHOME/ | ||
+ | |||
+ | [retds] | ||
+ | ENVFILE $XYMONHOME/ | ||
+ | CMD $XYMONHOME/ | ||
+ | LOGFILE $XYMONSERVERLOGS/ | ||
+ | INTERVAL 5m | ||
+ | |||
+ | In file $XYMONHOME/ | ||
+ | |||
+ | RNAMED: | ||
+ | TRENDS: | ||
+ | |||
+ | The same tags need to be specified for a Windows DNS server. Again, matching the example above the following values could be used: | ||
+ | |||
+ | RNAMED: | ||
+ | TRENDS: | ||
+ | |||
+ | In file $XYMONHOME/ | ||
===== Source ===== | ===== Source ===== | ||
Line 76: | Line 95: | ||
# title(< | # title(< | ||
# | # | ||
- | # In the commandline, a few substitutable variables may be specified. They are | + | # In the command line, a few substitutable variables may be specified. They are |
# replaced by their current value upon querying the host: | # replaced by their current value upon querying the host: | ||
# %{H} : Host name as defined in the xymon hosts.cfg file | # %{H} : Host name as defined in the xymon hosts.cfg file | ||
Line 243: | Line 262: | ||
# Handle keyword RNAMED: extract all its parameters. Two formats are allowed, | # Handle keyword RNAMED: extract all its parameters. Two formats are allowed, | ||
- | # one in which the whole parameterstring | + | # one in which the whole parameter string |
# one in which the part after RNAMED: is enclosed between double quotes. | # one in which the part after RNAMED: is enclosed between double quotes. | ||
($RNamed, | ($RNamed, | ||
Line 264: | Line 283: | ||
# | # | ||
- | # Function PolishName returns the inputstring, after replacing all | + | # Function PolishName returns the input string, after replacing all |
# non-alphanumeric characters by an underscore. | # non-alphanumeric characters by an underscore. | ||
# | # | ||
Line 276: | Line 295: | ||
# | # | ||
- | # Function Recent takes a timestamp | + | # Function Recent takes a time stamp and returns that value if the time stamp |
# lies between now and 10 minutes ago. If the clock of the DNS server is up to | # lies between now and 10 minutes ago. If the clock of the DNS server is up to | ||
# 10 seconds ahead wrt the time on the Xymon server, the current time at the | # 10 seconds ahead wrt the time on the Xymon server, the current time at the | ||
Line 298: | Line 317: | ||
# | # | ||
# Function QueryServer retrieves the dns statistics from one server. All | # Function QueryServer retrieves the dns statistics from one server. All | ||
- | # information needed is passed in the worklist | + | # information needed is passed in the work list entry. The retrieved information |
# is written to global list @Lines. | # is written to global list @Lines. | ||
# | # | ||
Line 328: | Line 347: | ||
# | # | ||
# Function ParseBindStatistics takes the raw statistics of a BIND server and | # Function ParseBindStatistics takes the raw statistics of a BIND server and | ||
- | # stores it in a multi-level | + | # stores it in a multi-level |
# | # | ||
sub ParseBindStatistics($) { | sub ParseBindStatistics($) { | ||
Line 380: | Line 399: | ||
# DNS service statistics to identify and extract all values. | # DNS service statistics to identify and extract all values. | ||
# | # | ||
- | # The statistics are divided into sections, each section is devided | + | # The statistics are divided into sections, each section is divided |
# more views. A view consists of one or more lines containing the name of a | # more views. A view consists of one or more lines containing the name of a | ||
# variable and its value. A section starts with the section name in the leftmost | # variable and its value. A section starts with the section name in the leftmost | ||
Line 395: | Line 414: | ||
# Sub-level lines are ignored. | # Sub-level lines are ignored. | ||
# | # | ||
- | # The statistics are augmented with a timestamp | + | # The statistics are augmented with a time stamp at the start. The first line |
# specifies the date, using format dd-mm-yyyy, the second line the time of | # specifies the date, using format dd-mm-yyyy, the second line the time of | ||
# collecting the statistics, using format hh:mm. | # collecting the statistics, using format hh:mm. | ||
Line 493: | Line 512: | ||
# | # | ||
- | # Function ParseStatistics invokes the appropiate | + | # Function ParseStatistics invokes the appropriate |
# source of the statistical information. | # source of the statistical information. | ||
# | # | ||
sub ParseStatistics($) { | sub ParseStatistics($) { | ||
- | my $W= shift ; # Ref to worklist | + | my $W= shift ; # Ref to work list item |
if ( $$W{source} eq ' | if ( $$W{source} eq ' | ||
Line 626: | Line 645: | ||
==== rrd-status.pl ==== | ==== rrd-status.pl ==== | ||
+ | |||
+ | If the statistics are sent to Xymon using a status message, a script like the one below is needed to parse the NCV data and pass them to an RRD. | ||
<hidden onHidden=" | <hidden onHidden=" | ||
< | < | ||
+ | # | ||
+ | # | ||
+ | # This script handles a list of NCVs, send by a Xymon client, and prepares it to | ||
+ | # be stored in an RRA. This script is used in cases in which a fixed-size group | ||
+ | # of two or more values should be put together into a single RRA. The algorithm | ||
+ | # is specific for each test / client. | ||
+ | # | ||
+ | # This script is invoked with three parameters: the name of the host, the name | ||
+ | # of the test and the name of the file containing the message sent by the | ||
+ | # client, containing the NCVs to be handled. | ||
+ | # | ||
+ | use strict; | ||
+ | # | ||
+ | # Installation constants. | ||
+ | # ----------------------- | ||
+ | # | ||
+ | # %Struct defines the datasets of the various tests. | ||
+ | # | ||
+ | my %Struct= ( | ||
+ | bindstats => [ # Must be sorted! | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ) ; # of %Struct | ||
+ | |||
+ | # | ||
+ | # Global variables. | ||
+ | # ----------------- | ||
+ | # | ||
+ | my ( $HostName, $TestName, $FileName )= @ARGV ; | ||
+ | # | ||
+ | my %Var= () ; # Save area measurements | ||
+ | my ( $Line, @Line ) ; # List of values of one measurement | ||
+ | my $key ; # Loop control variable | ||
+ | |||
+ | |||
+ | # | ||
+ | # Main program. | ||
+ | # ------------- | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # An attempt has been undertaken to make this code a little bit more general. | ||
+ | # The name of an NCV should consist of two names separated by "/" | ||
+ | # name becomes (part of) the name of the RRA, the second name becomes the | ||
+ | # name of the DS. The DS-ses are written in sorted order. | ||
+ | # | ||
+ | if ( $TestName eq ' | ||
+ | open( FH, "<", | ||
+ | while ( <FH> ) { | ||
+ | chomp ; | ||
+ | next unless m/ | ||
+ | $Var{$1}{$2}= $3 ; | ||
+ | } # of while | ||
+ | close( FH ) ; | ||
+ | |||
+ | print @{$Struct{$TestName}} ; | ||
+ | foreach $key ( sort keys %Var ) { | ||
+ | @Line= () ; | ||
+ | push @Line, $Var{$key}{$_} foreach ( sort keys %{$Var{$key}} ) ; | ||
+ | if ( $TestName eq $key ) { | ||
+ | print " | ||
+ | } else { | ||
+ | print " | ||
+ | } # of else | ||
+ | print join( ":", | ||
+ | } # of foreach | ||
+ | |||
+ | } # of if | ||
+ | |||
+ | exit 0 ; | ||
</ | </ | ||
</ | </ | ||
+ | ==== graphs.cfg, bindstats ==== | ||
+ | |||
+ | The following snippet defines a graph showing the collected BIND statistics. Add this snippet to $XYMONHOME/ | ||
+ | |||
+ | <hidden onHidden=" | ||
+ | < | ||
+ | [bindstats] | ||
+ | TITLE , Bind query rates | ||
+ | YAXIS Rate [q/s] | ||
+ | -l 0 | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | CDEF: | ||
+ | AREA: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | AREA: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | AREA: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | AREA: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | AREA: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== graphs.cfg, wdnsstats ==== | ||
+ | |||
+ | The following snippet defines a graph showing the collected Windows DNS statistics. | ||
+ | |||
+ | <hidden onHidden=" | ||
+ | < | ||
+ | [wdnsstats] | ||
+ | TITLE , DNS statistics | ||
+ | YAXIS Rate [/s] | ||
+ | -l 0 | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | DEF: | ||
+ | CDEF: | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | LINE1: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | </ | ||
+ | </ | ||
===== Known Bugs and Issues ===== | ===== Known Bugs and Issues ===== | ||
By default, the statistics are presented to Xymon using a so-called ' | By default, the statistics are presented to Xymon using a so-called ' | ||
+ | |||
+ | It is assumed that the BIND statistics file contains only one set of statistics. Thus the new statistics overwrite the old statistics, rather than being appended. | ||
This script is only tested using ' | This script is only tested using ' | ||
Line 642: | Line 828: | ||
===== Credits ===== | ===== Credits ===== | ||
- | Script retds.pl is written using script xymon-rnamedstats.sh written by Jerimy | + | Script retds.pl is written using script xymon-rnamedstats.sh written by Jeremy |
===== Changelog ===== | ===== Changelog ===== | ||