]> git.itanic.dy.fi Git - rrdd/commitdiff
database.h.example: Avoid pathname repeatitions
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 6 Mar 2011 13:13:43 +0000 (15:13 +0200)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 6 Mar 2011 16:50:41 +0000 (18:50 +0200)
This way it is much easier to modify the default paths.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
database.h.example

index e8ea0e7906bfe4f5838df9c2094344bb1b0075ea..913cc905a95d8c357e60a922bc1ce6b66c328e70 100644 (file)
@@ -8,14 +8,20 @@
 const char blank[] = "COMMENT:               ";
 #define numfmt " % 8.2lf "
 
+#define SYSINFO_PATH           "/home/kaapeli/sysinfo/"
+#define SYSINFO_RRD_PATH       SYSINFO_PATH "sysinfo.rrd"
+#define SYSINFO_IMAGES_PATH    SYSINFO_PATH "images/"
+
+#define SYSTEMP_RRD_PATH       "/root/systemp/systemp.rrd"
+
 const char *cputext[] = {
-       "DEF:us=/home/kaapeli/sysinfo/sysinfo.rrd:User:AVERAGE",
-       "DEF:ni=/home/kaapeli/sysinfo/sysinfo.rrd:Nice:AVERAGE",
-       "DEF:sy=/home/kaapeli/sysinfo/sysinfo.rrd:Sys:AVERAGE",
-       "DEF:id=/home/kaapeli/sysinfo/sysinfo.rrd:Idle:AVERAGE",
-       "DEF:wa=/home/kaapeli/sysinfo/sysinfo.rrd:Wait:AVERAGE",
-       "DEF:in=/home/kaapeli/sysinfo/sysinfo.rrd:IRQ:AVERAGE",
-       "DEF:so=/home/kaapeli/sysinfo/sysinfo.rrd:SoftIRQ:AVERAGE",
+       "DEF:us=" SYSINFO_RRD_PATH ":User:AVERAGE",
+       "DEF:ni=" SYSINFO_RRD_PATH ":Nice:AVERAGE",
+       "DEF:sy=" SYSINFO_RRD_PATH ":Sys:AVERAGE",
+       "DEF:id=" SYSINFO_RRD_PATH ":Idle:AVERAGE",
+       "DEF:wa=" SYSINFO_RRD_PATH ":Wait:AVERAGE",
+       "DEF:in=" SYSINFO_RRD_PATH ":IRQ:AVERAGE",
+       "DEF:so=" SYSINFO_RRD_PATH ":SoftIRQ:AVERAGE",
        "COMMENT:\\n",
        blank,
        "COMMENT:                   "
@@ -67,13 +73,13 @@ const char *cputext[] = {
 };
 
 const char *memtext[] = {
-       "DEF:fr=/home/kaapeli/sysinfo/sysinfo.rrd:Free:AVERAGE",
-       "DEF:bu=/home/kaapeli/sysinfo/sysinfo.rrd:Buffers:AVERAGE",
-       "DEF:ca=/home/kaapeli/sysinfo/sysinfo.rrd:Cached:AVERAGE",
-       "DEF:an=/home/kaapeli/sysinfo/sysinfo.rrd:Anon:AVERAGE",
-       "DEF:sl=/home/kaapeli/sysinfo/sysinfo.rrd:Slab:AVERAGE",
-       "DEF:ta=/home/kaapeli/sysinfo/sysinfo.rrd:Tables:AVERAGE",
-       "DEF:sw=/home/kaapeli/sysinfo/sysinfo.rrd:Swap:AVERAGE",
+       "DEF:fr=" SYSINFO_RRD_PATH ":Free:AVERAGE",
+       "DEF:bu=" SYSINFO_RRD_PATH ":Buffers:AVERAGE",
+       "DEF:ca=" SYSINFO_RRD_PATH ":Cached:AVERAGE",
+       "DEF:an=" SYSINFO_RRD_PATH ":Anon:AVERAGE",
+       "DEF:sl=" SYSINFO_RRD_PATH ":Slab:AVERAGE",
+       "DEF:ta=" SYSINFO_RRD_PATH ":Tables:AVERAGE",
+       "DEF:sw=" SYSINFO_RRD_PATH ":Swap:AVERAGE",
        "COMMENT:\\n",
        blank,
        "COMMENT:                     "
@@ -125,9 +131,9 @@ const char *memtext[] = {
 };
 
 const char *systemptext[] = {
-       "DEF:sda_c=/root/systemp/systemp.rrd:sda:AVERAGE",
-       "DEF:SYS_c=/root/systemp/systemp.rrd:SYS:AVERAGE",
-       "DEF:CPU_c=/root/systemp/systemp.rrd:CPU:AVERAGE",
+       "DEF:sda_c=" SYSTEMP_RRD_PATH ":sda:AVERAGE",
+       "DEF:SYS_c=" SYSTEMP_RRD_PATH ":SYS:AVERAGE",
+       "DEF:CPU_c=" SYSTEMP_RRD_PATH ":CPU:AVERAGE",
        "COMMENT:\\n",
        blank,
        "COMMENT:                          "
@@ -176,7 +182,7 @@ const char *systempoptions[] = {
 };
 
 static struct rrd_image cpudaily = {
-       .image_filename = "/home/kaapeli/sysinfo/images/cpu_daily.png",
+       .image_filename = SYSINFO_IMAGES_PATH "cpu_daily.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1d",
@@ -187,7 +193,7 @@ static struct rrd_image cpudaily = {
 };
 
 static struct rrd_image cpuweekly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/cpu_weekly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "cpu_weekly.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1w",
@@ -198,7 +204,7 @@ static struct rrd_image cpuweekly = {
 };
 
 static struct rrd_image cpumonthly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/cpu_monthly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "cpu_monthly.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1m",
@@ -209,7 +215,7 @@ static struct rrd_image cpumonthly = {
 };
 
 static struct rrd_image cpuyearly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/cpu_yearly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "cpu_yearly.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1y",
@@ -220,7 +226,7 @@ static struct rrd_image cpuyearly = {
 };
 
 static struct rrd_image memdaily = {
-       .image_filename = "/home/kaapeli/sysinfo/images/mem_daily.png",
+       .image_filename = SYSINFO_IMAGES_PATH "mem_daily.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1d",
@@ -231,7 +237,7 @@ static struct rrd_image memdaily = {
 };
 
 static struct rrd_image memweekly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/mem_weekly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "mem_weekly.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1w",
@@ -241,7 +247,7 @@ static struct rrd_image memweekly = {
        .text = (char **)&memtext
 };
 static struct rrd_image memmonthly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/mem_monthly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "mem_monthly.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1m",
@@ -251,7 +257,7 @@ static struct rrd_image memmonthly = {
        .text = (char **)&memtext
 };
 static struct rrd_image memyearly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/mem_yearly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "mem_yearly.png",
        .width = 720,
        .height = 480,
        .timestart = "end-1y",
@@ -262,7 +268,7 @@ static struct rrd_image memyearly = {
 };
 
 static struct rrd_image systempdaily = {
-       .image_filename = "/home/kaapeli/sysinfo/images/systemp_daily.png",
+       .image_filename = SYSINFO_IMAGES_PATH "systemp_daily.png",
        .width = 600,
        .height = 200,
        .timestart = "end-1d",
@@ -273,7 +279,7 @@ static struct rrd_image systempdaily = {
 };
 
 static struct rrd_image systempweekly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/systemp_weekly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "systemp_weekly.png",
        .width = 600,
        .height = 200,
        .timestart = "end-1w",
@@ -284,7 +290,7 @@ static struct rrd_image systempweekly = {
 };
 
 static struct rrd_image systempmonthly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/systemp_monthly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "systemp_monthly.png",
        .width = 600,
        .height = 200,
        .timestart = "end-1m",
@@ -295,7 +301,7 @@ static struct rrd_image systempmonthly = {
 };
 
 static struct rrd_image systempyearly = {
-       .image_filename = "/home/kaapeli/sysinfo/images/systemp_yearly.png",
+       .image_filename = SYSINFO_IMAGES_PATH "systemp_yearly.png",
        .width = 600,
        .height = 200,
        .timestart = "end-1y",
@@ -326,7 +332,7 @@ static struct rrd_image *systemp_images[] = {
 };
 
 static struct rrd_database cpumem_rrd = {
-       .filename       = "/home/kaapeli/sysinfo/sysinfo.rrd",
+       .filename       = SYSINFO_RRD_PATH,
        .interval       = 120,
        .parse          = cpu_mem_parser,
        .images         = (struct rrd_image **)&cpu_mem_images,