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
-};
+#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, \
+ };
-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
-};
+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);
static struct rrd_image *cpu_mem_images[] = {
&cpudaily,