X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_match.c;h=5083b05a7f7176886aa8016935de4e6563054c79;hb=1bbefd777881fee2534b976d161743c5fe6fc536;hp=bb53a9a317bd79b718e26f7262c49ea2268ccd93;hpb=21077b074c468a41dbd60baad691ebc7f2991d43;p=collectd.git diff --git a/src/utils_match.c b/src/utils_match.c index bb53a9a3..5083b05a 100644 --- a/src/utils_match.c +++ b/src/utils_match.c @@ -2,22 +2,26 @@ * collectd - src/utils_match.c * Copyright (C) 2008-2014 Florian octo Forster * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. * * Authors: - * Florian octo Forster + * Florian octo Forster **/ #include "collectd.h" @@ -80,6 +84,13 @@ static int default_callback (const char __attribute__((unused)) *str, gauge_t value; char *endptr = NULL; + if (data->ds_type & UTILS_MATCH_CF_GAUGE_INC) + { + data->value.gauge = isnan (data->value.gauge) ? 1 : data->value.gauge + 1; + data->values_num++; + return(0); + } + if (matches_num < 2) return (-1); @@ -108,6 +119,10 @@ static int default_callback (const char __attribute__((unused)) *str, if (data->value.gauge < value) data->value.gauge = value; } + else if (data->ds_type & UTILS_MATCH_CF_GAUGE_ADD) + { + data->value.gauge += value; + } else { ERROR ("utils_match: default_callback: obj->ds_type is invalid!");