- /* requests/opcode -- [name] = [counter]
- * Variables: QUERY, IQUERY, NOTIFY, UPDATE, ... */
- if (use_requests) {
- if ((xpathObj = xmlXPathEvalExpression(BAD_CAST "server/requests/opcode", xpathCtx)) == NULL) {
- ERROR("bind plugin: unable to evaluate XPath expression StatsV1-currenttime");
- return -1;
- } else for (i = 0; xpathObj->nodesetval && i < xpathObj->nodesetval->nodeNr; i++) {
- xmlNode *name = NULL, *counter = NULL, *child;
- for (child = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode; child != NULL; child = child->next)
- if (xmlStrcmp (BAD_CAST "name", child->name) == 0)
- name = child;
- else if (xmlStrcmp (BAD_CAST "counter", child->name) == 0)
- counter = child;
- if (name && counter) {
- char *tinst = (char *) xmlNodeListGetString (doc, name->xmlChildrenNode, 1);
- counter_t val;
- if (!bind_xml_read_counter(doc, counter, &val))
- submit_counter(current_time, NULL, "dns_opcode", tinst, val);
- xmlFree(tinst);
- }
- }
- DEBUG ("bind plugin: Statv1: Found %d entries for requests/opcode", xpathObj->nodesetval->nodeNr);
- xmlXPathFreeObject(xpathObj);
- }
-
- /* queries-in/rdtype -- [name] = [counter]
- * Variables: RESERVED0, A, NS, CNAME, SOA, MR, PTR, HINFO, MX, TXT, RP, X25, PX, AAAA, LOC,
- * SRV, NAPTR, A6, DS, RRSIG, NSEC, DNSKEY, SPF, TKEY, IXFR, AXFR, ANY, ..., Others */
- if (use_rrqueries_in) {
- if ((xpathObj = xmlXPathEvalExpression(BAD_CAST "server/queries-in/rdtype", xpathCtx)) == NULL) {
- ERROR("bind plugin: unable to evaluate XPath expression StatsV1-currenttime");
- return -1;
- } else for (i = 0; xpathObj->nodesetval && i < xpathObj->nodesetval->nodeNr; i++) {
- xmlNode *name = NULL, *counter = NULL, *child;
- for (child = xpathObj->nodesetval->nodeTab[i]->xmlChildrenNode; child != NULL; child = child->next)
- if (xmlStrcmp (BAD_CAST "name", child->name) == 0)
- name = child;
- else if (xmlStrcmp (BAD_CAST "counter", child->name) == 0)
- counter = child;
- if (name && counter) {
- char *tinst = (char *) xmlNodeListGetString (doc, name->xmlChildrenNode, 1);
- counter_t val;
- if (!bind_xml_read_counter(doc, counter, &val))
- submit_counter(current_time, NULL, "dns_qtype", tinst, val);
- xmlFree(tinst);
- }
- }
- DEBUG ("bind plugin: Statv1: Found %d entries for queries-in/rdtype", xpathObj->nodesetval->nodeNr);
- xmlXPathFreeObject(xpathObj);
- }
-
- /* nsstats -- [$name] = [$value] */
- /* Variables: Requestv4, Requestv6, ReqEdns0, ReqBadEDNSVer, ReqTSIG, ReqSIG0, ReqBadSIG, ReqTCP,
- * AuthQryRej, RecQryRej, XfrRej, UpdateRej, Response, TruncatedResp, RespEDNS0, RespTSIG,
- * RespSIG0, QrySuccess, QryAuthAns, QryNoauthAns, QryReferral, QryNxrrset, QrySERVFAIL,
- * QryFORMERR, QryNXDOMAIN, QryRecursion, QryDuplicate, QryDropped, QryFailure, XfrReqDone,
- * UpdateReqFwd, UpdateRespFwd, UpdateFwdFail, UpdateDone, UpdateFail, UpdateBadPrereq */
- if (use_updates || use_query_results || use_requests) {
- if ((xpathObj = xmlXPathEvalExpression(BAD_CAST "server/nsstats", xpathCtx)) == NULL) {
- ERROR("bind plugin: unable to evaluate XPath expression StatsV1-nsstats");
- return -1;
- } else if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
- xmlNode *child;
- counter_t val;
- int n = 0;
- for (child = xpathObj->nodesetval->nodeTab[0]->xmlChildrenNode; child != NULL; child = child->next, n++)
- if (child->type == XML_ELEMENT_NODE && !bind_xml_read_counter(doc, child, &val)) {
- if (use_updates && (strncmp("Update", (char *)child->name, 6) == 0 || strcmp("XfrReqDone", (char *)child->name) == 0))
- submit_counter(current_time, NULL, "dns_update", (char *)child->name, val);
- else if (use_query_results && strncmp("Qry", (char *)child->name, 3) == 0)
- submit_counter(current_time, NULL, "dns_rcode", (char *)child->name, val);
- else if (use_query_results && (strncmp("Resp", (char *)child->name, 4) == 0 ||
- strcmp("AuthQryRej", (char *)child->name) == 0 || strcmp("RecQryRej", (char *)child->name) == 0 ||
- strcmp("XfrRej", (char *)child->name) == 0 || strcmp("TruncatedResp", (char *)child->name) == 0))
- submit_counter(current_time, NULL, "dns_rcode", (char *)child->name, val);
- else if (use_requests && strncmp("Req", (char *)child->name, 3) == 0)
- submit_counter(current_time, NULL, "dns_request", (char *)child->name, val);
- }
- DEBUG ("bind plugin: Statv1: Found %d entries for %d nsstats", n, xpathObj->nodesetval->nodeNr);
- }
- xmlXPathFreeObject(xpathObj);
- }
-
- /* zonestats -- [$name] = [$value] */
- /* Variables: NotifyOutv4, NotifyOutv6, NotifyInv4, NotifyInv6, NotifyRej, SOAOutv4, SOAOutv6,
- * AXFRReqv4, AXFRReqv6, IXFRReqv4, IXFRReqv6, XfrSuccess, XfrFail */
- if (use_zone_maint) {
- if ((xpathObj = xmlXPathEvalExpression(BAD_CAST "server/zonestats", xpathCtx)) == NULL) {
- ERROR("bind plugin: unable to evaluate XPath expression StatsV1-zonestats");
- return -1;
- } else if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
- xmlNode *child;
- counter_t val;
- int n = 0;
- for (child = xpathObj->nodesetval->nodeTab[0]->xmlChildrenNode; child != NULL; child = child->next, n++)
- if (child->type == XML_ELEMENT_NODE) {
- if (!bind_xml_read_counter(doc, child, &val))
- submit_counter(current_time, NULL, "dns_zops", (char *)child->name, val);
- }
- DEBUG ("bind plugin: Statv1: Found %d entries for %d zonestats", n, xpathObj->nodesetval->nodeNr);
- }
- xmlXPathFreeObject(xpathObj);
- }
-
- /* resstats -- [$name] = [$value] */
- /* Variables: Queryv4, Queryv6, Responsev4, Responsev6, NXDOMAIN, SERVFAIL, FORMERR, OtherError,
- * EDNS0Fail, Mismatch, Truncated, Lame, Retry, GlueFetchv4, GlueFetchv6, GlueFetchv4Fail,
- * GlueFetchv6Fail, ValAttempt, ValOk, ValNegOk, ValFail */
- if (use_resolver) {
- if ((xpathObj = xmlXPathEvalExpression(BAD_CAST "server/resstats", xpathCtx)) == NULL) {
- ERROR("bind plugin: unable to evaluate XPath expression StatsV1-resstats");
- return -1;
- } else if (xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0) {
- xmlNode *child;
- counter_t val;
- int n = 0;
- for (child = xpathObj->nodesetval->nodeTab[0]->xmlChildrenNode; child != NULL; child = child->next, n++)
- if (child->type == XML_ELEMENT_NODE) {
- if (!bind_xml_read_counter(doc, child, &val))
- submit_counter(current_time, NULL, "dns_resolver", (char *)child->name, val);
- }
- DEBUG ("bind plugin: Statv1: Found %d entries for %d resstats", n, xpathObj->nodesetval->nodeNr);