From: Martin Mares Date: Tue, 27 Dec 2011 18:28:52 +0000 (+0100) Subject: RRD now keeps also 1-hour minima and maxima X-Git-Tag: v1.0~3 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=354d5d16749203f37a51631244ea416597b3e51c;p=arexx.git RRD now keeps also 1-hour minima and maxima --- diff --git a/arexxd.c b/arexxd.c index 68e08d3..faedc5e 100644 --- a/arexxd.c +++ b/arexxd.c @@ -112,7 +112,7 @@ static void arg_push(const char *fmt, ...) arg_pos += len; } -static void rrd_point(time_t t, int id, double val) +static void rrd_point(time_t t, int id, double val, char *unit) { char rr_name[256]; snprintf(rr_name, sizeof(rr_name), "sensor-%d.rrd", id); @@ -127,9 +127,16 @@ static void rrd_point(time_t t, int id, double val) arg_push("%d", (int) time(NULL) - 28*86400); arg_push("--step"); arg_push("60"); - arg_push("DS:temp:GAUGE:300:0:10000"); // Anything over 10 kW is considered a ghost + if (!strcmp(unit, "%RH")) + arg_push("DS:rh:GAUGE:300:0:100"); + else if (!strcmp(unit, "ppm")) + arg_push("DS:ppm:GAUGE:300:0:1000000"); + else + arg_push("DS:temp:GAUGE:300:-200:200"); arg_push("RRA:AVERAGE:0.25:1:20160"); // Last 14 days with full resolution arg_push("RRA:AVERAGE:0.25:60:88800"); // Last 10 years with 1h resolution + arg_push("RRA:MIN:0.25:60:88800"); // including minima and maxima + arg_push("RRA:MAX:0.25:60:88800"); rrd_create(arg_cnt, arg_ptr); if (rrd_test_error()) { log_error("rrd_create on %s failed: %s", rr_name, rrd_get_error()); @@ -162,7 +169,7 @@ static void cooked_point(time_t t, int id, double val, char *unit, int q) } data_point_counter++; - rrd_point(t, id, val); + rrd_point(t, id, val, unit); } static void raw_point(int t, int id, int raw, int q)