:class: longtable
:widths: 20 10 70
- +--------------------------------+----------------+-----------------------------------+
- | Statistic | Data Type | Description |
- +================================+================+===================================+
- | pkt4-received | integer | Number of DHCPv4 packets |
- | | | received. This includes all |
- | | | packets: valid, bogus, |
- | | | corrupted, rejected, etc. This |
- | | | statistic is expected to grow |
- | | | rapidly. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-discover-received | integer | Number of |
- | | | DHCPDISCOVER packets |
- | | | received. This |
- | | | statistic is expected |
- | | | to grow; its increase |
- | | | means that clients |
- | | | that just booted |
- | | | started their |
- | | | configuration process |
- | | | and their initial |
- | | | packets reached the |
- | | | Kea server. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-offer-received | integer | Number of DHCPOFFER |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to remain |
- | | | zero at all times, as |
- | | | DHCPOFFER packets are |
- | | | sent by the server |
- | | | and the server is |
- | | | never expected to |
- | | | receive them. A |
- | | | non-zero value |
- | | | indicates an error. |
- | | | One likely cause |
- | | | would be a |
- | | | misbehaving relay |
- | | | agent that |
- | | | incorrectly forwards |
- | | | DHCPOFFER messages |
- | | | towards the server, |
- | | | rather than back to |
- | | | the clients. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-request-received | integer | Number of DHCPREQUEST |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to grow. Its |
- | | | increase means that |
- | | | clients that just |
- | | | booted received the |
- | | | server's response |
- | | | (DHCPOFFER) and |
- | | | accepted it, and are |
- | | | now requesting an |
- | | | address |
- | | | (DHCPREQUEST). |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-ack-received | integer | Number of DHCPACK |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to remain |
- | | | zero at all times, as |
- | | | DHCPACK packets are |
- | | | sent by the server |
- | | | and the server is |
- | | | never expected to |
- | | | receive them. A |
- | | | non-zero value |
- | | | indicates an error. |
- | | | One likely cause |
- | | | would be a |
- | | | misbehaving relay |
- | | | agent that |
- | | | incorrectly forwards |
- | | | DHCPACK messages |
- | | | towards the server, |
- | | | rather than back to |
- | | | the clients. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-nak-received | integer | Number of DHCPNAK |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to remain |
- | | | zero at all times, as |
- | | | DHCPNAK packets are |
- | | | sent by the server |
- | | | and the server is |
- | | | never expected to |
- | | | receive them. A |
- | | | non-zero value |
- | | | indicates an error. |
- | | | One likely cause |
- | | | would be a |
- | | | misbehaving relay |
- | | | agent that |
- | | | incorrectly forwards |
- | | | DHCPNAK messages |
- | | | towards the server, |
- | | | rather than back to |
- | | | the clients. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-release-received | integer | Number of DHCPRELEASE |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to grow. Its |
- | | | increase means that |
- | | | clients that had an |
- | | | address are shutting |
- | | | down or ceasing to |
- | | | use their addresses. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-decline-received | integer | Number of DHCPDECLINE |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to remain |
- | | | close to zero. Its |
- | | | increase means that a |
- | | | client leased an |
- | | | address, but |
- | | | discovered that the |
- | | | address is currently |
- | | | used by an unknown |
- | | | device in the |
- | | | network. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-inform-received | integer | Number of DHCPINFORM |
- | | | packets received. |
- | | | This statistic is |
- | | | expected to grow. Its |
- | | | increase means that |
- | | | there are clients |
- | | | that either do not |
- | | | need an address or |
- | | | already have an |
- | | | address and are |
- | | | interested only in |
- | | | getting additional |
- | | | configuration |
- | | | parameters. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-unknown-received | integer | Number of packets |
- | | | received of an |
- | | | unknown type. A |
- | | | non-zero value of |
- | | | this statistic |
- | | | indicates that the |
- | | | server received a |
- | | | packet that it wasn't |
- | | | able to recognize, |
- | | | either with an |
- | | | unsupported type or |
- | | | possibly malformed |
- | | | (without message type |
- | | | option). |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-sent | integer | Number of DHCPv4 |
- | | | packets sent. This |
- | | | statistic is expected |
- | | | to grow every time |
- | | | the server transmits |
- | | | a packet. In general, |
- | | | it should roughly |
- | | | match pkt4-received, |
- | | | as most incoming |
- | | | packets cause the |
- | | | server to respond. |
- | | | There are exceptions |
- | | | (e.g. DHCPRELEASE), |
- | | | so do not worry if it |
- | | | is less than |
- | | | pkt4-received. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-offer-sent | integer | Number of DHCPOFFER |
- | | | packets sent. This |
- | | | statistic is expected |
- | | | to grow in most cases |
- | | | after a DHCPDISCOVER |
- | | | is processed. There |
- | | | are certain uncommon, |
- | | | but valid, cases |
- | | | where incoming |
- | | | DHCPDISCOVER packets |
- | | | are dropped, but in |
- | | | general this |
- | | | statistic is expected |
- | | | to be close to |
- | | | pkt4-discover-received. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-ack-sent | integer | Number of DHCPACK |
- | | | packets sent. This |
- | | | statistic is expected |
- | | | to grow in most cases |
- | | | after a DHCPREQUEST |
- | | | is processed. There |
- | | | are certain cases |
- | | | where DHCPNAK is sent |
- | | | instead. In general, |
- | | | the sum of |
- | | | pkt4-ack-sent and |
- | | | pkt4-nak-sent should |
- | | | be close to |
- | | | pkt4-request-received. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-nak-sent | integer | Number of DHCPNAK |
- | | | packets sent. This |
- | | | statistic is expected |
- | | | to grow when the |
- | | | server chooses not to |
- | | | honor the address |
- | | | requested by a |
- | | | client. In general, |
- | | | the sum of |
- | | | pkt4-ack-sent and |
- | | | pkt4-nak-sent should |
- | | | be close to |
- | | | pkt4-request-received. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-parse-failed | integer | Number of incoming |
- | | | packets that could |
- | | | not be parsed. A |
- | | | non-zero value of |
- | | | this statistic |
- | | | indicates that the |
- | | | server received a |
- | | | malformed or |
- | | | truncated packet. |
- | | | This may indicate |
- | | | problems in the |
- | | | network, faulty |
- | | | clients, or a bug in |
- | | | the server. |
- +--------------------------------+----------------+-----------------------------------+
- | pkt4-receive-drop | integer | Number of incoming |
- | | | packets that were |
- | | | dropped. The exact |
- | | | reason for dropping |
- | | | packets is logged, |
- | | | but the most common |
- | | | reasons may be: an |
- | | | unacceptable packet |
- | | | type, direct |
- | | | responses are |
- | | | forbidden, or the |
- | | | server-id sent by the |
- | | | client does not match |
- | | | the server's |
- | | | server-id. |
- +--------------------------------+----------------+-----------------------------------+
- | subnet[id].total-addresses | integer | Total number of |
- | | | addresses available |
- | | | for DHCPv4 |
- | | | management; in other |
- | | | words, this is the |
- | | | sum of all addresses |
- | | | in all configured |
- | | | pools. This statistic |
- | | | changes only during |
- | | | configuration |
- | | | changes. Note it does |
- | | | not take into account |
- | | | any addresses that |
- | | | may be reserved due |
- | | | to host reservation. |
- | | | The *id* is the |
- | | | subnet-id of a given |
- | | | subnet. This |
- | | | statistic is exposed |
- | | | for each subnet |
- | | | separately, and is |
- | | | reset during a |
- | | | reconfiguration |
- | | | event. |
- +--------------------------------+----------------+-----------------------------------+
- | subnet[id].assigned-addresses | integer | Number of assigned |
- | | | addresses in a given |
- | | | subnet. It increases |
- | | | every time a new |
- | | | lease is allocated |
- | | | (as a result of |
- | | | receiving a |
- | | | DHCPREQUEST message) |
- | | | and is decreased |
- | | | every time a lease is |
- | | | released (a |
- | | | DHCPRELEASE message |
- | | | is received) or |
- | | | expires. The *id* is |
- | | | the subnet-id of the |
- | | | subnet. This |
- | | | statistic is exposed |
- | | | for each subnet |
- | | | separately, and is |
- | | | reset during a |
- | | | reconfiguration |
- | | | event. |
- +--------------------------------+----------------+-----------------------------------+
- | reclaimed-leases | integer | Number of expired |
- | | | leases that have been |
- | | | reclaimed since |
- | | | server startup. It is |
- | | | incremented each time |
- | | | an expired lease is |
- | | | reclaimed and is |
- | | | reset when the server |
- | | | is reconfigured. |
- +--------------------------------+----------------+-----------------------------------+
- | subnet[id].reclaimed-leases | integer | Number of expired |
- | | | leases associated |
- | | | with a given subnet |
- | | | (*id* is the |
- | | | subnet-id) that have |
- | | | been reclaimed since |
- | | | server startup. It is |
- | | | incremented each time |
- | | | an expired lease is |
- | | | reclaimed and is |
- | | | reset when the server |
- | | | is reconfigured. |
- +--------------------------------+----------------+-----------------------------------+
- | declined-addresses | integer | Number of IPv4 |
- | | | addresses that are |
- | | | currently declined; a |
- | | | count of the number |
- | | | of leases currently |
- | | | unavailable. Once a |
- | | | lease is recovered, |
- | | | this statistic will |
- | | | be decreased; |
- | | | ideally, this |
- | | | statistic should be |
- | | | zero. If this |
- | | | statistic is non-zero |
- | | | or increasing, a |
- | | | network administrator |
- | | | should investigate |
- | | | whether there is a |
- | | | misbehaving device in |
- | | | the network. This is |
- | | | a global statistic |
- | | | that covers all |
- | | | subnets. |
- +--------------------------------+----------------+-----------------------------------+
- | subnet[id].declined-addresses | integer | Number of IPv4 |
- | | | addresses that are |
- | | | currently declined in |
- | | | a given subnet; a |
- | | | count of the number |
- | | | of leases currently |
- | | | unavailable. Once a |
- | | | lease is recovered, |
- | | | this statistic will |
- | | | be decreased; |
- | | | ideally, this |
- | | | statistic should be |
- | | | zero. If this |
- | | | statistic is non-zero |
- | | | or increasing, a |
- | | | network administrator |
- | | | should investigate |
- | | | whether there is a |
- | | | misbehaving device in |
- | | | the network. The *id* |
- | | | is the subnet-id of a |
- | | | given subnet. This |
- | | | statistic is exposed |
- | | | for each subnet |
- | | | separately. |
- +--------------------------------+----------------+-----------------------------------+
- | reclaimed-declined-addresses | integer | Number of IPv4 |
- | | | addresses that were |
- | | | declined, but have |
- | | | now been recovered. |
- | | | Unlike |
- | | | declined-addresses, |
- | | | this statistic never |
- | | | decreases. It can be |
- | | | used as a long-term |
- | | | indicator of how many |
- | | | actual valid Declines |
- | | | were processed and |
- | | | recovered from. This |
- | | | is a global statistic |
- | | | that covers all |
- | | | subnets. |
- +--------------------------------+----------------+-----------------------------------+
- | subnet[id].reclaimed | integer | Number of IPv4 |
- | -declined-addresses | | addresses that were |
- | | | declined, but have |
- | | | now been recovered. |
- | | | Unlike |
- | | | declined-addresses, |
- | | | this statistic never |
- | | | decreases. It can be |
- | | | used as a long-term |
- | | | indicator of how many |
- | | | actual valid Declines |
- | | | were processed and |
- | | | recovered from. The |
- | | | *id* is the subnet-id |
- | | | of a given subnet. |
- | | | This statistic is |
- | | | exposed for each |
- | | | subnet separately. |
- +--------------------------------+----------------+-----------------------------------+
+ +------------------------------------------+----------------+-----------------------------------+
+ | Statistic | Data Type | Description |
+ +==========================================+================+===================================+
+ | pkt4-received | integer | Number of DHCPv4 packets |
+ | | | received. This includes all |
+ | | | packets: valid, bogus, |
+ | | | corrupted, rejected, etc. This |
+ | | | statistic is expected to grow |
+ | | | rapidly. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-discover-received | integer | Number of |
+ | | | DHCPDISCOVER packets |
+ | | | received. This |
+ | | | statistic is expected |
+ | | | to grow; its increase |
+ | | | means that clients |
+ | | | that just booted |
+ | | | started their |
+ | | | configuration process |
+ | | | and their initial |
+ | | | packets reached the |
+ | | | Kea server. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-offer-received | integer | Number of DHCPOFFER |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to remain |
+ | | | zero at all times, as |
+ | | | DHCPOFFER packets are |
+ | | | sent by the server |
+ | | | and the server is |
+ | | | never expected to |
+ | | | receive them. A |
+ | | | non-zero value |
+ | | | indicates an error. |
+ | | | One likely cause |
+ | | | would be a |
+ | | | misbehaving relay |
+ | | | agent that |
+ | | | incorrectly forwards |
+ | | | DHCPOFFER messages |
+ | | | towards the server, |
+ | | | rather than back to |
+ | | | the clients. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-request-received | integer | Number of DHCPREQUEST |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to grow. Its |
+ | | | increase means that |
+ | | | clients that just |
+ | | | booted received the |
+ | | | server's response |
+ | | | (DHCPOFFER) and |
+ | | | accepted it, and are |
+ | | | now requesting an |
+ | | | address |
+ | | | (DHCPREQUEST). |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-ack-received | integer | Number of DHCPACK |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to remain |
+ | | | zero at all times, as |
+ | | | DHCPACK packets are |
+ | | | sent by the server |
+ | | | and the server is |
+ | | | never expected to |
+ | | | receive them. A |
+ | | | non-zero value |
+ | | | indicates an error. |
+ | | | One likely cause |
+ | | | would be a |
+ | | | misbehaving relay |
+ | | | agent that |
+ | | | incorrectly forwards |
+ | | | DHCPACK messages |
+ | | | towards the server, |
+ | | | rather than back to |
+ | | | the clients. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-nak-received | integer | Number of DHCPNAK |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to remain |
+ | | | zero at all times, as |
+ | | | DHCPNAK packets are |
+ | | | sent by the server |
+ | | | and the server is |
+ | | | never expected to |
+ | | | receive them. A |
+ | | | non-zero value |
+ | | | indicates an error. |
+ | | | One likely cause |
+ | | | would be a |
+ | | | misbehaving relay |
+ | | | agent that |
+ | | | incorrectly forwards |
+ | | | DHCPNAK messages |
+ | | | towards the server, |
+ | | | rather than back to |
+ | | | the clients. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-release-received | integer | Number of DHCPRELEASE |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to grow. Its |
+ | | | increase means that |
+ | | | clients that had an |
+ | | | address are shutting |
+ | | | down or ceasing to |
+ | | | use their addresses. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-decline-received | integer | Number of DHCPDECLINE |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to remain |
+ | | | close to zero. Its |
+ | | | increase means that a |
+ | | | client leased an |
+ | | | address, but |
+ | | | discovered that the |
+ | | | address is currently |
+ | | | used by an unknown |
+ | | | device in the |
+ | | | network. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-inform-received | integer | Number of DHCPINFORM |
+ | | | packets received. |
+ | | | This statistic is |
+ | | | expected to grow. Its |
+ | | | increase means that |
+ | | | there are clients |
+ | | | that either do not |
+ | | | need an address or |
+ | | | already have an |
+ | | | address and are |
+ | | | interested only in |
+ | | | getting additional |
+ | | | configuration |
+ | | | parameters. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-unknown-received | integer | Number of packets |
+ | | | received of an |
+ | | | unknown type. A |
+ | | | non-zero value of |
+ | | | this statistic |
+ | | | indicates that the |
+ | | | server received a |
+ | | | packet that it wasn't |
+ | | | able to recognize, |
+ | | | either with an |
+ | | | unsupported type or |
+ | | | possibly malformed |
+ | | | (without message type |
+ | | | option). |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-sent | integer | Number of DHCPv4 |
+ | | | packets sent. This |
+ | | | statistic is expected |
+ | | | to grow every time |
+ | | | the server transmits |
+ | | | a packet. In general, |
+ | | | it should roughly |
+ | | | match pkt4-received, |
+ | | | as most incoming |
+ | | | packets cause the |
+ | | | server to respond. |
+ | | | There are exceptions |
+ | | | (e.g. DHCPRELEASE), |
+ | | | so do not worry if it |
+ | | | is less than |
+ | | | pkt4-received. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-offer-sent | integer | Number of DHCPOFFER |
+ | | | packets sent. This |
+ | | | statistic is expected |
+ | | | to grow in most cases |
+ | | | after a DHCPDISCOVER |
+ | | | is processed. There |
+ | | | are certain uncommon, |
+ | | | but valid, cases |
+ | | | where incoming |
+ | | | DHCPDISCOVER packets |
+ | | | are dropped, but in |
+ | | | general this |
+ | | | statistic is expected |
+ | | | to be close to |
+ | | | pkt4-discover-received. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-ack-sent | integer | Number of DHCPACK |
+ | | | packets sent. This |
+ | | | statistic is expected |
+ | | | to grow in most cases |
+ | | | after a DHCPREQUEST |
+ | | | is processed. There |
+ | | | are certain cases |
+ | | | where DHCPNAK is sent |
+ | | | instead. In general, |
+ | | | the sum of |
+ | | | pkt4-ack-sent and |
+ | | | pkt4-nak-sent should |
+ | | | be close to |
+ | | | pkt4-request-received. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-nak-sent | integer | Number of DHCPNAK |
+ | | | packets sent. This |
+ | | | statistic is expected |
+ | | | to grow when the |
+ | | | server chooses not to |
+ | | | honor the address |
+ | | | requested by a |
+ | | | client. In general, |
+ | | | the sum of |
+ | | | pkt4-ack-sent and |
+ | | | pkt4-nak-sent should |
+ | | | be close to |
+ | | | pkt4-request-received. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-parse-failed | integer | Number of incoming |
+ | | | packets that could |
+ | | | not be parsed. A |
+ | | | non-zero value of |
+ | | | this statistic |
+ | | | indicates that the |
+ | | | server received a |
+ | | | malformed or |
+ | | | truncated packet. |
+ | | | This may indicate |
+ | | | problems in the |
+ | | | network, faulty |
+ | | | clients, or a bug in |
+ | | | the server. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | pkt4-receive-drop | integer | Number of incoming |
+ | | | packets that were |
+ | | | dropped. The exact |
+ | | | reason for dropping |
+ | | | packets is logged, |
+ | | | but the most common |
+ | | | reasons may be: an |
+ | | | unacceptable packet |
+ | | | type, direct |
+ | | | responses are |
+ | | | forbidden, or the |
+ | | | server-id sent by the |
+ | | | client does not match |
+ | | | the server's |
+ | | | server-id. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | subnet[id].total-addresses | integer | Total number of |
+ | | | addresses available |
+ | | | for DHCPv4 |
+ | | | management; in other |
+ | | | words, this is the |
+ | | | sum of all addresses |
+ | | | in all configured |
+ | | | pools. This statistic |
+ | | | changes only during |
+ | | | configuration |
+ | | | changes. Note it does |
+ | | | not take into account |
+ | | | any addresses that |
+ | | | may be reserved due |
+ | | | to host reservation. |
+ | | | The *id* is the |
+ | | | subnet-id of a given |
+ | | | subnet. This |
+ | | | statistic is exposed |
+ | | | for each subnet |
+ | | | separately, and is |
+ | | | reset during a |
+ | | | reconfiguration |
+ | | | event. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | subnet[id].cumulative-assigned-addresses | integer | Cumulative number of assigned |
+ | | | addresses in a given |
+ | | | subnet. It increases |
+ | | | every time a new |
+ | | | lease is allocated |
+ | | | (as a result of |
+ | | | receiving a |
+ | | | DHCPREQUEST message) |
+ | | | and never decreased. |
+ | | | The *id* is the subnet-id |
+ | | | of the ubnet. This |
+ | | | statistic is exposed |
+ | | | for each subnet |
+ | | | separately, and is |
+ | | | reset during a |
+ | | | reconfiguration |
+ | | | event. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | subnet[id].assigned-addresses | integer | Number of assigned |
+ | | | addresses in a given |
+ | | | subnet. It increases |
+ | | | every time a new |
+ | | | lease is allocated |
+ | | | (as a result of |
+ | | | receiving a |
+ | | | DHCPREQUEST message) |
+ | | | and is decreased |
+ | | | every time a lease is |
+ | | | released (a |
+ | | | DHCPRELEASE message |
+ | | | is received) or |
+ | | | expires. The *id* is |
+ | | | the subnet-id of the |
+ | | | subnet. This |
+ | | | statistic is exposed |
+ | | | for each subnet |
+ | | | separately, and is |
+ | | | reset during a |
+ | | | reconfiguration |
+ | | | event. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | reclaimed-leases | integer | Number of expired |
+ | | | leases that have been |
+ | | | reclaimed since |
+ | | | server startup. It is |
+ | | | incremented each time |
+ | | | an expired lease is |
+ | | | reclaimed and is |
+ | | | reset when the server |
+ | | | is reconfigured. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | subnet[id].reclaimed-leases | integer | Number of expired |
+ | | | leases associated |
+ | | | with a given subnet |
+ | | | (*id* is the |
+ | | | subnet-id) that have |
+ | | | been reclaimed since |
+ | | | server startup. It is |
+ | | | incremented each time |
+ | | | an expired lease is |
+ | | | reclaimed and is |
+ | | | reset when the server |
+ | | | is reconfigured. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | declined-addresses | integer | Number of IPv4 |
+ | | | addresses that are |
+ | | | currently declined; a |
+ | | | count of the number |
+ | | | of leases currently |
+ | | | unavailable. Once a |
+ | | | lease is recovered, |
+ | | | this statistic will |
+ | | | be decreased; |
+ | | | ideally, this |
+ | | | statistic should be |
+ | | | zero. If this |
+ | | | statistic is non-zero |
+ | | | or increasing, a |
+ | | | network administrator |
+ | | | should investigate |
+ | | | whether there is a |
+ | | | misbehaving device in |
+ | | | the network. This is |
+ | | | a global statistic |
+ | | | that covers all |
+ | | | subnets. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | subnet[id].declined-addresses | integer | Number of IPv4 |
+ | | | addresses that are |
+ | | | currently declined in |
+ | | | a given subnet; a |
+ | | | count of the number |
+ | | | of leases currently |
+ | | | unavailable. Once a |
+ | | | lease is recovered, |
+ | | | this statistic will |
+ | | | be decreased; |
+ | | | ideally, this |
+ | | | statistic should be |
+ | | | zero. If this |
+ | | | statistic is non-zero |
+ | | | or increasing, a |
+ | | | network administrator |
+ | | | should investigate |
+ | | | whether there is a |
+ | | | misbehaving device in |
+ | | | the network. The *id* |
+ | | | is the subnet-id of a |
+ | | | given subnet. This |
+ | | | statistic is exposed |
+ | | | for each subnet |
+ | | | separately. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | reclaimed-declined-addresses | integer | Number of IPv4 |
+ | | | addresses that were |
+ | | | declined, but have |
+ | | | now been recovered. |
+ | | | Unlike |
+ | | | declined-addresses, |
+ | | | this statistic never |
+ | | | decreases. It can be |
+ | | | used as a long-term |
+ | | | indicator of how many |
+ | | | actual valid Declines |
+ | | | were processed and |
+ | | | recovered from. This |
+ | | | is a global statistic |
+ | | | that covers all |
+ | | | subnets. |
+ +------------------------------------------+----------------+-----------------------------------+
+ | subnet[id].reclaimed-declined-addresses | integer | Number of IPv4 |
+ | | | addresses that were |
+ | | | declined, but have |
+ | | | now been recovered. |
+ | | | Unlike |
+ | | | declined-addresses, |
+ | | | this statistic never |
+ | | | decreases. It can be |
+ | | | used as a long-term |
+ | | | indicator of how many |
+ | | | actual valid Declines |
+ | | | were processed and |
+ | | | recovered from. The |
+ | | | *id* is the subnet-id |
+ | | | of a given subnet. |
+ | | | This statistic is |
+ | | | exposed for each |
+ | | | subnet separately. |
+ +------------------------------------------+----------------+-----------------------------------+
.. _dhcp4-ctrl-channel:
and subnet-specific) are increased.
A note about statistics: The server does not decrease the
-assigned-addresses statistics when a DHCPDECLINE message is received and
+assigned-nas statistics when a DHCPDECLINE message is received and
processed successfully. While technically a declined address is no
-longer assigned, the primary usage of the assigned-addresses statistic
+longer assigned, the primary usage of the assigned-nas statistic
is to monitor pool utilization. Most people would forget to include
declined-addresses in the calculation, and simply use
-assigned-addresses/total-addresses. This would cause a bias towards
+assigned-nas/total-nas. This would cause a bias towards
under-representing pool utilization. As this has a potential for major
-issues, ISC decided not to decrease assigned-addresses immediately after
+issues, ISC decided not to decrease assigned-nas immediately after
receiving DHCPDECLINE, but to do it later when Kea recovers the address
back to the available pool.
| | | reconfiguration |
| | | event. |
+-----------------------------------------+-----------------------+------------------------+
+ | subnet[id].cumulative-assigned-nas | integer | Cumulative number of |
+ | | | NA addresses in a |
+ | | | given subnet that |
+ | | | were assigned. It |
+ | | | increases every time |
+ | | | a new lease is |
+ | | | allocated (as a |
+ | | | result of receiving a |
+ | | | REQUEST message) and |
+ | | | is never decreased. |
+ | | | The *id* is the |
+ | | | subnet-id of a given |
+ | | | subnet. This |
+ | | | statistic is exposed |
+ | | | for each subnet |
+ | | | separately, and is |
+ | | | reset during a |
+ | | | reconfiguration |
+ | | | event. |
+ +-----------------------------------------+-----------------------+------------------------+
| subnet[id].assigned-nas | integer | Number of NA |
| | | addresses in a given |
| | | subnet that are |
| | | reconfiguration |
| | | event. |
+-----------------------------------------+-----------------------+------------------------+
+ | subnet[id].cumulative-assigned-pds | integer | Cumulative number of |
+ | | | PD prefixes in a |
+ | | | given subnet that |
+ | | | were assigned. It |
+ | | | increases every time |
+ | | | a new lease is |
+ | | | allocated (as a |
+ | | | result of receiving a |
+ | | | REQUEST message) and |
+ | | | is never decreased. |
+ | | | The *id* is the |
+ | | | subnet-id of a given |
+ | | | subnet. This |
+ | | | statistic is exposed |
+ | | | for each subnet |
+ | | | separately, and is |
+ | | | reset during a |
+ | | | reconfiguration |
+ | | | event. |
+ +-----------------------------------------+-----------------------+------------------------+
| subnet[id].assigned-pds | integer | Number of PD prefixes |
| | | in a given subnet |
| | | that are assigned. It |
DHCPv4 management in the subnet. In other words, this is the
sum of all addresses in all the configured pools in the subnet.
+ - ``cumulative-assigned-addresses`` - the cumulative number of addresses
+ in the subnet that have been assigned to a client by the server
+ since it started.
+
- ``assigned-addresses`` - the number of addresses in the subnet that
are currently assigned to a client.
all the NA addresses in all the configured NA pools in the
subnet.
+ - ``cumulative-assigned-nas`` - the cumulative number of NA addresses
+ in the subnet that have been assigned to a client by the server
+ since it started.
+
- ``assigned-nas`` - the number of NA addresses in the subnet that
are currently assigned to a client.
management in the subnet. In other words, this is the sum of
all prefixes in all the configured prefix pools in the subnet.
+ - ``cumulative-assigned-pds`` - the cumulative number of prefixes
+ in the subnet that have been assigned to a client by the server
+ since it started.
+
- ``assigned-pds`` - the number of prefixes in the subnet that are
currently assigned to a client.
"text": "stat-lease4-get: 2 rows found",
"arguments": {
"result-set": {
- "columns": [ "subnet-id", "total-addresses", "assigned-addresses", "declined-addresses" ]
+ "columns": [ "subnet-id", "total-addresses", "cumulative-assigned-addresses", "assigned-addresses", "declined-addresses" ]
"rows": [
- [ 10, 256, 111, 0 ],
- [ 20, 4098, 2034, 4 ]
+ [ 10, 256, 300, 111, 0 ],
+ [ 20, 4098, 2034, 2034, 4 ]
],
"timestamp": "2018-05-04 15:03:37.000000"
}
"text": "stat-lease6-get: 2 rows found",
"arguments": {
"result-set": {
- "columns": [ "subnet-id", "total-nas", "assigned-nas", "declined-nas", "total-pds", "assigned-pds" ]
+ "columns": [ "subnet-id", "total-nas", "cumulative-assigned-nas", "assigned-nas", "declined-nas", "total-pds", "cumulative-assigned-pds", "assigned-pds" ]
"rows": [
- [ 10, 4096, 2400, 3, 0, 0],
- [ 20, 0, 0, 0, 1048, 233 ]
- [ 30, 256, 60, 0, 1048, 15 ]
+ [ 10, 4096, 5000, 2400, 3, 0, 0, 0],
+ [ 20, 0, 0, 0, 0, 1048, 300, 233 ]
+ [ 30, 256, 60, 60, 0, 1048, 15, 15 ]
],
"timestamp": "2018-05-04 15:03:37.000000"
}
}
// Create the empty result-set.
- std::vector<std::string>column_labels = { "subnet-id", "total-addreses",
- "assigned-addreses","declined-addreses"};
+ std::vector<std::string>column_labels = { "subnet-id", "total-addresses",
+ "cumulative-assigned-addresses",
+ "assigned-addresses",
+ "declined-addresses" };
ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
// Get the first query row
// Create the result-set map.
// labels could be class statics?
- std::vector<std::string>column_labels = { "subnet-id", "total-nas", "assigned-nas",
- "declined-nas", "total-pds", "assigned-pds"};
+ std::vector<std::string>column_labels = { "subnet-id", "total-nas",
+ "cumulative-assigned-nas",
+ "assigned-nas",
+ "declined-nas", "total-pds",
+ "cumulative-assigned-pds",
+ "assigned-pds" };
ElementPtr value_rows = createResultSet(result_wrapper, column_labels);
// Now we can run the stats query.
ElementPtr row = Element::createList();
row->add(Element::create(static_cast<int64_t>(subnet_id)));
row->add(Element::create(getSubnetStat(subnet_id, "total-addresses")));
+ row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-addresses")));
row->add(Element::create(assigned));
row->add(Element::create(declined));
value_rows->add(row);
ElementPtr row = Element::createList();
row->add(Element::create(static_cast<int64_t>(subnet_id)));
row->add(Element::create(getSubnetStat(subnet_id, "total-nas")));
+ row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-nas")));
row->add(Element::create(assigned));
row->add(Element::create(declined));
row->add(Element::create(getSubnetStat(subnet_id, "total-pds")));
+ row->add(Element::create(getSubnetStat(subnet_id, "cumulative-assigned-pds")));
row->add(Element::create(assigned_pds));
value_rows->add(row);
}
{
"result-set\": {
"columns\": [
- "subnet-id", "total-addreses",
- "assigned-addreses", "declined-addreses"
+ "subnet-id", "total-addresses",
+ "cumulative-assigned-addresses",
+ "assigned-addresses", "declined-addresses"
],
"rows\": [
- [ 30, 256, 100, 2 ],
- [ 40, 16, 0, 0 ],
- [ 50, 256, 35, 0 ],
+ [ 30, 256, 300, 100, 2 ],
+ [ 40, 16, 5, 0, 0 ],
+ [ 50, 256, 100, 35, 0 ],
],
timestamp\": \"2018-05-04 15:03:37.000000\" }
}
{
"result-set": {
"columns": [
- "subnet-id", "total-nas", "assigned-nas",
- "declined-nas", "total-pds", "assigned-pds"
+ "subnet-id", "total-nas", "cumulative-assigned-nas"
+ "assigned-nas", "declined-nas", "total-pds",
+ "cumulative-assigned-pds", "assigned-pds"
],
"rows": [
- [ 30, 16, 6, 0, 65536, 400 ],
- [ 40, 16777216, 989837, 0, 0, 0 ]
+ [ 30, 16, 20, 6, 0, 65536, 1000, 400 ],
+ [ 40, 16777216, 1100000, 989837, 0, 0, 0, 0 ]
],
"timestamp": "2018-05-04 15:03:37.000000" }
}
/// "result-set": {
/// "timestamp": "2018-03-22 09:43:30.815371",
/// "columns": ["subnet_id", "total-addresses",
+ /// "cumulative-assigned-addresses",
/// "assigned-addresses", "declined-addresses"],
/// "rows": [
- /// [1, 600, 450, 3],
+ /// [1, 600, 1000, 450, 3],
/// :
/// ]
/// }
/// "result-set": {
/// "timestamp": "2018-03-22 09:43:30.815371",
/// "columns": ["subnet_id", "total-nas",
+ /// "cumulative-assigned-nas",
/// "assigned-nas", "declined-nas",
- /// "total-pds", "assigned-pds"],
+ /// "total-pds", "cumulative-assigned-pds",
+ /// "assigned-pds"],
/// "rows": [
- /// [1, 600, 450, 3, 64, 10],
+ /// [1, 600, 1000, 450, 3, 64, 20, 10],
/// :
/// ]
/// }
-// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <cc/command_interpreter.h>
#include <cc/data.h>
#include <cc/data.h>
+#include <stats/stats_mgr.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gtest/gtest.h>
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::asiolink;
+using namespace isc::stats;
using namespace boost::posix_time;
namespace {
/// @param exp_result 0 - success, 1 - error, 2 - ...
/// @param exp_txt expected text response (optional)
void testCommand(string cmd_txt, int exp_result, string exp_txt,
- string exp_result_json = "") {
+ string exp_result_json = "") {
// Let's load the library first.
loadLib();
cfg_mgr.commit();
// Subnet 10
- // 2 assigned, 3 declined, 1 expired
+ // 300 cumulative, 2 assigned, 3 declined, 1 expired
+ setSubnetStat(10, "cumulative-assigned-addresses", 300);
addLease4("192.0.1.1", 10);
addLease4("192.0.1.2", 10, Lease::STATE_DECLINED);
addLease4("192.0.1.3", 10, Lease::STATE_DECLINED);
addLease4("192.0.1.6", 10, Lease::STATE_EXPIRED_RECLAIMED);
// Subnet 20
- // 3 assigned, 0 declined, 2 expired
+ // 10 cumulative, 3 assigned, 0 declined, 2 expired
+ setSubnetStat(20, "cumulative-assigned-addresses", 10);
addLease4("192.0.2.1", 20);
addLease4("192.0.2.2", 20);
addLease4("192.0.2.3", 20);
// Subnet 30 no leases
- // Subnet 40, 4 assigned
+ // Subnet 40, 4 cumulative, 4 assigned
+ setSubnetStat(40, "cumulative-assigned-addresses", 4);
addLease4("192.0.4.1", 40);
addLease4("192.0.4.2", 40);
addLease4("192.0.4.3", 40);
addLease4("192.0.4.4", 40);
- // Subnet 50, 1 assigned, 1 declined
+ // Subnet 50, 2 cumulative, 1 assigned, 1 declined
+ setSubnetStat(50, "cumulative-assigned-addresses", 2);
addLease4("192.0.5.1", 50);
addLease4("192.0.5.2", 50, Lease::STATE_DECLINED);
}
cfg_mgr.commit();
- // Subnet 10: 2 assigned NAs, 3 declined NAs, 1 expired NAs
+ // Subnet 10: 10000 cumulative NAs, 2 assigned, 3 declined, 1 expired
+ setSubnetStat(10, "cumulative-assigned-nas", 10000);
addLease6("2001:db8:1::1", 10);
addLease6("2001:db8:1::2", 10);
addLease6("2001:db8:1::3", 10, Lease::STATE_DECLINED);
addLease6("2001:db8:1::5", 10, Lease::STATE_DECLINED);
addLease6("2001:db8:1::6", 10, Lease::STATE_EXPIRED_RECLAIMED);
- // Subnet 20: 3 assigned NAs
+ // Subnet 20: 10 cumulative NAs, 3 assigned
+ setSubnetStat(20, "cumulative-assigned-nas", 10);
addLease6("2001:db8:2::1", 20);
addLease6("2001:db8:2::2", 20);
addLease6("2001:db8:2::3", 20);
- // Subnet 30: 1 assigned NAs, 1 declined NAs, 3 PDs
+ // Subnet 30: 2 cumulative NAs, 1 assigned, 1 declined,
+ // 4 cumulative PDs, 3 assigned
+ setSubnetStat(30, "cumulative-assigned-nas", 2);
addLease6("2001:db8:3::1", 30);
addLease6("2001:db8:3::2", 30, Lease::STATE_DECLINED);
+ setSubnetStat(30, "cumulative-assigned-pds", 4);
addPrefix("3001::1:0", 112, 30);
addPrefix("3001::2:0", 112, 30);
addPrefix("3001::3:0", 112, 30);
// Subnet 40: no leases
- // Subnet 50: 2 PDs
+ // Subnet 50: 1000 cumulative PDs, 2 assigned
+ setSubnetStat(50, "cumulative-assigned-pds", 1000);
addPrefix("5001::1:0", 112, 50);
addPrefix("5001::2:0", 112, 50);
}
addLease6(prefix, subnet_id, state, Lease::TYPE_PD, prefix_len);
}
+ /// @brief Creates a statistic
+ ///
+ /// @param subnet_id subnet identifier
+ /// @param name statistic name
+ /// @param value statistic value
+ void setSubnetStat(const SubnetID& subnet_id, const std::string& name,
+ int64_t value) {
+ StatsMgr& stats_mgr = StatsMgr::instance();
+ const std::string& stats_name =
+ stats_mgr.generateName("subnet", subnet_id, name);
+ stats_mgr.setValue(stats_name, value);
+ }
+
/// @brief Pointer to the lease manager
LeaseMgr* lmptr_;
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 10, 256, 2, 3 ],\n"
- " [ 20, 16, 3, 0 ],\n"
- " [ 30, 256, 0, 0 ],\n"
- " [ 40, 16, 4, 0 ],\n"
- " [ 50, 256, 1, 1 ]\n"
+ " [ 10, 256, 300, 2, 3 ],\n"
+ " [ 20, 16, 10, 3, 0 ],\n"
+ " [ 30, 256, 0, 0, 0 ],\n"
+ " [ 40, 16, 4, 4, 0 ],\n"
+ " [ 50, 256, 2, 1, 1 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 10, 256, 2, 3 ],\n"
- " [ 20, 16, 3, 0 ],\n"
- " [ 30, 256, 0, 0 ],\n"
- " [ 40, 16, 4, 0 ],\n"
- " [ 50, 256, 1, 1 ]\n"
+ " [ 10, 256, 300, 2, 3 ],\n"
+ " [ 20, 16, 10, 3, 0 ],\n"
+ " [ 30, 256, 0, 0, 0 ],\n"
+ " [ 40, 16, 4, 4, 0 ],\n"
+ " [ 50, 256, 2, 1, 1 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 20, 16, 3, 0 ],\n"
+ " [ 20, 16, 10, 3, 0 ],\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 10, 256, 2, 3 ],\n"
- " [ 20, 16, 3, 0 ],\n"
- " [ 30, 256, 0, 0 ],\n"
+ " [ 10, 256, 300, 2, 3 ],\n"
+ " [ 20, 16, 10, 3, 0 ],\n"
+ " [ 30, 256, 0, 0, 0 ],\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 20, 16, 3, 0 ],\n"
- " [ 30, 256, 0, 0 ],\n"
- " [ 40, 16, 4, 0 ],\n"
+ " [ 20, 16, 10, 3, 0 ],\n"
+ " [ 30, 256, 0, 0, 0 ],\n"
+ " [ 40, 16, 4, 4, 0 ],\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 30, 256, 0, 0 ],\n"
- " [ 40, 16, 4, 0 ],\n"
- " [ 50, 256, 1, 1 ],\n"
+ " [ 30, 256, 0, 0, 0 ],\n"
+ " [ 40, 16, 4, 4, 0 ],\n"
+ " [ 50, 256, 2, 1, 1 ],\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-addreses\",\n"
- " \"assigned-addreses\", \"declined-addreses\"\n"
+ " \"subnet-id\", \"total-addresses\",\n"
+ " \"cumulative-assigned-addresses\",\n"
+ " \"assigned-addresses\", \"declined-addresses\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 30, 256, 0, 0 ],\n"
- " [ 40, 16, 4, 0 ],\n"
+ " [ 30, 256, 0, 0, 0 ],\n"
+ " [ 40, 16, 4, 4, 0 ],\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 10, 65536, 2, 3, 0, 0 ],\n"
- " [ 20, 16777216, 3, 0, 0, 0 ],\n"
- " [ 30, 16, 1, 1, 65536, 3 ],\n"
- " [ 40, 16777216, 0, 0, 0, 0 ],\n"
- " [ 50, 0, 0, 0, 65536, 2 ]\n"
+ " [ 10, 65536, 10000, 2, 3, 0, 0, 0 ],\n"
+ " [ 20, 16777216, 10, 3, 0, 0, 0, 0 ],\n"
+ " [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
+ " [ 40, 16777216, 0, 0, 0, 0, 0, 0 ],\n"
+ " [ 50, 0, 0, 0, 0, 65536, 1000, 2 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 10, 65536, 2, 3, 0, 0 ],\n"
- " [ 20, 16777216, 3, 0, 0, 0 ],\n"
- " [ 30, 16, 1, 1, 65536, 3 ],\n"
- " [ 40, 16777216, 0, 0, 0, 0 ],\n"
- " [ 50, 0, 0, 0, 65536, 2 ]\n"
+ " [ 10, 65536, 10000, 2, 3, 0, 0, 0 ],\n"
+ " [ 20, 16777216, 10, 3, 0, 0, 0, 0 ],\n"
+ " [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
+ " [ 40, 16777216, 0, 0, 0, 0, 0, 0 ],\n"
+ " [ 50, 0, 0, 0, 0, 65536, 1000, 2 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 20, 16777216, 3, 0, 0, 0 ]\n"
+ " [ 20, 16777216, 10, 3, 0, 0, 0, 0 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 10, 65536, 2, 3, 0, 0 ],\n"
- " [ 20, 16777216, 3, 0, 0, 0 ],\n"
- " [ 30, 16, 1, 1, 65536, 3 ],\n"
+ " [ 10, 65536, 10000, 2, 3, 0, 0, 0 ],\n"
+ " [ 20, 16777216, 10, 3, 0, 0, 0, 0 ],\n"
+ " [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 20, 16777216, 3, 0, 0, 0 ],\n"
- " [ 30, 16, 1, 1, 65536, 3 ],\n"
- " [ 40, 16777216, 0, 0, 0, 0 ]\n"
+ " [ 20, 16777216, 10, 3, 0, 0, 0, 0 ],\n"
+ " [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
+ " [ 40, 16777216, 0, 0, 0, 0, 0, 0 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 30, 16, 1, 1, 65536, 3 ],\n"
- " [ 40, 16777216, 0, 0, 0, 0 ],\n"
- " [ 50, 0, 0, 0, 65536, 2 ]\n"
+ " [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
+ " [ 40, 16777216, 0, 0, 0, 0, 0, 0 ],\n"
+ " [ 50, 0, 0, 0, 0, 65536, 1000, 2 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
"{\n"
"\"result-set\": {\n"
" \"columns\": [\n"
- " \"subnet-id\", \"total-nas\", \"assigned-nas\",\n"
- " \"declined-nas\", \"total-pds\", \"assigned-pds\"\n"
+ " \"subnet-id\", \"total-nas\",\n"
+ " \"cumulative-assigned-nas\", \"assigned-nas\",\n"
+ " \"declined-nas\", \"total-pds\",\n"
+ " \"cumulative-assigned-pds\", \"assigned-pds\"\n"
" ],\n"
" \"rows\": [\n"
- " [ 30, 16, 1, 1, 65536, 3 ],\n"
- " [ 40, 16777216, 0, 0, 0, 0 ]\n"
+ " [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
+ " [ 40, 16777216, 0, 0, 0, 0, 0, 0 ]\n"
" ],\n"
" \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
"}\n"
ctx.currentIA().type_ == Lease::TYPE_NA ?
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ ctx.currentIA().type_ == Lease::TYPE_NA ?
+ "cumulative-assigned-nas" :
+ "cumulative-assigned-pds"),
+ static_cast<int64_t>(1));
}
}
ctx.currentIA().type_ == Lease::TYPE_NA ?
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ ctx.currentIA().type_ == Lease::TYPE_NA ?
+ "cumulative-assigned-nas" :
+ "cumulative-assigned-pds"),
+ static_cast<int64_t>(1));
}
return (lease);
ctx.currentIA().type_ == Lease::TYPE_NA ?
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ ctx.currentIA().type_ == Lease::TYPE_NA ?
+ "cumulative-assigned-nas" :
+ "cumulative-assigned-pds"),
+ static_cast<int64_t>(1));
}
} else {
ctx.currentIA().type_ == Lease::TYPE_NA ?
"assigned-nas" : "assigned-pds"),
static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", lease->subnet_id_,
+ ctx.currentIA().type_ == Lease::TYPE_NA ?
+ "cumulative-assigned-nas" :
+ "cumulative-assigned-pds"),
+ static_cast<int64_t>(1));
}
}
// The lease insertion succeeded, let's bump up the statistic.
StatsMgr::instance().addValue(
- StatsMgr::generateName("subnet", ctx.subnet_->getID(), "assigned-addresses"),
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ "assigned-addresses"),
+ static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ "cumulative-assigned-addresses"),
static_cast<int64_t>(1));
return (lease);
// We need to account for the re-assignment of The lease.
if (ctx.old_lease_->expired() || ctx.old_lease_->state_ == Lease::STATE_EXPIRED_RECLAIMED) {
StatsMgr::instance().addValue(
- StatsMgr::generateName("subnet", ctx.subnet_->getID(), "assigned-addresses"),
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ "assigned-addresses"),
+ static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ "cumulative-assigned-addresses"),
static_cast<int64_t>(1));
}
}
// We need to account for the re-assignment of The lease.
StatsMgr::instance().addValue(
- StatsMgr::generateName("subnet", ctx.subnet_->getID(), "assigned-addresses"),
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ "assigned-addresses"),
+ static_cast<int64_t>(1));
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", ctx.subnet_->getID(),
+ "cumulative-assigned-addresses"),
static_cast<int64_t>(1));
}
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"assigned-addresses"));
+ stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
+ "cumulative-assigned-addresses"));
+
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"declined-addresses"));
static_cast<int64_t>
((*subnet4)->getPoolCapacity(Lease::
TYPE_V4)));
+ const std::string& name =
+ StatsMgr::generateName("subnet", subnet_id, "cumulative-assigned-addresses");
+ if (!stats_mgr.getObservation(name)) {
+ stats_mgr.setValue(name, static_cast<int64_t>(0));
+ }
}
// Only recount the stats if we have subnets.
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"assigned-nas"));
+ stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
+ "cumulative-assigned-nas"));
+
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id, "total-pds"));
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"assigned-pds"));
+ stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
+ "cumulative-assigned-pds"));
+
stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
"declined-addresses"));
"total-pds"),
static_cast<int64_t>
((*subnet6)->getPoolCapacity(Lease::TYPE_PD)));
+
+ const std::string& name_nas =
+ StatsMgr::generateName("subnet", subnet_id, "cumulative-assigned-nas");
+ if (!stats_mgr.getObservation(name_nas)) {
+ stats_mgr.setValue(name_nas, static_cast<int64_t>(0));
+ }
+
+ const std::string& name_pds =
+ StatsMgr::generateName("subnet", subnet_id, "cumulative-assigned-pds");
+ if (!stats_mgr.getObservation(name_pds)) {
+ stats_mgr.setValue(name_pds, static_cast<int64_t>(0));
+ }
}
// Only recount the stats if we have subnets.
// Assigned addresses should be zero.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
+
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
false, true, "somehost.example.com.", false);
ctx.query_.reset(new Pkt4(DHCPREQUEST, 1234));
// Assigned addresses should have incremented.
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
// Second allocation starts here.
uint8_t hwaddr2_data[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
// Assigned addresses should have incremented.
EXPECT_TRUE(testStatistics("assigned-addresses", 2, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
}
// This test checks that simple allocation uses the default valid lifetime.
// Assigned addresses should be zero.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
+
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
IOAddress("0.0.0.0"), false, true,
"host.example.com.", true);
// Assigned addresses should still be zero.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-addresses", subnet_->getID()));
}
ASSERT_TRUE(engine);
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
false, true, "somehost.example.com.", false);
// We should have incremented assigned-addresses
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
// Do it again, this should amount to the renew of an existing lease
Lease4Ptr lease2 = engine->allocateLease4(ctx);
// Should NOT have bumped assigned-addresses
EXPECT_TRUE(testStatistics("assigned-addresses", 1, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
}
// This test checks simple renewal uses the default valid lifetime.
IOAddress addr("192.0.2.105");
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
// added the lease directly, assigned-leases never bumped to one, so when we
// reclaim it gets decremented to -1, then on assignment back to 0.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 1));
EXPECT_TRUE(testStatistics("reclaimed-leases", 1, subnet_->getID()));
}
subnet_->addPool(pool_);
cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
cfg_mgr.commit(); // so we will recalc stats
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
// Now create a declined lease, decline it and rewind its cltt, so it
// is expired.
// Check that the stats declined stats were not modified
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-addresses", subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", 0));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 0));
EXPECT_TRUE(testStatistics("declined-addresses", 0, subnet_->getID()));
subnet_->addPool(pool_);
cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
cfg_mgr.commit();
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
// Now create a declined lease, decline it and rewind its cltt, so it
// is expired.
// when it is reused. Declined address stats will be -1 since
// lease was created as declined which does not increment the stat.
EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", -1));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 1));
EXPECT_TRUE(testStatistics("declined-addresses", -1, subnet_->getID()));
string name = StatsMgr::generateName("subnet", subnet_->getID(),
"assigned-addresses");
StatsMgr::instance().addValue(name, static_cast<int64_t>(100));
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
Lease4Ptr lease = engine->allocateLease4(ctx);
// The new lease has been allocated, so the old lease should not exist.
ObservationPtr stat = StatsMgr::instance().getObservation(name);
ASSERT_TRUE(stat);
EXPECT_EQ(101, stat->getInteger().first);
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
}
// This test checks if the fake allocation (for DHCPDISCOVER) can succeed
string name = StatsMgr::generateName("subnet", subnet_->getID(),
"assigned-addresses");
StatsMgr::instance().addValue(name, static_cast<int64_t>(100));
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
Lease4Ptr lease = engine->allocateLease4(ctx);
ObservationPtr stat = StatsMgr::instance().getObservation(name);
ASSERT_TRUE(stat);
EXPECT_EQ(100, stat->getInteger().first);
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-addresses", subnet_->getID()));
}
// This test checks that the allocated-addresses statistic is decreased when
string name = StatsMgr::generateName("subnet", subnet_->getID(),
"assigned-addresses");
StatsMgr::instance().addValue(name, static_cast<int64_t>(100));
+ int64_t cumulative = getStatistics("cumulative-assigned-addresses",
+ subnet_->getID());
// Request allocation of the reserved address.
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
ObservationPtr stat = StatsMgr::instance().getObservation(name);
ASSERT_TRUE(stat);
EXPECT_EQ(100, stat->getInteger().first);
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-addresses",
+ cumulative, subnet_->getID()));
// Lets' double check that the actual allocation took place.
EXPECT_FALSE(ctx.fake_allocation_);
TEST_F(AllocEngine6Test, simpleAlloc6) {
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
simpleAlloc6Test(pool_, IOAddress("::"), false);
// We should have bumped the assigned counter by 1
// We should have bumped the assigned counter by 2
EXPECT_TRUE(testStatistics("assigned-nas", 2, subnet_->getID()));
+ cumulative += 2;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
}
// This test checks that simple allocation uses default lifetimes.
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-pds", 0, subnet_->getID()));
+ // Get the cumulative count of assigned prefixes.
+ int64_t cumulative = getStatistics("cumulative-assigned-pds",
+ subnet_->getID());
+
simpleAlloc6Test(pd_pool_, IOAddress("::"), false);
// We should have bumped the assigned counter by 1
EXPECT_TRUE(testStatistics("assigned-pds", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-pds",
+ cumulative, subnet_->getID()));
}
// This test checks if the fake allocation (for SOLICIT) can succeed
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
simpleAlloc6Test(pool_, IOAddress("::"), true);
// We should not have bumped the assigned counter.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
}
// This test checks if the fake PD allocation (for SOLICIT) can succeed
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-pds", 0, subnet_->getID()));
+ // Get the cumulative count of assigned prefixes.
+ int64_t cumulative = getStatistics("cumulative-assigned-pds",
+ subnet_->getID());
+
simpleAlloc6Test(pd_pool_, IOAddress("::"), true);
// We should not have bumped the assigned counter
EXPECT_TRUE(testStatistics("assigned-pds", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-pds", subnet_->getID()));
}
// This test checks if the allocation with a hint that is valid (in range,
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
// Just a different duid
DuidPtr other_duid = DuidPtr(new DUID(vector<uint8_t>(12, 0xff)));
const uint32_t other_iaid = 3568;
// Verify the none of relevant stats were altered.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
}
subnet_->addPool(pool_);
cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
cfg_mgr.commit();
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
// Let's create an expired lease
DuidPtr other_duid = DuidPtr(new DUID(vector<uint8_t>(12, 0xff)));
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, other_duid, other_iaid,
501, 502, other_subnetid, HWAddrPtr(),
0));
+ int64_t other_cumulative = getStatistics("cumulative-assigned-nas", other_subnetid);
lease->cltt_ = time(NULL) - 500; // Allocated 500 seconds ago
lease->valid_lft_ = 495; // Lease was valid for 495 seconds
// Verify the stats got adjusted correctly
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
EXPECT_TRUE(testStatistics("assigned-nas", -1, other_subnetid));
+ EXPECT_EQ(other_cumulative,
+ getStatistics("cumulative-assigned-nas", other_subnetid));
EXPECT_TRUE(testStatistics("reclaimed-leases", 1));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 1, other_subnetid));
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
// Client gets an address
Lease6Ptr lease1 = simpleAlloc6Test(pool_, IOAddress("::"), false);
ASSERT_TRUE(lease1);
// We should have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
// Just check that if the client requests again, it will get the same
// address.
// We should not have bumped the address counter again
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
// Now admin creates a reservation for this client. This is in-pool
// reservation, as the pool is 2001:db8:1::10 - 2001:db8:1::20.
// Lastly check to see that the address counter is still 1, we should have
// have decremented it on the implied release and incremented it on the reserved
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
}
// In the following situation:
// - client X is assigned an address A
// Assigned count should be zero.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
// Client gets an address
Lease6Ptr lease1 = simpleAlloc6Test(pool_, IOAddress("::"), false);
ASSERT_TRUE(lease1);
// We should have bumped the address counter
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
// Just check that if the client requests again, it will get the same
// address.
// We should not have bumped the address counter again
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
// Now admin creates a reservation for this client. Let's use the
// address client X just received. Let's generate a host, but don't add it
// Lastly check to see that the address counter is still 1 we should have
// have decremented it on the implied release and incremented it on the reserved
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
}
// Checks that a reserved address for client A is not assigned when
EXPECT_TRUE(testStatistics("declined-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
// Now create a declined lease, decline it and rewind its cltt, so it
// is expired.
// Check that the stats were not modified
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ EXPECT_EQ(cumulative,
+ getStatistics("cumulative-assigned-nas", subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", 0));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 0));
EXPECT_TRUE(testStatistics("declined-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", 0, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
// Now create a declined lease, decline it and rewind its cltt, so it
// is expired.
Lease6Ptr declined = generateDeclinedLease(addr_txt, 100, -10);
// doesn't increment it from zero. reclaimed-declined-addresses will be 1
// because the leases are implicitly reclaimed before they can be assigned.
EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
EXPECT_TRUE(testStatistics("declined-addresses", -1));
EXPECT_TRUE(testStatistics("reclaimed-declined-addresses", 1));
EXPECT_TRUE(testStatistics("declined-addresses", -1, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet_->getID());
+
// Let's create an expired lease
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid_,
501, 502, subnet_->getID(), HWAddrPtr(),
// Verify assigned-nas got bumped. Reclaimed stats should still
// be zero as we artificially marked it reclaimed.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet_->getID()));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0));
EXPECT_TRUE(testStatistics("reclaimed-leases", 0, subnet_->getID()));
}
// the client is assigned a reserved address from a shared network which
// replaces existing lease within this shared network.
TEST_F(SharedNetworkAlloc6Test, requestSharedNetworkExistingLeases) {
+ // Get the cumulative count of assigned addresses.
+ int64_t cumulative = getStatistics("cumulative-assigned-nas",
+ subnet2_->getID());
+
// Create a lease in subnet 2 for this client. The lease is in expired
// reclaimed state initially to allow for checking whether the lease
// gets renewed.
// Statistics should be bumped when the lease is re-assigned.
EXPECT_TRUE(testStatistics("assigned-nas", 1, subnet2_->getID()));
+ cumulative += 1;
+ EXPECT_TRUE(testStatistics("cumulative-assigned-nas",
+ cumulative, subnet2_->getID()));
// Another interesting case is when there is a reservation in a different
// subnet than the one from which the ease has been assigned.
return (false);
}
+int64_t getStatistics(const std::string& stat_name, const SubnetID subnet_id) {
+ try {
+ std::string name = (subnet_id == SUBNET_ID_UNUSED ? stat_name :
+ StatsMgr::generateName("subnet", subnet_id, stat_name));
+ ObservationPtr observation = StatsMgr::instance().getObservation(name);
+ if (observation) {
+ return (observation->getInteger().first);
+ }
+ } catch (...) {
+ ;
+ }
+ return (0);
+}
+
void
AllocEngine4Test::testReuseLease4(const AllocEnginePtr& engine,
Lease4Ptr& existing_lease,
-// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
bool testStatistics(const std::string& stat_name, const int64_t exp_value,
const SubnetID subnet_id = SUBNET_ID_UNUSED);
+/// @brief Get a value held by statistic manager.
+///
+/// This function may be used in some allocation tests and there's no
+/// single base class for it. @todo consider moving it src/lib/util.
+///
+/// @param stat_name Statistic name.
+/// @param subnet_id subnet_id of the desired subnet, if not zero.
+/// @return the value held by the statistic manager or zero.
+int64_t getStatistics(const std::string& stat_name,
+ const SubnetID subnet_id = SUBNET_ID_UNUSED);
+
/// @brief Allocation engine with some internal methods exposed
class NakedAllocEngine : public AllocEngine {
public: