]> git.itanic.dy.fi Git - rrdd/commitdiff
itanic: database.h update
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 11 Mar 2011 21:18:37 +0000 (23:18 +0200)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 11 Mar 2011 21:18:37 +0000 (23:18 +0200)
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
database.h

index 231c47c7e86faf05f7578350ab9908dcc3207d9e..eacb856bba73ad7427625eee0944209240ba5f46 100644 (file)
@@ -5,13 +5,17 @@
 #include "scheduler.h"
 #include "parser.h"
 
-const char blank[] = "COMMENT:               ";
+const char blank[] = "COMMENT:           ";
 #define numfmt " % 8.2lf "
 
-#define SYSINFO_PATH           "/home/kaapeli/sysinfo/"
+#define SYSINFO_PATH           "/home/kaapeli/rrdd/sysinfo/"
 #define SYSINFO_RRD_PATH       SYSINFO_PATH "sysinfo.rrd"
 #define SYSINFO_IMAGES_PATH    SYSINFO_PATH "images/"
 
+#define POWER_PATH             "/home/kaapeli/rrdd/power/"
+#define POWER_RRD_PATH         POWER_PATH "power.rrd"
+#define POWER_IMAGES_PATH      POWER_PATH "images/"
+
 #define SYSTEMP_RRD_PATH       "/root/systemp/systemp.rrd"
 
 const char *cputext[] = {
@@ -160,8 +164,81 @@ const char *systemptext[] = {
        0
 };
 
+const char *powertext[] = {
+       "DEF:vesiv=" POWER_RRD_PATH ":vesivoima:AVERAGE",
+       "DEF:ydinv=" POWER_RRD_PATH ":ydinvoima:AVERAGE",
+       "DEF:lauhd=" POWER_RRD_PATH ":lauhdevoima:AVERAGE",
+       "DEF:kauko=" POWER_RRD_PATH ":kaukolampo:AVERAGE",
+       "DEF:teoll=" POWER_RRD_PATH ":teollisuus:AVERAGE",
+       "DEF:muutu=" POWER_RRD_PATH ":muu:AVERAGE",
+       "DEF:huipp=" POWER_RRD_PATH ":huippuvoima:AVERAGE",
+       "DEF:tuont=" POWER_RRD_PATH ":tuonti:AVERAGE",
+       "COMMENT:\\n",
+       blank,
+       "COMMENT:                   "
+       "MIN          MAX         AVG        Last\\n",
+       blank,
+       "AREA:tuont#000000:Tuonti       ",
+       "GPRINT:tuont:MIN:" numfmt,
+       "GPRINT:tuont:MAX:" numfmt,
+       "GPRINT:tuont:AVERAGE:" numfmt,
+       "GPRINT:tuont:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:muutu#808080:Muu         ",
+       "GPRINT:huipp:MIN:" numfmt,
+       "GPRINT:huipp:MAX:" numfmt,
+       "GPRINT:huipp:AVERAGE:" numfmt,
+       "GPRINT:huipp:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:vesiv#0000ff:Vesivoima   ",
+       "GPRINT:vesiv:MIN:" numfmt,
+       "GPRINT:vesiv:MAX:" numfmt,
+       "GPRINT:vesiv:AVERAGE:" numfmt,
+       "GPRINT:vesiv:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:lauhd#ff0000:Lauhdevoima ",
+       "GPRINT:lauhd:MIN:" numfmt,
+       "GPRINT:lauhd:MAX:" numfmt,
+       "GPRINT:lauhd:AVERAGE:" numfmt,
+       "GPRINT:lauhd:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:kauko#00ff00:Kaukolämpö  ",
+       "GPRINT:kauko:MIN:" numfmt,
+       "GPRINT:kauko:MAX:" numfmt,
+       "GPRINT:kauko:AVERAGE:" numfmt,
+       "GPRINT:kauko:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:teoll#ff00ff:Teollisuus  ",
+       "GPRINT:teoll:MIN:" numfmt,
+       "GPRINT:teoll:MAX:" numfmt,
+       "GPRINT:teoll:AVERAGE:" numfmt,
+       "GPRINT:teoll:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:huipp#ff0000:Huippuvoima ",
+       "GPRINT:huipp:MIN:" numfmt,
+       "GPRINT:huipp:MAX:" numfmt,
+       "GPRINT:huipp:AVERAGE:" numfmt,
+       "GPRINT:huipp:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       blank,
+       "STACK:ydinv#ffff00:Ydinvoima   ",
+       "GPRINT:ydinv:MIN:" numfmt,
+       "GPRINT:ydinv:MAX:" numfmt,
+       "GPRINT:ydinv:AVERAGE:" numfmt,
+       "GPRINT:ydinv:LAST:" numfmt "\\n",
+       "COMMENT: \\n",
+       0
+};
+
 const char *cpuoptions[] = {
        "--alt-autoscale-max",
+       "--lower-limit", "0",
        "--vertical-label",
        "CPU Tics",
        0
@@ -169,6 +246,7 @@ const char *cpuoptions[] = {
 
 const char *memoptions[] = {
        "--alt-autoscale-max",
+       "--lower-limit", "0",
        "--vertical-label",
        "Mem usage (MB)",
        "--units-exponent", "0",
@@ -181,6 +259,15 @@ const char *systempoptions[] = {
        0
 };
 
+const char *poweroptions[] = {
+       "--alt-autoscale-max",
+       "--lower-limit", "0",
+       "--vertical-label",
+       "Teho (MW)",
+       "--units-exponent", "0",
+       0
+};
+
 static struct rrd_image cpudaily = {
        .image_filename = SYSINFO_IMAGES_PATH "cpu_daily.png",
        .width = 720,
@@ -311,6 +398,50 @@ static struct rrd_image systempyearly = {
        .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 = 200,
+       .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 = 200,
+       .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 = 200,
+       .timestart = "end-1y",
+       .timeend = "now",
+       .imageformat = "PNG",
+       .options = (char **)&poweroptions,
+       .text = (char **)&powertext
+};
+
 static struct rrd_image *cpu_mem_images[] = {
        &cpudaily,
        &cpuweekly,
@@ -331,6 +462,14 @@ static struct rrd_image *systemp_images[] = {
        0
 };
 
+static struct rrd_image *power_images[] = {
+       &powerdaily,
+       &powerweekly,
+       &powermonthly,
+       &poweryearly,
+       0
+};
+
 struct rrd_data_source cpumem_sources[] = {
        {
                .name = "User",
@@ -339,6 +478,13 @@ struct rrd_data_source cpumem_sources[] = {
                .min = 0,
                .max = 1200,
        },
+       {
+               .name = "Nice",
+               .type = "COUNTER",
+               .heartbeat = 240,
+               .min = 0,
+               .max = 1200,
+       },
        {
                .name = "Sys",
                .type = "COUNTER",
@@ -717,17 +863,27 @@ static struct rrd_database cpumem_rrd = {
        .name           = "cpumem",
 };
 
+char *power_parse_cmdline[] = {
+       "./parse_power.sh",
+       "",
+       NULL,
+};
+
 static struct rrd_database power_rrd = {
        .name           = "power",
-       .filename       = "./power.rrd",
-       .interval       = 300,
+       .filename       = POWER_RRD_PATH,
+       .interval       = 180,
        .sources        = power_sources,
        .archives       = power_archives,
+       .parse          = script_parser,
+       .parser_data    = power_parse_cmdline,
+       .images         = power_images,
 };
 
 static struct rrd_database systemp_rrd = {
        .interval       = 300,
        .parse          = NULL,
+       .filename       = NULL,
        .images         = (struct rrd_image **)&systemp_images,
        .name           = "systemp",
 };