Commit c0153581 authored by Naoki Kambe's avatar Naoki Kambe
Browse files

[master] Merge branch 'trac2884'

parents 79154442 ca3f4ecf
......@@ -231,98 +231,107 @@ operation
<variablelist>
<varlistentry>
<term><replaceable>zonename</replaceable></term>
<term><replaceable>classname</replaceable></term>
<listitem><simpara>
An actual zone name or special zone name
<quote>_SERVER_</quote> representing the entire server.
Zone classes (e.g. IN, CH, and HS) are mixed and counted so
far. But these will be distinguished in future release.
An actual RR class name of the zone, e.g. IN, CH, and HS
</simpara>
<variablelist>
<varlistentry>
<term>soaoutv4</term>
<term><replaceable>zonename</replaceable></term>
<listitem><simpara>
Number of IPv4 SOA queries sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>soaoutv6</term>
<listitem><simpara>
Number of IPv6 SOA queries sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>axfrreqv4</term>
<listitem><simpara>
Number of IPv4 AXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>axfrreqv6</term>
<listitem><simpara>
Number of IPv6 AXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>ixfrreqv4</term>
<listitem><simpara>
Number of IPv4 IXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>ixfrreqv6</term>
<listitem><simpara>
Number of IPv6 IXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrsuccess</term>
<listitem><simpara>
Number of zone transfer requests succeeded.
These include the case where the zone turns
out to be the latest as a result of an
initial SOA query (and there is actually no
AXFR or IXFR transaction).
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrfail</term>
<listitem><simpara>
Number of zone transfer requests failed
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>last_axfr_duration</term>
<listitem><simpara>
Duration in seconds of the last successful AXFR. 0.0
means no successful AXFR done or means a successful AXFR
done in less than a microsecond. If an AXFR is aborted
due to some failure, this duration won't be updated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>last_ixfr_duration</term>
<listitem><simpara>
Duration in seconds of the last successful IXFR. 0.0
means no successful IXFR done or means a successful IXFR
done in less than a microsecond. If an IXFR is aborted
due to some failure, this duration won't be updated.
</simpara></listitem>
</varlistentry>
An actual zone name or special zone name
<quote>_SERVER_</quote> representing the entire server
</simpara>
<variablelist>
<varlistentry>
<term>soaoutv4</term>
<listitem><simpara>
Number of IPv4 SOA queries sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>soaoutv6</term>
<listitem><simpara>
Number of IPv6 SOA queries sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>axfrreqv4</term>
<listitem><simpara>
Number of IPv4 AXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>axfrreqv6</term>
<listitem><simpara>
Number of IPv6 AXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>ixfrreqv4</term>
<listitem><simpara>
Number of IPv4 IXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>ixfrreqv6</term>
<listitem><simpara>
Number of IPv6 IXFR requests sent from Xfrin
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrsuccess</term>
<listitem><simpara>
Number of zone transfer requests succeeded.
These include the case where the zone turns
out to be the latest as a result of an
initial SOA query (and there is actually no
AXFR or IXFR transaction).
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrfail</term>
<listitem><simpara>
Number of zone transfer requests failed
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>last_axfr_duration</term>
<listitem><simpara>
Duration in seconds of the last successful AXFR. 0.0
means no successful AXFR done or means a successful AXFR
done in less than a microsecond. If an AXFR is aborted
due to some failure, this duration won't be updated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>last_ixfr_duration</term>
<listitem><simpara>
Duration in seconds of the last successful IXFR. 0.0
means no successful IXFR done or means a successful IXFR
done in less than a microsecond. If an IXFR is aborted
due to some failure, this duration won't be updated.
</simpara></listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry><!-- end of zonename -->
</variablelist>
</listitem>
</varlistentry><!-- end of zonename -->
</varlistentry><!-- end of classname -->
</variablelist>
</listitem>
......
......@@ -2182,6 +2182,7 @@ class TestStatisticsXfrinConn(TestXfrinConnection):
name2count.update(overwrite)
for (name, exp) in name2count.items():
act = self.conn._counters.get(self.__zones,
TEST_RRCLASS_STR,
TEST_ZONE_NAME_STR,
name)
msg = '%s is expected %s but actually %s' % (name, exp, act)
......
......@@ -875,8 +875,9 @@ class XfrinConnection(asyncore.dispatcher):
self._send_query(RRType.SOA)
# count soaoutv4 or soaoutv6 requests
self._counters.inc('zones', self._zone_name.to_text(),
'soaout' + self._get_ipver_str())
self._counters.inc('zones', self._rrclass.to_text(),
self._zone_name.to_text(), 'soaout' +
self._get_ipver_str())
data_len = self._get_request_response(2)
msg_len = socket.htons(struct.unpack('H', data_len)[0])
soa_response = self._get_request_response(msg_len)
......@@ -918,12 +919,17 @@ class XfrinConnection(asyncore.dispatcher):
# Note: If the timer for the zone is already started but
# not yet stopped due to some error, the last start time
# is overwritten at this point.
self._counters.start_timer('zones', self._zone_name.to_text(),
'last_' + req_str.lower() + '_duration')
self._counters.start_timer('zones',
self._rrclass.to_text(),
self._zone_name.to_text(),
'last_' + req_str.lower() +
'_duration')
logger.info(XFRIN_XFR_TRANSFER_STARTED, req_str, self.zone_str())
# An AXFR or IXFR is being requested.
self._counters.inc('zones', self._zone_name.to_text(),
req_str.lower() + 'req' + self._get_ipver_str())
self._counters.inc('zones', self._rrclass.to_text(),
self._zone_name.to_text(),
req_str.lower() + 'req' +
self._get_ipver_str())
self._send_query(self._request_type)
self.__state = XfrinInitialSOA()
self._handle_xfrin_responses()
......@@ -988,11 +994,13 @@ class XfrinConnection(asyncore.dispatcher):
# A xfrsuccess or xfrfail counter is incremented depending on
# the result.
result = {XFRIN_OK: 'xfrsuccess', XFRIN_FAIL: 'xfrfail'}[ret]
self._counters.inc('zones', self._zone_name.to_text(), result)
self._counters.inc('zones', self._rrclass.to_text(),
self._zone_name.to_text(), result)
# The started statistics timer is finally stopped only in
# a successful case.
if ret == XFRIN_OK:
self._counters.stop_timer('zones',
self._rrclass.to_text(),
self._zone_name.to_text(),
'last_' + req_str.lower() +
'_duration')
......
......@@ -135,110 +135,120 @@
"item_type": "named_set",
"item_optional": false,
"item_default": {
"_SERVER_" : {
"soaoutv4": 0,
"soaoutv6": 0,
"axfrreqv4": 0,
"axfrreqv6": 0,
"ixfrreqv4": 0,
"ixfrreqv6": 0,
"xfrsuccess": 0,
"xfrfail": 0,
"last_ixfr_duration": 0.0,
"last_axfr_duration": 0.0
"IN" : {
"_SERVER_" : {
"soaoutv4": 0,
"soaoutv6": 0,
"axfrreqv4": 0,
"axfrreqv6": 0,
"ixfrreqv4": 0,
"ixfrreqv6": 0,
"xfrsuccess": 0,
"xfrfail": 0,
"last_ixfr_duration": 0.0,
"last_axfr_duration": 0.0
}
}
},
"item_title": "Zone names",
"item_description": "A directory name of per-zone statistics",
"named_set_item_spec": {
"item_name": "zonename",
"item_type": "map",
"item_name": "classname",
"item_type": "named_set",
"item_optional": false,
"item_default": {},
"item_title": "Zone name",
"item_description": "An actual zone name or special zone name _SERVER_ representing the entire server. Zone classes (e.g. IN, CH, and HS) are mixed and counted so far. But these will be distinguished in future release.",
"map_item_spec": [
{
"item_name": "soaoutv4",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "SOAOutv4",
"item_description": "Number of IPv4 SOA queries sent from Xfrin"
},
{
"item_name": "soaoutv6",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "SOAOutv6",
"item_description": "Number of IPv6 SOA queries sent from Xfrin"
},
{
"item_name": "axfrreqv4",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "AXFRReqv4",
"item_description": "Number of IPv4 AXFR requests sent from Xfrin"
},
{
"item_name": "axfrreqv6",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "AXFRReqv6",
"item_description": "Number of IPv6 AXFR requests sent from Xfrin"
},
{
"item_name": "ixfrreqv4",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "IXFRReqv4",
"item_description": "Number of IPv4 IXFR requests sent from Xfrin"
},
{
"item_name": "ixfrreqv6",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "IXFRReqv6",
"item_description": "Number of IPv6 IXFR requests sent from Xfrin"
},
{
"item_name": "xfrsuccess",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "XfrSuccess",
"item_description": "Number of zone transfer requests succeeded. These include the case where the zone turns out to be the latest as a result of an initial SOA query (and there is actually no AXFR or IXFR transaction)."
},
{
"item_name": "xfrfail",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "XfrFail",
"item_description": "Number of zone transfer requests failed"
},
{
"item_name": "last_axfr_duration",
"item_type": "real",
"item_optional": false,
"item_default": 0.0,
"item_title": "Last AXFR duration",
"item_description": "Duration in seconds of the last successful AXFR. 0.0 means no successful AXFR done or means a successful AXFR done in less than a microsecond. If an AXFR is aborted due to some failure, this duration won't be updated."
},
{
"item_name": "last_ixfr_duration",
"item_type": "real",
"item_optional": false,
"item_default": 0.0,
"item_title": "Last IXFR duration",
"item_description": "Duration in seconds of the last successful IXFR. 0.0 means no successful IXFR done or means a successful IXFR done in less than a microsecond. If an IXFR is aborted due to some failure, this duration won't be updated."
}
]
"item_title": "RR class name",
"item_description": "An actual RR class name of the zone, e.g. IN, CH, and HS",
"named_set_item_spec": {
"item_name": "zonename",
"item_type": "map",
"item_optional": false,
"item_default": {},
"item_title": "Zone name",
"item_description": "An actual zone name or special zone name _SERVER_ representing the entire server",
"map_item_spec": [
{
"item_name": "soaoutv4",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "SOAOutv4",
"item_description": "Number of IPv4 SOA queries sent from Xfrin"
},
{
"item_name": "soaoutv6",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "SOAOutv6",
"item_description": "Number of IPv6 SOA queries sent from Xfrin"
},
{
"item_name": "axfrreqv4",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "AXFRReqv4",
"item_description": "Number of IPv4 AXFR requests sent from Xfrin"
},
{
"item_name": "axfrreqv6",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "AXFRReqv6",
"item_description": "Number of IPv6 AXFR requests sent from Xfrin"
},
{
"item_name": "ixfrreqv4",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "IXFRReqv4",
"item_description": "Number of IPv4 IXFR requests sent from Xfrin"
},
{
"item_name": "ixfrreqv6",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "IXFRReqv6",
"item_description": "Number of IPv6 IXFR requests sent from Xfrin"
},
{
"item_name": "xfrsuccess",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "XfrSuccess",
"item_description": "Number of zone transfer requests succeeded. These include the case where the zone turns out to be the latest as a result of an initial SOA query (and there is actually no AXFR or IXFR transaction)."
},
{
"item_name": "xfrfail",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "XfrFail",
"item_description": "Number of zone transfer requests failed"
},
{
"item_name": "last_axfr_duration",
"item_type": "real",
"item_optional": false,
"item_default": 0.0,
"item_title": "Last AXFR duration",
"item_description": "Duration in seconds of the last successful AXFR. 0.0 means no successful AXFR done or means a successful AXFR done in less than a microsecond. If an AXFR is aborted due to some failure, this duration won't be updated."
},
{
"item_name": "last_ixfr_duration",
"item_type": "real",
"item_optional": false,
"item_default": 0.0,
"item_title": "Last IXFR duration",
"item_description": "Duration in seconds of the last successful IXFR. 0.0 means no successful IXFR done or means a successful IXFR done in less than a microsecond. If an IXFR is aborted due to some failure, this duration won't be updated."
}
]
}
}
}
]
......
......@@ -171,44 +171,56 @@
<variablelist>
<varlistentry>
<term><replaceable>zonename</replaceable></term>
<term><replaceable>classname</replaceable></term>
<listitem><simpara>
A actual zone name or special zone name <quote>_SERVER_</quote>
representing an entire server
An actual RR class name of the zone, e.g. IN, CH, and HS
</simpara>
<variablelist>
<varlistentry>
<term>notifyoutv4</term>
<term><replaceable>zonename</replaceable></term>
<listitem><simpara>
Number of IPv4 notifies per zone name sent out from Xfrout
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>notifyoutv6</term>
<listitem><simpara>
Number of IPv6 notifies per zone name sent out from Xfrout
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrrej</term>
<listitem><simpara>
Number of XFR requests per zone name rejected by Xfrout
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrreqdone</term>
<listitem><simpara>
Number of requested zone transfers per zone name completed
</simpara></listitem>
</varlistentry>
An actual zone name or special zone
name <quote>_SERVER_</quote> representing an entire
server
</simpara>
<variablelist>
<varlistentry>
<term>notifyoutv4</term>
<listitem><simpara>
Number of IPv4 notifies per zone name sent out from Xfrout
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>notifyoutv6</term>
<listitem><simpara>
Number of IPv6 notifies per zone name sent out from Xfrout
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrrej</term>
<listitem><simpara>
Number of XFR requests per zone name rejected by Xfrout
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>xfrreqdone</term>
<listitem><simpara>
Number of requested zone transfers per zone name completed
</simpara></listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry><!-- end of zonename -->
</variablelist>
</listitem>
</varlistentry><!-- end of zonename -->
</varlistentry><!-- end of classname -->
</variablelist>
</listitem>
......
# Copyright (C) 2010-2012 Internet Systems Consortium.
# Copyright (C) 2010-2013 Internet Systems Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
......@@ -41,6 +41,7 @@ TSIG_KEY = TSIGKey("example.com:SFuWd/q99SzF8Yzd1QbB9g==")
TEST_ZONE_NAME_STR = "example.com."
TEST_ZONE_NAME = Name(TEST_ZONE_NAME_STR)
TEST_RRCLASS = RRClass.IN
TEST_RRCLASS_STR = TEST_RRCLASS.to_text()
IXFR_OK_VERSION = 2011111802
IXFR_NG_VERSION = 2011111803
SOA_CURRENT_VERSION = 2011112001
......@@ -441,7 +442,8 @@ class TestXfroutSession(TestXfroutSessionBase):
# check the 'xfrrej' counter initially
self.assertRaises(isc.cc.data.DataNotFoundError,
self.xfrsess._counters.get, 'zones',
TEST_ZONE_NAME_STR, 'xfrrej')
TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej')
# Localhost (the default in this test) is accepted
rcode, msg = self.xfrsess._parse_query_message(self.mdata)
self.assertEqual(rcode.to_text(), "NOERROR")
......@@ -457,7 +459,8 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertEqual(rcode.to_text(), "REFUSED")
# check the 'xfrrej' counter after incrementing
self.assertEqual(self.xfrsess._counters.get(
'zones', TEST_ZONE_NAME_STR, 'xfrrej'), 1)
'zones', TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej'), 1)
# TSIG signed request
request_data = self.create_request_data(with_tsig=True)
......@@ -488,7 +491,8 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertEqual(rcode.to_text(), "REFUSED")
# check the 'xfrrej' counter after incrementing
self.assertEqual(self.xfrsess._counters.get(
'zones', TEST_ZONE_NAME_STR, 'xfrrej'), 2)
'zones', TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej'), 2)
# ACL using TSIG: no TSIG; should be rejected
acl_setter(isc.acl.dns.REQUEST_LOADER.load([
......@@ -498,7 +502,8 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertEqual(rcode.to_text(), "REFUSED")
# check the 'xfrrej' counter after incrementing
self.assertEqual(self.xfrsess._counters.get(
'zones', TEST_ZONE_NAME_STR, 'xfrrej'), 3)
'zones', TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej'), 3)
#
# ACL using IP + TSIG: both should match
......@@ -520,7 +525,8 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertEqual(rcode.to_text(), "REFUSED")
# check the 'xfrrej' counter after incrementing
self.assertEqual(self.xfrsess._counters.get(
'zones', TEST_ZONE_NAME_STR, 'xfrrej'), 4)
'zones', TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej'), 4)
# Address matches, but TSIG doesn't (not included)
self.xfrsess._remote = (socket.AF_INET, socket.SOCK_STREAM,
('192.0.2.1', 12345))
......@@ -528,7 +534,8 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertEqual(rcode.to_text(), "REFUSED")
# check the 'xfrrej' counter after incrementing
self.assertEqual(self.xfrsess._counters.get(
'zones', TEST_ZONE_NAME_STR, 'xfrrej'), 5)
'zones', TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej'), 5)
# Neither address nor TSIG matches
self.xfrsess._remote = (socket.AF_INET, socket.SOCK_STREAM,
('192.0.2.2', 12345))
......@@ -536,7 +543,8 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertEqual(rcode.to_text(), "REFUSED")
# check the 'xfrrej' counter after incrementing
self.assertEqual(self.xfrsess._counters.get(
'zones', TEST_ZONE_NAME_STR, 'xfrrej'), 6)
'zones', TEST_RRCLASS_STR, TEST_ZONE_NAME_STR,
'xfrrej'), 6)
def test_transfer_acl(self):
# ACL checks only with the default ACL
......@@ -936,12 +944,14 @@ class TestXfroutSession(TestXfroutSessionBase):
self.assertRaises(isc.cc.data.DataNotFoundError,
self.xfrsess._counters.get,
'zones', TEST_ZONE_NAME_STR, 'xfrreqdone')
'zones', TEST_RRCLASS_STR,
TEST_ZONE_NAME_STR, 'xfrreqdone')
self.xfrsess._reply_xfrout_query = myreply