]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
tune --maximum and --minimum should accept U as well
authorTobias Oetiker <tobi@oetiker.ch>
Tue, 16 Jun 2015 09:20:39 +0000 (11:20 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 16 Jun 2015 09:20:39 +0000 (11:20 +0200)
src/Makefile.in
src/rrd_tune.c
tests/tune1

index f28c917de1884ad95ad6bd3543862d748621ff0a..7a4ecdbc57e546877355932daac7cd5f8b7b65de 100644 (file)
@@ -96,13 +96,14 @@ target_triplet = @target@
 @BUILD_RRDRESTORE_TRUE@am__append_2 = rrd_restore.c
 @BUILD_LIBDBI_TRUE@am__append_3 = rrd_fetch_libdbi.c
 @BUILD_LIBRADOS_TRUE@am__append_4 = rrd_rados.c
-@BUILD_GETOPT_TRUE@am__append_5 = rrd_getopt.h
-@BUILD_GETOPT_TRUE@am__append_6 = rrd_getopt.c rrd_getopt1.c
-@BUILD_MULTITHREAD_TRUE@am__append_7 = librrd_th.la
+@BUILD_LIBRADOS_TRUE@am__append_5 = rrd_rados.h
+@BUILD_GETOPT_TRUE@am__append_6 = rrd_getopt.h
+@BUILD_GETOPT_TRUE@am__append_7 = rrd_getopt.c rrd_getopt1.c
+@BUILD_MULTITHREAD_TRUE@am__append_8 = librrd_th.la
 bin_PROGRAMS = rrdtool$(EXEEXT) rrdupdate$(EXEEXT) $(am__EXEEXT_1) \
        $(am__EXEEXT_2)
-@BUILD_RRDCGI_TRUE@am__append_8 = rrdcgi
-@BUILD_RRDCACHED_TRUE@am__append_9 = rrdcached
+@BUILD_RRDCGI_TRUE@am__append_9 = rrdcgi
+@BUILD_RRDCACHED_TRUE@am__append_10 = rrdcached
 subdir = src
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
        $(srcdir)/rrd_config.h.in $(srcdir)/librrd.sym.in.in \
@@ -307,7 +308,7 @@ am__noinst_HEADERS_DIST = unused.h gettext.h mutex.h rrd_strtod.h \
        rrd_xport.h rrd.h rrd_rpncalc.h rrd_hw.h rrd_hw_math.h \
        rrd_hw_update.h rrd_restore.h rrd_create.h fnv.h rrd_graph.h \
        rrd_is_thread_safe.h rrd_modify.h rrd_update.h rrd_config.h \
-       quicksort.h
+       quicksort.h rrd_rados.h
 HEADERS = $(include_HEADERS) $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
        $(LISP)rrd_config.h.in
@@ -542,7 +543,7 @@ UPD_C_FILES = mutex.c rrd_strtod.c rrd_create.c hash_32.c \
        rrd_diff.c rrd_format.c rrd_info.c rrd_error.c rrd_open.c \
        rrd_client.c rrd_nan_inf.c rrd_rpncalc.c rrd_utils.c \
        rrd_snprintf.c rrd_update.c rrd_modify.c quicksort.c \
-       $(am__append_4) $(am__append_6)
+       $(am__append_4) $(am__append_7)
 RRD_C_FILES = rrd_version.c rrd_last.c rrd_lastupdate.c rrd_first.c \
        rrd_dump.c rrd_flushcached.c rrd_fetch.c rrd_fetch_cb.c \
        rrd_resize.c rrd_tune.c $(am__append_1) $(am__append_2) \
@@ -553,9 +554,9 @@ noinst_HEADERS = unused.h gettext.h mutex.h rrd_strtod.h \
        rrd_xport.h rrd.h rrd_rpncalc.h rrd_hw.h rrd_hw_math.h \
        rrd_hw_update.h rrd_restore.h rrd_create.h fnv.h rrd_graph.h \
        rrd_is_thread_safe.h rrd_modify.h rrd_update.h rrd_config.h \
-       quicksort.h $(am__append_5)
+       quicksort.h $(am__append_5) $(am__append_6)
 noinst_LTLIBRARIES = librrdupd.la
-lib_LTLIBRARIES = librrd.la $(am__append_7)
+lib_LTLIBRARIES = librrd.la $(am__append_8)
 librrdupd_la_SOURCES = $(UPD_C_FILES) rrd_not_thread_safe.c
 librrdupd_la_LIBADD = $(CORE_LIBS)
 librrd_la_SOURCES = $(RRD_C_FILES)
index c743d37a563503d494fd19360d728de0bbd34a57..c7ec443f6f38395d5cfb617f17c295dc722a6270 100644 (file)
@@ -208,45 +208,53 @@ int rrd_tune(
             break;
 
         case 'i':
-            matches = sscanf(optarg, DS_NAM_FMT ":%40[0-9.e+-]", ds_nam, double_str);
-            if( matches >= 1 ) {
-                strtod_ret_val = rrd_strtodbl( double_str, NULL, &min, NULL );
+            matches = sscanf(optarg, DS_NAM_FMT ":%40[U0-9.e+-]", ds_nam, double_str);
+            if ( matches == 2 ) {
+                if (strcmp(double_str,"U") == 0){
+                    min = DNAN;
+                }
+                else {
+                    strtod_ret_val = rrd_strtodbl( double_str, NULL, &min, NULL );
+                    if ((strtod_ret_val != 2)) {
+                        rrd_set_error("invalid arguments for minimum ds value");
+                        goto done;
+                    }
+                }
             }
-
-            if ((matches < 1) || (strtod_ret_val != 2)) {
+            else {
                 rrd_set_error("invalid arguments for minimum ds value");
-               goto done;
-            }
-
+                goto done;
+            } 
             if ((ds = ds_match(&rrd, ds_nam)) == -1) {
                goto done;
             }
-
-            if (matches == 1)
-                min = DNAN;
             rrd.ds_def[ds].par[DS_min_val].u_val = min;
             break;
 
         case 'a':
-            matches = sscanf(optarg, DS_NAM_FMT ":%40[0-9.e+-]", ds_nam, double_str);
-            if( matches >= 1 ) {
-                strtod_ret_val = rrd_strtodbl( double_str, NULL, &max, NULL );
+            matches = sscanf(optarg, DS_NAM_FMT ":%40[U0-9.e+-]", ds_nam, double_str);
+            if ( matches == 2 ) {
+                if (strcmp(double_str,"U") == 0){
+                    max = DNAN;
+                }
+                else {
+                    strtod_ret_val = rrd_strtodbl( double_str, NULL, &max, NULL );
+                    if ((strtod_ret_val != 2)) {
+                        rrd_set_error("invalid arguments for maximum ds value");
+                        goto done;
+                    }
+                }
             }
-
-            if ((matches < 1 ) || (strtod_ret_val != 2)) {
+            else {
                 rrd_set_error("invalid arguments for maximum ds value");
-               goto done;
-            }
-
+                goto done;
+            } 
             if ((ds = ds_match(&rrd, ds_nam)) == -1) {
                goto done;
             }
-
-            if (matches == 1)
-                max = DNAN;
             rrd.ds_def[ds].par[DS_max_val].u_val = max;
             break;
-
+            
         case 'd':
             if ((matches =
                  sscanf(optarg, DS_NAM_FMT ":" DST_FMT, ds_nam, dst)) != 2) {
index 83e581ef8eeb6d5fe15a7ada3ab32939fa7bee73..14cb4ce4181d970c301b5ed0e30b86e3c67b4cb3 100755 (executable)
@@ -22,6 +22,7 @@ is_cached && ( $RRDTOOL flushcached ${BUILD}org.rrd || fail flushcached)
 
 
 cp ${BUILD}org.rrd ${BUILD}a.rrd
+$RRDTOOL tune ${BUILD}a.rrd --heartbeat a:90 --minimum b:U
 $RRDTOOL tune ${BUILD}a.rrd --heartbeat a:90 --minimum b:-100
 $RRDTOOL dump ${BUILD}a.rrd | $DIFF - ${BASE}a-mod1.dump
 report "tune heartbeat/minimum"