Author image Lorenzo Luconi Trombacchi

NAME

Net::DNS::Check::Config -

SYNOPSIS

 use Net::DNS::Check::Config;

 my $config = new Net::DNS::Check::Config();
 $config->test_conf( test => 'soa_refresh_range', level => 'I');
 $config->debug(0);

DESCRIPTION

A Config object is an instance of the Net::DNS::Check::Config class. With this object you can configure how Net::DNS::Check operates. You can set, for example, which tests will be executed during the check phase, set the debug level and several other options.

One of the main configurations that you can do with Net::DNS::Check::Config are about which tests will be executed and how to consider "succeeded" or "failed" anwsers from them. For this purpose is important to explain what it means when we talk about "status" or "status level". Every executed tests returns always an answer that can be "true" or "false" or if you prefer "succeeded" or "failed". The Net::DNS::Check::Config class define at present 4 different status level that can be associated to "succeeded" or "failed" answer returned from executed tests: OK, E (Error), W (Warning), I (Ignore).

Usually a "succeeded" answer from a test is associated to "OK" status level (you can change this association with "ok_status" function) and the association is made for all tests and is not possibile to set it test by test. The status associated to a "failed" answer can be set test by test using "test_conf" function (if don't use "test_conf" function all test inside "test_list" are set to "default_status" status value).

METHODS

new

This method create a new Net::DNS::Check object and returns a reference to it. Arguments are not available.

        use Net::DNS::Check::Config;

        my $config = new Net::DNS::Check::Config();

rootservers

With this method you can get or set the ip addresses of the root nameservers used by Net::DNS::Resolver::Recurse. The root nameservers list is stored or returned as an array reference.

        # Get
        print join(' ', @{ $config->rootservers() } );

        # Set
        $config->rootservers([qw( 198.41.0.4 128.9.0.107) ]);

debug_default

With this method you can get or set the default debug level. You can set the debug level with debug argument of the method "new" of Net::DNS::Check object and if the debug level is not specified the "debug_default" value, of Ne::DNS::Check::Config object, will be used.

At present 4 debug levels are supported:

  • Level 0: no debug information

  • Level 1: print to STDOUT information about executed actions

  • Level 2: as for level 1, but information about query answers are also displayed

  • Level 3: as for previous levels, but debug option of Net::DNS module is also activated.

The default value of "debug_default" is 0 (debug disabled).

        # Set
        $config->debug_default(2);

query_retrans

Get or set the retransmission interval used in the Net::DNS::Resolver object. The default value is 5.

query_retry

Get or set the number of times to try the query in the Net::DNS::Resolver. The default value is 2.

query_tcp_timeout

Get or set the default timeout in seconds for TCP queries (Net::DNS::Resolver tcp_timeout argument).

query_udp_timeout

Not yet implemented.

predefined_hosts

Working in progress.

test_conf (funzione)

This method is used to set the association for a "failed" answer from a test. This function support two arguments passed as hash: "test" and "level". The "test" argument is mandatory and contains the name of the test for which you want set or get the status level information. If you omit the "level" argument, this method return the status information about the test specified with the "test" argument.

        # Set the Warning status level for test "soa_expire_range"
        $config->test_conf( test => 'soa_expire_range', level => 'W' ); 

        # Get the status information about the test "soa_refresh_range"
        $config->test_conf( test => 'soa_refresh_range' ); 

ok_status

Get or set the "good" status. The default "good" status is "OK".

error_status

Get or set the list of status considered as "not good" or error status. The list is stored or returned as an array reference. The default "not good" status is: "E" (Error).

default_status

Get or Set the default status for a test. If a status is not specified for a test, the default status is used. The default value is "E" (Error).

test_list

Get or set the list of all the available tests (sublcass of Net::DNS::Check::Test). The list is stored or returned as an array reference. For additional information about available tests please see Net::DNS::Check::Test class.

        my @list = @{ $config->test_list() };
        push (@list, 'new_test');
        $config->test_list(\@list);

Every test inside the "test_list" are initialized to the "default_status" value. If you want to change the status level of a specific test you must use "test_conf" function:

        $config->test_list([qw( mx_compare mx_present ns_compare ns_vs_delegated ns_count]);
        # For all this tests a default_status is set.
        # If you want change the status of a specific test use test_conf function.
        # For example this set for "mx_present" test a "warning" (W) level.
        $config->test_conf( test => 'mx_present', level => 'W' );

test_level

This method is used to query Net::DNS::Check::Conf for supported status levels. It can be used to know either the list of all supported status levels (returned as an hash) or to translate from short status name to long status name (example from "W" to "Warning"). o

        $config->test_level();
        # Return an hash containing the list of all supported status level:
        # 'W' => 'Warning', 'OK' => 'OK', 'E' => 'Error', 'I' => 'Ignore'

        $config->test_level('W');
        # Return 'Warning'

ns_min_count

Get or set the minimun number of NS RR for the domain you want to check. This number is used in the Net::DNS::Check::Test::ns_count test. The default value is 2.

        $config->ns_min_coung(3);

ns_max_count

Get or set the maximum number of NS RR for the domain you want to check. This number is used in the Net::DNS::Check::Test::ns_count test. The default value is 0, so there is no maximum limit.

        $config->ns_max_count(7);

soa_min_retry

Get or set the minimum value required for the retry time in the SOA record. This number is used in the Net::DNS::Check::Test::soa_retry_range test. The default value is 1800.

soa_max_retry

Get or set the maximum value required for the retry time in the SOA record. This number is used in the Net::DNS::Check::Test::soa_retry_range test. The default value is 28800. A value of 0 disable the maximum limit for the retry time.

soa_min_refresh

Get or set the minimum value required for the refresh time in the SOA record. This number is used in the Net::DNS::Check::Test::soa_refresh_range test. The default value is 1800.

soa_max_refresh

Get or set the minimum value required for the refresh time in the SOA record. This number is used in the Net::DNS::Check::Test::soa_refresh_range test. The default value is 1800. A value of 0 disable the maximum limit for the refresh time.

soa_min_expire

Get or set the minimum value required for the expire time in the SOA record. This number is used in the Net::DNS::Check::Test::soa_expire_range test. The default value is 86400.

soa_max_expire

Get or set the maximum value required for the expire time in the SOA record. This number is used in the Net::DNS::Check::Test::soa_expire_range test. The default value is 0 so there is not maximum limit for the expire time.

ip_private

Get or set the list of the private IP addresses (see RFC1597 ). The list is stored or returned as an array reference. This list is used in the Net::DNS::Check::Test::host_ip_private test. The default values are:

    10 127 172.16 172.17 172.18 172.19 172.20 172.21 172.22 172.23 172.24 172.25 172.26 172.27 172.28 172.29 172.30 172.31 192.168

COPYRIGHT

Copyright (c) 2005 Lorenzo Luconi Trombacchi - IIT-CNR

All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1)