rrd_file_t *rrd_file = NULL;
char *opt_daemon = NULL;
char double_str[ 12 ];
+ const char *in_filename = NULL;
struct option long_options[] = {
{"heartbeat", required_argument, 0, 'h'},
{"minimum", required_argument, 0, 'i'},
// connect to daemon (will take care of environment variable automatically)
if (rrdc_connect(opt_daemon) != 0) {
- rrd_set_error("Cannot connect to daemon");
+ rrd_set_error("Cannot connect to daemon");
return 1;
}
the back, starting with optind. This means the file name has travelled to
argv[optind] */
- const char *in_filename = argv[optind];
+ in_filename = argv[optind];
if (rrdc_is_any_connected()) {
// is it a good idea to just ignore the error ????
rc = 0;
done:
+ if (in_filename && rrdc_is_any_connected()) {
+ // save any errors....
+ char *e = strdup(rrd_get_error());
+ // is it a good idea to just ignore the error ????
+ rrdc_forget(in_filename);
+ rrd_clear_error();
+
+ if (e && *e) {
+ rrd_set_error(e);
+ }
+ if (e) free(e);
+
+ }
if (rrd_file) {
rrd_close(rrd_file);
}
fi
}
+function is_cached {
+ [ -n "$RRDCACHED_ADDRESS" ]
+}
+
function exit_if_cached_running {
local E="$1"
local MSG="$2"
- if [ -n "$RRDCACHED_ADDRESS" ] ; then
+ if is_cached ; then
echo >&2 "$MSG"
exit ${E:-1}
fi
$RRDTOOL update ${BUILD}org.rrd --template a $U
report "update"
+# NOTE: for rrdcached based tests, we must flush before we can copy...
+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:-100
$RRDTOOL dump ${BUILD}a.rrd | $DIFF - ${BASE}a-mod1.dump
report "tune heartbeat/minimum"
+# NOTE: for rrdcached based tests, we must flush before we can copy...
+is_cached && ( $RRDTOOL flushcached ${BUILD}org.rrd || fail flushcached )
+
cp ${BUILD}org.rrd ${BUILD}a.rrd
$RRDTOOL tune ${BUILD}a.rrd --data-source-type a:COUNTER --data-source-rename b:c
$RRDTOOL dump ${BUILD}a.rrd | $DIFF - ${BASE}a-mod2.dump
$RRDTOOL dump ${BUILD}org.rrd | $DIFF - ${BASE}org.dump
report create
+is_cached && ( $RRDTOOL flushcached ${BUILD}org.rrd || fail flushcached )
cp ${BUILD}org.rrd ${BUILD}a.rrd
# this must fail
-$RRDTOOL tune ${BUILD}a.rrd --beta 1.4 2>/dev/null
-[ $? != 0 ]
+! $RRDTOOL tune ${BUILD}a.rrd --beta 1.4 2>/dev/null
report "out of range beta error"
$RRDTOOL dump ${BUILD}a.rrd | $DIFF - ${BASE}org.dump
report "RRD unchanged"