From: Tomek Mrugalski Date: Mon, 18 May 2015 18:31:06 +0000 (+0200) Subject: [3794] Remaining stats added, docs updated. X-Git-Tag: throw_with_base~3^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afb45a9e6f5b697fe48d928d7ce94bc07fb1aaf5;p=thirdparty%2Fkea.git [3794] Remaining stats added, docs updated. --- diff --git a/doc/guide/Makefile.am b/doc/guide/Makefile.am index 8076fb673a..44e92987ae 100644 --- a/doc/guide/Makefile.am +++ b/doc/guide/Makefile.am @@ -7,7 +7,7 @@ dist_html_DATA = $(HTMLDOCS) kea-guide.css DOCBOOK = kea-guide.xml intro.xml quickstart.xml install.xml admin.xml config.xml DOCBOOK += keactrl.xml dhcp4-srv.xml dhcp6-srv.xml logging.xml ddns.xml hooks.xml -DOCBOOK += libdhcp.xml lfc.xml +DOCBOOK += libdhcp.xml lfc.xml stats.xml EXTRA_DIST = $(DOCBOOK) DISTCLEANFILES = $(HTMLDOCS) $(DOCS) kea-messages.xml diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index 41bd5852a0..34d6707bd7 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -2418,6 +2418,158 @@ temporarily override a list of interface names and listen on all interfaces. +
+ Statistics in DHCPv4 server + + This section describes DHCPv4-specific statistics. For a general + overview and usage of statistics, see . + + + + The DHCPv4 server supports the following statistics: + + + + + pkt4-received (integer) - this + statistic shows the the number of received packets. That includes + all packets: valid, bogus, corrupted, rejected etc. This statistic + is expected to grow rapidly. + + + pkt4-discover-received (integer) - + specifies the number of received DHCPDISCOVER packets. This statistic + is expected to grow. Its increase means that clients that just booted + started their configuration process and their initial packets reached + your server. + + + pkt4-offer-received (integer) - + specifies the number of received DHCPOFFER packets. 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. Non-zero + value indicates an error. One likely cause would be a misbehaving relay + agent that incorrectly forwards DHCPOFFER messages towards the server, + rather back to the clients. + + + pkt4-request-received (integer) - + specifies the number of received DHCPREQUEST packets. This statistic + is expected to grow. Its increase means that clients that just booted + received server's response (DHCPOFFER), accepted it and now requesting + an address (DHCPREQUEST). + + + pkt4-ack-received (integer) - + specifies the number of received DHCPACK packets. 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. Non-zero + value indicates an error. One likely cause would be a misbehaving relay + agent that incorrectly forwards DHCPACK messages towards the server, + rather back to the clients. + + + pkt4-nak-received (integer) - + specifies the number of received DHCPNAK packets. 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. Non-zero + value indicates an error. One likely cause would be a misbehaving relay + agent that incorrectly forwards DHCPNAK messages towards the server, + rather back to the clients. + + + pkt4-release-received (integer) - + specifies the number of received DHCPRELEASE packets. This statistic + is expected to grow. Its increase means that clients that had an address + are shutting down or stop using their addresses. + + + pkt4-decline-received (integer) - + specifies the number of received DHCPDECLINE packets. This statistic + is expected to remain close to zero. Its increase means that clients + that leased an address, but discovered that the address is currently + used by an unknown device in your network. + + + pkt4-decline-received (integer) - + specifies the number of received DHCPDECLINE packets. This statistic + is expected to remain close to zero. Its increase means that a client + that leased an address, but discovered that the address is currently + used by an unknown device in your network. + + + pkt4-inform-received (integer) - + specifies the number of received DHCPINFORM packets. 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) - + specifies the number of received packets of uknown type. Non-zero + value of this statistic indicates that the server received a packet + that it wasn't able to recognize: either with unsupported type + or possibly malformed (without message type option). + + + pkt4-sent (integer) - specifies the + number of sent DHCPv4 packets. 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 + server to respond. There are exceptions (e.g. DHCPRELEASE), so + do not worry, if it is lesser than pkt4-received. + + + pkt4-sent (integer) - specifies the + number of sent DHCPv4 packets. 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 + server to respond. There are exceptions (e.g. DHCPRELEASE), so + do not worry, if it is lesser than pkt4-received. + + + pkt4-offer-sent (integer) - specifies + the number of sent DHCPOFFER packets. This statistic is expected to + grow in most cases after a DHCPDISCOVER is processed. There are + certain uncommon, but valid cases where incoming DHCPDISCOVER is + dropped, but in general this statistic is expected to be close to + pkt4-discover-received. + + + pkt4-ack-sent (integer) - specifies + the number of sent DHCPACK packets. 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) - specifies + the number of sent DHCPNAK packets. This statistic is expected to + grow when the server choses to not 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) - this + statistic denote the number of packets that were received, but the + Kea server was unable to parse it. Non-zero value of this statistic + indicates that the server received malformed or truncated packet. + This may indicate problems in your network, faulty clients or server + code bug. + + + pkt4-receive-drop (integer) - this + statistic indicate number of incoming packets that were dropped. + Exact reason for dropping packets is logged, but the most common + reasons may be not accepted packet type, direct responses are + forbidden or the server-id the client had sent doesn't match the + server's. + + + +
Supported DHCP Standards diff --git a/doc/guide/kea-guide.xml b/doc/guide/kea-guide.xml index 0095931a6c..8610398d7e 100644 --- a/doc/guide/kea-guide.xml +++ b/doc/guide/kea-guide.xml @@ -73,6 +73,8 @@ + + diff --git a/doc/guide/stats.xml b/doc/guide/stats.xml new file mode 100644 index 0000000000..9f907c3713 --- /dev/null +++ b/doc/guide/stats.xml @@ -0,0 +1,33 @@ + + +]> + + + + + Statistics + +
+ Statistics Overview + + + TODO: Describe statistics collection here as part of ticket #3800. + For DHCPv4 specific statistics, see . + For DHCPv6 specific statistics, see TODO. + For DDNS specific statistics, see TODO. + +
+
+ diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 459a43aaeb..c398fe1fc6 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -465,6 +465,10 @@ Dhcpv4Srv::run() { .arg(query->getLocalAddr().toText()) .arg(query->getIface()) .arg(e.what()); + + // Increase the statistics of parse failues and dropped packets. + isc::stats::StatsMgr::instance().addValue("pkt4-parse-failed", 1ul); + isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop", 1ul); continue; } } @@ -480,6 +484,7 @@ Dhcpv4Srv::run() { // Check whether the message should be further processed or discarded. // There is no need to log anything here. This function logs by itself. if (!accept(query)) { + // Increase the statistic of dropped packets. isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop", 1ul); continue; } @@ -567,6 +572,9 @@ Dhcpv4Srv::run() { DHCP4_PACKET_DROP_0007) .arg(query->getLabel()) .arg(e.what()); + + // Increase the statistic of dropped packets. + isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop", 1ul); } if (!rsp) {