| Net-DNS-Check documentation | view source | Contained in the Net-DNS-Check distribution. |
Net::DNS::Check::Check - OOP Perl module based on Net::DNS for domain name checking.
use Net::DNS::Check; my $dnscheck = new Net::DNS::Check( domain => 'foo.com' ); print ($dnscheck->check()?'OK':'FAILED'); use Net::DNS::Check; use Net::DNS::Check::Config; my $config = new Net::DNS::Check::Config(); $config->test_conf( test => 'soa_refresh_range', level => 'I'); my $dnscheck = new Net::DNS::Check( domain => 'foo.com', config => $config, nserver => 'ns.acme.com;ns2.acme.com=1.2.3.4', debug => 1 ); print ($dnscheck->check()?'OK':'FAILED');
Net::DNS::Check is a collection of OOP Perl modules allowing easy implementation of applications for domain name checking.
The Net::DNS::Check was built to be as easy as possible to use and highly configurable and flexible: it allow easy implementation of your custom test and deeper configuration of what you want to check and how.
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 test will be executed during the check phase, set the debug level and several other options. For additional information see Net::DNS::Check::Config.
Net::DNS::Check::Test is the base class for test objects. A test is the single analysis that you can execute during the checking phase of a domain name. You can create a subclass of Net::DNS::Check::Test class and generate your custom test. For additional information see Net::DNS::Check::Test. At present these are the supported tests:
Check if the IP addresses found during the hosts resolution do not belong to IP private classes.
Compare the IP addresses found during the hosts resolution with the IP addresses given with nserver argument (if exists) in method "new".
Check if the hosts found are CNAME or not.
Verify the correctness of the hosts syntax.
Compare the MX RR found.
Check if the MX RR is present or not.
Check if the NS RR are the same in all the authoritative nameservers.
Check if the number of NS RR are within the range set in the configuration object. For additional information see: Net::DNS::Check::Config.
Compare the NS RR found with the effectively delegated nameservers (NS RR in the parent zone of the domain name being checked).
Compare the expire time of all the authoritative nameservers.
Check if the expire time in the SOA RR is within the range set in the configuration object. For additional information see: Net::DNS::Check::Config.
Compare the value of the master nameserver specified in the SOA RR of all the authoritative nameservers.
Check if the NS RR exists for the master nameserver specified in the SOA RR.
Compare the refresh time in SOA RR of all authoritative nameservers.
Check if the refresh time in the SOA RR is within the range set in the configuration object. For additional information see: Net::DNS::Check::Config.
Compare the retry time in the SOA RR of all the authoritative nameservers.
Check if the retry time in the SOA RR is within the range set in the configuration object. For additional information see: Net::DNS::Check::Config.
Compare the serial number in the SOA RR of all the authoritative nameservers.
Check if the syntax of the serial number in the SOA RR are in the AAAAMMGGVV format.
domain: mandatory argument corresponding to the domain name you want to check
config: a reference to a Net::DNS::Check::Config object. This argument is optional and, if not present, the default configuration is used.
nserver: a string containing the list of all the authoritative nameservers. This argument is mandatory if the domain name to be cheked has not yet been delegated. The nserver string has a specific format: nserver_name=IP1,IP2...;nserver2_name=IP1;nserver3_name=IP1,IP2,IP3;...
The IP addresses are mandatory only for the nameservers within a domain name which has not yet been delegated. As many nameservers as necessary cab be typed into the nserver string.
Examples:
ns.foo.com=10.0.0.1;ns2.foo.com=192.168.1.1,192.168.3.100
ns.amce.com;ns4.foo.com=10.1.1.1
debug: with this argument the required debug level can be set:
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.
# $dnscheck is Net::DNS::Check object $dnscheck->check();
# Print the number of test in OK status
print $dnscheck->test_summary('OK')
# Return the hash of all the status # ********* ATTENZIONE attualmente riporta un hash reference, # stabilire cosa e' meglio my %hash_status = $dnscheck->test_summary();
foreach my $status ( keys %hash_status ) {
print "$status: ". $hash_status{$status}."\n";
}
%ret = (
'ns.foo.com' => {
'desc' => '2005041700',
'status' => 1
},
'ns.acme.net' => {
'desc' => '20050320',
'status' => 0
},
);
foreach my $test_name ( $dnscheck->test_list() ) {
$result .= "\n$test_name: ".$dnscheck->test_status($test_name) ."\n";
$result .= "==============================\n";
my %test_detail = $dnscheck->test_detail($test_name);
foreach my $ns_name ( keys %test_detail ) {
if ( defined $test_detail{$ns_name}->{desc} ) {
my $detail_status = $test_detail{$ns_name}->{status};
my $detail_desc = $test_detail{$ns_name}->{desc};
$result .= "$ns_name: Status: $detail_status Desc: $detail_desc\n";
}
}
}
| Net-DNS-Check documentation | view source | Contained in the Net-DNS-Check distribution. |