From 78a49673197fd30f544e0a03c7bd60e00503f83e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bruno=20Pr=C3=A9mont?= Date: Sat, 14 Mar 2009 18:06:58 +0100 Subject: [PATCH] bind plugin: Actually handle RR cache numbers as `gauge'.. Hi Florian, Well a working patch was even less trivial as the quick one from yesterday evening. Just using a gauge type is not sufficient (only 0 is written to RRD files), it's also necessary to adjust the bind_xml_stats_handle_view() as has been done for the memory statistics Attached is a patch to bind.c (I skipped types.db) which fixes the cache data collection. In addition I attached a graph of the cache evolution and memory (for memory it might be worth giving it an own type as it's not cumulative at all) Bruno --- src/bind.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/bind.c b/src/bind.c index 342f6752..c0b18323 100644 --- a/src/bind.c +++ b/src/bind.c @@ -497,7 +497,7 @@ static int bind_parse_generic_name_value (const char *xpath_expression, /* {{{ * list_callback_t list_callback, void *user_data, xmlDoc *doc, xmlXPathContext *xpathCtx, - time_t current_time) + time_t current_time, int ds_type) { xmlXPathObject *xpathObj = NULL; int num_entries; @@ -545,7 +545,10 @@ static int bind_parse_generic_name_value (const char *xpath_expression, /* {{{ * value_t value; int status; - status = bind_xml_read_counter (doc, counter, &value.counter); + if (ds_type == DS_TYPE_GAUGE) + status = bind_xml_read_gauge (doc, counter, &value.gauge); + else + status = bind_xml_read_counter (doc, counter, &value.counter); if (status != 0) continue; @@ -818,7 +821,7 @@ static int bind_xml_stats_handle_view (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value (/* xpath = */ "rdtype", /* callback = */ bind_xml_list_callback, /* user_data = */ &list_info, - doc, path_ctx, current_time); + doc, path_ctx, current_time, DS_TYPE_COUNTER); } /* }}} */ if (view->resolver_stats != 0) /* {{{ */ @@ -837,7 +840,7 @@ static int bind_xml_stats_handle_view (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value ("resstat", /* callback = */ bind_xml_table_callback, /* user_data = */ &table_ptr, - doc, path_ctx, current_time); + doc, path_ctx, current_time, DS_TYPE_COUNTER); } /* }}} */ if (view->cacherrsets != 0) /* {{{ */ @@ -855,7 +858,7 @@ static int bind_xml_stats_handle_view (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value (/* xpath = */ "cache/rrset", /* callback = */ bind_xml_list_callback, /* user_data = */ &list_info, - doc, path_ctx, current_time); + doc, path_ctx, current_time, DS_TYPE_GAUGE); } /* }}} */ if (view->zones_num > 0) @@ -944,7 +947,7 @@ static int bind_xml_stats (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value (/* xpath = */ "server/requests/opcode", /* callback = */ bind_xml_list_callback, /* user_data = */ &list_info, - doc, xpathCtx, current_time); + doc, xpathCtx, current_time, DS_TYPE_COUNTER); } /* XPath: server/queries-in/rdtype @@ -969,7 +972,7 @@ static int bind_xml_stats (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value (/* xpath = */ "server/queries-in/rdtype", /* callback = */ bind_xml_list_callback, /* user_data = */ &list_info, - doc, xpathCtx, current_time); + doc, xpathCtx, current_time, DS_TYPE_COUNTER); } /* XPath: server/nsstats, server/nsstat @@ -1019,7 +1022,7 @@ static int bind_xml_stats (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value ("server/nsstat", /* callback = */ bind_xml_table_callback, /* user_data = */ &table_ptr, - doc, xpathCtx, current_time); + doc, xpathCtx, current_time, DS_TYPE_COUNTER); } } @@ -1065,7 +1068,7 @@ static int bind_xml_stats (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value ("server/zonestat", /* callback = */ bind_xml_table_callback, /* user_data = */ &table_ptr, - doc, xpathCtx, current_time); + doc, xpathCtx, current_time, DS_TYPE_COUNTER); } } @@ -1112,7 +1115,7 @@ static int bind_xml_stats (int version, xmlDoc *doc, /* {{{ */ bind_parse_generic_name_value ("server/resstat", /* callback = */ bind_xml_table_callback, /* user_data = */ &table_ptr, - doc, xpathCtx, current_time); + doc, xpathCtx, current_time, DS_TYPE_COUNTER); } } -- 2.11.0