Annotation of embedaddon/dnsmasq/src/metrics.c, revision 1.1.1.2
1.1.1.2 ! misho 1: /* dnsmasq is Copyright (c) 2000-2022 Simon Kelley
1.1 misho 2:
3: This program is free software; you can redistribute it and/or modify
4: it under the terms of the GNU General Public License as published by
5: the Free Software Foundation; version 2 dated June, 1991, or
6: (at your option) version 3 dated 29 June, 2007.
7:
8: This program is distributed in the hope that it will be useful,
9: but WITHOUT ANY WARRANTY; without even the implied warranty of
10: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: GNU General Public License for more details.
12:
13: You should have received a copy of the GNU General Public License
14: along with this program. If not, see <http://www.gnu.org/licenses/>.
15: */
16:
17: #include "dnsmasq.h"
18:
19: const char * metric_names[] = {
20: "dns_cache_inserted",
21: "dns_cache_live_freed",
22: "dns_queries_forwarded",
23: "dns_auth_answered",
24: "dns_local_answered",
1.1.1.2 ! misho 25: "dns_stale_answered",
! 26: "dns_unanswered",
1.1 misho 27: "bootp",
28: "pxe",
29: "dhcp_ack",
30: "dhcp_decline",
31: "dhcp_discover",
32: "dhcp_inform",
33: "dhcp_nak",
34: "dhcp_offer",
35: "dhcp_release",
36: "dhcp_request",
37: "noanswer",
38: "leases_allocated_4",
39: "leases_pruned_4",
40: "leases_allocated_6",
41: "leases_pruned_6",
42: };
43:
44: const char* get_metric_name(int i) {
45: return metric_names[i];
46: }
1.1.1.2 ! misho 47:
! 48: void clear_metrics(void)
! 49: {
! 50: int i;
! 51: struct server *serv;
! 52:
! 53: for (i = 0; i < __METRIC_MAX; i++)
! 54: daemon->metrics[i] = 0;
! 55:
! 56: for (serv = daemon->servers; serv; serv = serv->next)
! 57: {
! 58: serv->queries = 0;
! 59: serv->failed_queries = 0;
! 60: serv->failed_queries = 0;
! 61: serv->retrys = 0;
! 62: serv->nxdomain_replies = 0;
! 63: serv->query_latency = 0;
! 64: }
! 65: }
! 66:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>