"COMMENT: \\n",
};
+const char *deviationtext[] = {
+ "DEF:devi=" POWER_RRD_PATH ":aikapoikkeama:AVERAGE",
+ "COMMENT:\\n",
+ blank,
+ "COMMENT: "
+ "MIN MAX AVG Last\\n",
+ blank,
+ "LINE1:devi#0000ff:Aikapoikkeama ",
+ "GPRINT:devi:MIN:" numfmt,
+ "GPRINT:devi:MAX:" numfmt,
+ "GPRINT:devi:AVERAGE:" numfmt,
+ "GPRINT:devi:LAST:" numfmt "\\n",
+ "COMMENT: \\n",
+};
+
+const char *pricetext[] = {
+ "DEF:hinta=" POWER_RRD_PATH ":hinta:AVERAGE",
+ "COMMENT:\\n",
+ blank,
+ "COMMENT: "
+ "MIN MAX AVG Last\\n",
+ blank,
+ "LINE1:hinta#0000ff:Hinta ",
+ "GPRINT:hinta:MIN:" numfmt,
+ "GPRINT:hinta:MAX:" numfmt,
+ "GPRINT:hinta:AVERAGE:" numfmt,
+ "GPRINT:hinta:LAST:" numfmt "\\n",
+ "COMMENT: \\n",
+};
+
const char *cpuoptions[] = {
"--alt-autoscale-max",
"--lower-limit", "0",
0
};
+const char *deviationoptions[] = {
+ "--alt-autoscale",
+ "--vertical-label", "Aikapoikkeama s",
+ "--units-exponent", "-2",
+ 0
+};
+
+const char *priceoptions[] = {
+ "--alt-autoscale",
+ "--vertical-label", "Hinta €",
+ 0
+};
+
const char *poweroptions[] = {
"--alt-autoscale-max",
"--lower-limit", "0",
0
};
-static struct rrd_image cpudaily = {
- .image_filename = SYSINFO_IMAGES_PATH "cpu_daily.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1d",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&cpuoptions,
- .text = (char **)&cputext
-};
-
-static struct rrd_image cpuweekly = {
- .image_filename = SYSINFO_IMAGES_PATH "cpu_weekly.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1w",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&cpuoptions,
- .text = (char **)&cputext
-};
-
-static struct rrd_image cpumonthly = {
- .image_filename = SYSINFO_IMAGES_PATH "cpu_monthly.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1m",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&cpuoptions,
- .text = (char **)&cputext
-};
-
-static struct rrd_image cpuyearly = {
- .image_filename = SYSINFO_IMAGES_PATH "cpu_yearly.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1y",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&cpuoptions,
- .text = (char **)&cputext
-};
-
-static struct rrd_image memdaily = {
- .image_filename = SYSINFO_IMAGES_PATH "mem_daily.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1d",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&memoptions,
- .text = (char **)&memtext
-};
-
-static struct rrd_image memweekly = {
- .image_filename = SYSINFO_IMAGES_PATH "mem_weekly.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1w",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&memoptions,
- .text = (char **)&memtext
-};
-static struct rrd_image memmonthly = {
- .image_filename = SYSINFO_IMAGES_PATH "mem_monthly.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1m",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&memoptions,
- .text = (char **)&memtext
-};
-static struct rrd_image memyearly = {
- .image_filename = SYSINFO_IMAGES_PATH "mem_yearly.png",
- .width = 720,
- .height = 480,
- .timestart = "end-1y",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&memoptions,
- .text = (char **)&memtext
-};
-
-static struct rrd_image systempdaily = {
- .image_filename = SYSINFO_IMAGES_PATH "systemp_daily.png",
- .width = 600,
- .height = 200,
- .timestart = "end-1d",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&systempoptions,
- .text = (char **)&systemptext
-};
-
-static struct rrd_image systempweekly = {
- .image_filename = SYSINFO_IMAGES_PATH "systemp_weekly.png",
- .width = 600,
- .height = 200,
- .timestart = "end-1w",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&systempoptions,
- .text = (char **)&systemptext
-};
-
-static struct rrd_image systempmonthly = {
- .image_filename = SYSINFO_IMAGES_PATH "systemp_monthly.png",
- .width = 600,
- .height = 200,
- .timestart = "end-1m",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&systempoptions,
- .text = (char **)&systemptext
-};
-
-static struct rrd_image systempyearly = {
- .image_filename = SYSINFO_IMAGES_PATH "systemp_yearly.png",
- .width = 600,
- .height = 200,
- .timestart = "end-1y",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&systempoptions,
- .text = (char **)&systemptext
-};
-
-static struct rrd_image powerdaily = {
- .image_filename = POWER_IMAGES_PATH "power_daily.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1d",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&poweroptions,
- .text = (char **)&powertext
-};
-
-static struct rrd_image powerweekly = {
- .image_filename = POWER_IMAGES_PATH "power_weekly.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1w",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&poweroptions,
- .text = (char **)&powertext
-};
-
-static struct rrd_image powermonthly = {
- .image_filename = POWER_IMAGES_PATH "power_monthly.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1m",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&poweroptions,
- .text = (char **)&powertext
-};
-
-static struct rrd_image poweryearly = {
- .image_filename = POWER_IMAGES_PATH "power_yearly.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1y",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&poweroptions,
- .text = (char **)&powertext
-};
-
-static struct rrd_image freqdaily = {
- .image_filename = POWER_IMAGES_PATH "freq_daily.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1d",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&freqoptions,
- .text = (char **)&freqtext
-};
-
-static struct rrd_image freqweekly = {
- .image_filename = POWER_IMAGES_PATH "freq_weekly.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1w",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&freqoptions,
- .text = (char **)&freqtext
-};
-
-static struct rrd_image freqmonthly = {
- .image_filename = POWER_IMAGES_PATH "freq_monthly.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1m",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&freqoptions,
- .text = (char **)&freqtext
-};
-
-static struct rrd_image freqyearly = {
- .image_filename = POWER_IMAGES_PATH "freq_yearly.png",
- .width = 480,
- .height = 480,
- .timestart = "end-1y",
- .timeend = "now",
- .imageformat = "PNG",
- .options = (char **)&freqoptions,
- .text = (char **)&freqtext
-};
+#define xstr(s) str(s)
+#define str(s) #s
+
+#define DEFINE_IMAGE(rrdname, _filename, _width, _height) \
+ static struct rrd_image rrdname ## daily = { \
+ .image_filename = _filename "_daily.png", \
+ .width = _width, \
+ .height = _height, \
+ .timestart = "end-1d", \
+ .timeend = "now", \
+ .imageformat = "PNG", \
+ .options = (char **)&rrdname ## options, \
+ .text = (char **)&rrdname ## text, \
+ }; \
+ static struct rrd_image rrdname ## weekly = { \
+ .image_filename = _filename "_weekly.png", \
+ .width = _width, \
+ .height = _height, \
+ .timestart = "end-1w", \
+ .timeend = "now", \
+ .imageformat = "PNG", \
+ .options = (char **)&rrdname ## options, \
+ .text = (char **)&rrdname ## text, \
+ }; \
+ static struct rrd_image rrdname ## monthly = { \
+ .image_filename = _filename "_monthly.png", \
+ .width = _width, \
+ .height = _height, \
+ .timestart = "end-1m", \
+ .timeend = "now", \
+ .imageformat = "PNG", \
+ .options = (char **)&rrdname ## options, \
+ .text = (char **)&rrdname ## text, \
+ }; \
+ static struct rrd_image rrdname ## yearly = { \
+ .image_filename = _filename "_yearly.png", \
+ .width = _width, \
+ .height = _height, \
+ .timestart = "end-1y", \
+ .timeend = "now", \
+ .imageformat = "PNG", \
+ .options = (char **)&rrdname ## options, \
+ .text = (char **)&rrdname ## text, \
+ };
+
+#define CPUPATH (xstr(SYSINFO_IMAGES_PATH) "cpu" )
+#define MEMPATH (xstr(SYSINFO_IMAGES_PATH) "mem")
+#define SYSTEMPPATH (xstr(SYSINFO_IMAGES_PATH) "systemp")
+#define POWERPATH (xstr(POWER_IMAGES_PATH) "power")
+#define FREQPATH (xstr(POWER_IMAGES_PATH) "freq")
+#define DEVIATIONPATH (xstr(POWER_IMAGES_PATH) "deviation")
+
+DEFINE_IMAGE(cpu, "/home/kaapeli/rrdd/sysinfo/images/cpu", 720, 480);
+DEFINE_IMAGE(mem, "/home/kaapeli/rrdd/sysinfo/images/mem", 720, 480);
+DEFINE_IMAGE(systemp, "/home/kaapeli/rrdd/sysinfo/images/systemp", 720, 480);
+DEFINE_IMAGE(power, "/home/kaapeli/rrdd/power/images/power", 480, 480);
+DEFINE_IMAGE(freq, "/home/kaapeli/rrdd/power/images/freq", 480, 480);
+DEFINE_IMAGE(deviation, "/home/kaapeli/rrdd/power/images/deviation", 480, 480);
+DEFINE_IMAGE(price, "/home/kaapeli/rrdd/power/images/price", 480, 480);
static struct rrd_image *cpu_mem_images[] = {
&cpudaily,
&freqweekly,
&freqmonthly,
&freqyearly,
+ &deviationdaily,
+ &deviationweekly,
+ &deviationmonthly,
+ &deviationyearly,
+ &pricedaily,
+ &priceweekly,
+ &pricemonthly,
+ &priceyearly,
0
};