]> git.itanic.dy.fi Git - rrdd/commitdiff
Merge branch 'master' into kaatokone0
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Wed, 6 Apr 2011 15:01:24 +0000 (18:01 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Wed, 6 Apr 2011 15:01:24 +0000 (18:01 +0300)
Conflicts:
database.h

1  2 
database.h

diff --cc database.h
index 5a73ccf1d165d13212ae730125df92acbd2d6bad,1c3476e6e43d0b2639bc6595a786bcd269a3e209..1c5f827633130a120a2d030c2de3364901a8fa54
@@@ -14,9 -12,10 +14,11 @@@ const char blank[] = "COMMENT:       "
  #define SYSINFO_RRD_PATH      SYSINFO_PATH "sysinfo.rrd"
  #define SYSINFO_IMAGES_PATH   SYSINFO_PATH "images/"
  
 -#define SYSTEMP_RRD_PATH      "/root/systemp/systemp.rrd"
 +#define DIGITEMP_RRD_PATH     "/home/kaapeli/digitemp/digitemp.rrd"
 +#define HDTEMP_RRD_PATH               "/root/hdtemp/hdtemp.rrd"
  
+ #define NETWORK_RRD_PATH      SYSINFO_PATH "network.rrd"
  const char *cputext[] = {
        "DEF:us=" SYSINFO_RRD_PATH ":User:AVERAGE",
        "DEF:ni=" SYSINFO_RRD_PATH ":Nice:AVERAGE",
@@@ -133,76 -132,80 +135,122 @@@ const char *memtext[] = 
        0
  };
  
 -const char *systemptext[] = {
 -      "DEF:sda_c=" SYSTEMP_RRD_PATH ":sda:AVERAGE",
 -      "DEF:SYS_c=" SYSTEMP_RRD_PATH ":SYS:AVERAGE",
 -      "DEF:CPU_c=" SYSTEMP_RRD_PATH ":CPU:AVERAGE",
+ const char *eth0text[] = {
+       "DEF:rxb=" NETWORK_RRD_PATH ":eth0rxb:AVERAGE",
+       "DEF:txb=" NETWORK_RRD_PATH ":eth0txb:AVERAGE",
+       "COMMENT:\\n",
+       blank,
+       "COMMENT:                          "
+       "MIN            MAX             AVG             Last\\n",
+       blank,
+       "LINE1:rxb#0000FF:eth0 receive     ",
+       "GPRINT:rxb:MIN:  % 3.2lf %sB",
+       "GPRINT:rxb:MAX:     % 3.2lf %sB",
+       "GPRINT:rxb:AVERAGE:      % 3.2lf %sB",
+       "GPRINT:rxb:LAST:      % 3.2lf %sB\\n",
+       blank,
+       "LINE1:txb#00FF00:eth0 transmit    ",
+       "GPRINT:txb:MIN:  % 3.2lf %sB",
+       "GPRINT:txb:MAX:     % 3.2lf %sB",
+       "GPRINT:txb:AVERAGE:      % 3.2lf %sB",
+       "GPRINT:txb:LAST:      % 3.2lf %sB\\n",
+       "COMMENT: \\n",
+       0
+ };
+ const char *eth1text[] = {
+       "DEF:rxb=" NETWORK_RRD_PATH ":eth1rxb:AVERAGE",
+       "DEF:txb=" NETWORK_RRD_PATH ":eth1txb:AVERAGE",
+       "COMMENT:\\n",
+       blank,
+       "COMMENT:                          "
+       "MIN            MAX             AVG             Last\\n",
+       blank,
+       "LINE1:rxb#0000FF:eth1 receive     ",
+       "GPRINT:rxb:MIN:  % 3.2lf %sB",
+       "GPRINT:rxb:MAX:     % 3.2lf %sB",
+       "GPRINT:rxb:AVERAGE:      % 3.2lf %sB",
+       "GPRINT:rxb:LAST:      % 3.2lf %sB\\n",
+       blank,
+       "LINE1:txb#00FF00:eth1 transmit    ",
+       "GPRINT:txb:MIN:  % 3.2lf %sB",
+       "GPRINT:txb:MAX:     % 3.2lf %sB",
+       "GPRINT:txb:AVERAGE:      % 3.2lf %sB",
+       "GPRINT:txb:LAST:      % 3.2lf %sB\\n",
+       "COMMENT: \\n",
+       0
+ };
 +const char *sensor2_text[] = {
 +      "DEF:Anturi2_c=" DIGITEMP_RRD_PATH ":Anturi2:AVERAGE",
        "COMMENT:\\n",
        blank,
 -      "COMMENT:                          "
 -      "MIN            MAX             AVG             Last\\n",
 +      "COMMENT:                                       "
 +      "MIN          MAX         AVG        Last\\n",
        blank,
 -      "LINE1:sda_c#0000FF:SAMSUNG HD501LJ      ",
 -      "GPRINT:sda_c:MIN:  %5.2lf °C",
 -      "GPRINT:sda_c:MAX:     %5.2lf °C",
 -      "GPRINT:sda_c:AVERAGE:      %5.2lf °C",
 -      "GPRINT:sda_c:LAST:      %5.2lf °C\\n",
 +      "LINE1:Anturi2_c#0000FF:Outdoor Temperature (sensor2)",
 +      "GPRINT:Anturi2_c:MIN: " tempfmt,
 +      "GPRINT:Anturi2_c:MAX: " tempfmt,
 +      "GPRINT:Anturi2_c:AVERAGE: " tempfmt,
 +      "GPRINT:Anturi2_c:LAST: " tempfmt "\\n",
 +      "COMMENT: \\n",
 +      0,
 +};
 +
 +const char *sensor3_text[] = {
 +      "DEF:Anturi3_c=" DIGITEMP_RRD_PATH ":Anturi3:AVERAGE",
 +      "COMMENT:\\n",
        blank,
 -      "LINE1:SYS_c#00FF00:Sys Temp              ",
 -      "GPRINT:SYS_c:MIN: %5.2lf °C",
 -      "GPRINT:SYS_c:MAX:     %5.2lf °C",
 -      "GPRINT:SYS_c:AVERAGE:      %5.2lf °C",
 -      "GPRINT:SYS_c:LAST:      %5.2lf °C\\n",
 +      "COMMENT:                                       "
 +      "MIN          MAX         AVG        Last\\n",
        blank,
 -      "LINE1:CPU_c#FF0000:Intel Core2 Quad     ",
 -      "GPRINT:CPU_c:MIN:  %5.2lf °C",    
 -      "GPRINT:CPU_c:MAX:     %5.2lf °C",    
 -      "GPRINT:CPU_c:AVERAGE:      %5.2lf °C",    
 -      "GPRINT:CPU_c:LAST:      %5.2lf °C\\n", 
 +      "LINE1:Anturi3_c#ff0000:Indoor Temperature (sensor3) ",
 +      "GPRINT:Anturi3_c:MIN: " tempfmt,
 +      "GPRINT:Anturi3_c:MAX: " tempfmt,
 +      "GPRINT:Anturi3_c:AVERAGE: " tempfmt,
 +      "GPRINT:Anturi3_c:LAST: " tempfmt "\\n",
        "COMMENT: \\n",
 -      0
 +      0,
 +};
 +
 +const char *hdcpu_text[] = {
 +      "DEF:hda_c=" HDTEMP_RRD_PATH ":hda:AVERAGE",
 +      "DEF:hdb_c=" HDTEMP_RRD_PATH ":hdb:AVERAGE",
 +      "DEF:hdc_c=" HDTEMP_RRD_PATH ":hdc:AVERAGE",
 +      "DEF:CPU_c=" HDTEMP_RRD_PATH ":CPU:AVERAGE",
 +      "COMMENT:\\n",
 +      blank,
 +      "COMMENT:                                    "
 +      "MIN         MAX         AVG        Last\\n",
 +      blank,
 +      "LINE1:hda_c#0000FF:Seagate Barracuda 7200.7 ",
 +      "GPRINT:hda_c:MIN: " tempfmt,
 +      "GPRINT:hda_c:MAX: " tempfmt,
 +      "GPRINT:hda_c:AVERAGE: " tempfmt,
 +      "GPRINT:hda_c:LAST: " tempfmt,
 +      "COMMENT: \\n",
 +      blank,
 +      "LINE1:hdb_c#00FFFF:Maxtor DIAMONDMAX+9      ",
 +      "GPRINT:hdb_c:MIN: " tempfmt,
 +      "GPRINT:hdb_c:MAX: " tempfmt,
 +      "GPRINT:hdb_c:AVERAGE: " tempfmt,
 +      "GPRINT:hdb_c:LAST: " tempfmt,
 +      "COMMENT: \\n",
 +      blank,
 +      "LINE1:hdc_c#00FF00:Seagate Barracuda 7200.10",
 +      "GPRINT:hdc_c:MIN: " tempfmt,
 +      "GPRINT:hdc_c:MAX: " tempfmt,
 +      "GPRINT:hdc_c:AVERAGE: " tempfmt,
 +      "GPRINT:hdc_c:LAST: " tempfmt,
 +      "COMMENT: \\n",
 +      blank,
 +      "LINE1:CPU_c#FF0000:AMD Athlon XP 2800+      ",
 +      "GPRINT:CPU_c:MIN: " tempfmt,
 +      "GPRINT:CPU_c:MAX: " tempfmt,
 +      "GPRINT:CPU_c:AVERAGE: " tempfmt,
 +      "GPRINT:CPU_c:LAST: " tempfmt "\\n",
 +      "COMMENT: \\n",
 +      0,
  };
  
  const char *cpuoptions[] = {
@@@ -282,11 -288,11 +345,13 @@@ const char *hdcpu_options[] = 
                .text = (char **)&rrdname ## text,                      \
        };
  
 -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(eth0,    "/home/kaapeli/rrdd/sysinfo/images/eth0", 720, 200);
 -DEFINE_IMAGE(eth1,    "/home/kaapeli/rrdd/sysinfo/images/eth1", 720, 200);
 +DEFINE_IMAGE(cpu,     "/home/kaapeli/sysinfo/images/cpu", 720, 480, 1);
 +DEFINE_IMAGE(mem,     "/home/kaapeli/sysinfo/images/mem", 720, 480, 1);
++DEFINE_IMAGE(eth0,    "/home/kaapeli/sysinfo/images/eth0", 720, 200, 1);
++DEFINE_IMAGE(eth1,    "/home/kaapeli/sysinfo/images/eth1", 720, 200, 1);
 +DEFINE_IMAGE(sensor2_,        "/home/apache2/temperature/sensor2", 600, 200, 2);
 +DEFINE_IMAGE(sensor3_,        "/home/apache2/temperature/sensor1-3", 600, 200, 2);
 +DEFINE_IMAGE(hdcpu_,  "/home/apache2/temperature/hdcpu", 600, 200, 2);
  
  static struct rrd_image *cpu_mem_images[] = {
        &cpudaily,
        0
  };
  
 -static struct rrd_image *systemp_images[] = {
 -      &systempdaily,
 -      &systempweekly,
 -      &systempmonthly,
 -      &systempyearly,
 -      0
 -};
 -
 +static struct rrd_image *temp_images[] = {
 +      &sensor2_daily,
 +      &sensor2_weekly,
 +      &sensor2_monthly,
 +      &sensor2_yearly,
 +      &sensor3_daily,
 +      &sensor3_weekly,
 +      &sensor3_monthly,
 +      &sensor3_yearly,
 +      0,
 +};
 +
 +static struct rrd_image *hdcpu_images[] = {
 +      &hdcpu_daily,
 +      &hdcpu_weekly,
 +      &hdcpu_monthly,
 +      &hdcpu_yearly,
 +      0,
 +};
 +
+ static struct rrd_image *network_images[] = {
+       &eth0daily,
+       &eth0weekly,
+       &eth0monthly,
+       &eth0yearly,
+       &eth1daily,
+       &eth1weekly,
+       &eth1monthly,
+       &eth1yearly,
+       NULL,
+ };
 -      SOURCE_ENTRY("eth0rxb", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth0rxp", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth0txb", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth0txp", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth1rxb", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth1rxp", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth1txb", "COUNTER", 240, 0, 120000000000)
 -      SOURCE_ENTRY("eth1txp", "COUNTER", 240, 0, 120000000000)
+ #define SOURCE_ENTRY(_name, _type, _heartbeat, _min, _max) \
+       {                                                  \
+               .name = _name,                             \
+               .type = _type,                             \
+               .heartbeat = _heartbeat,                   \
+               .min = _min,                               \
+               .max = _max,                               \
+       },
+ #define ARCHIVE_ENTRY(_type, _xff, _steps, _rows) \
+       {                                         \
+               .type = _type,                    \
+               .xff = _xff,                      \
+               .steps = _steps,                  \
+               .rows = _rows,                    \
+       },
+ struct rrd_data_source cpumem_sources[] = {
+       SOURCE_ENTRY("User",    "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("Nice",    "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("Sys",     "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("Idle",    "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("Wait",    "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("IRQ",     "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("SoftIRQ", "COUNTER", 240, 0, 1200)
+       SOURCE_ENTRY("Free",    "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Buffers", "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Cached",  "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Active",  "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Inactive","GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("SwapFree","GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Anon",    "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Slab",    "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Tables",  "GAUGE", 240, 0, 32768)
+       SOURCE_ENTRY("Swap",    "GAUGE", 240, 0, 32768)
+       {},
+ };
+ struct rrd_archive cpumem_archives[] = {
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 1, 720)
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 7, 720)
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 31, 720)
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 365, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 1, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 7, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 31, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 365, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 1, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 7, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 31, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 365, 720)
+       {},
+ };
+ struct rrd_data_source network_sources[] = {
++      SOURCE_ENTRY("eth0rxb", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth0rxp", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth0txb", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth0txp", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth1rxb", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth1rxp", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth1txb", "COUNTER", 240, 0, 120000000)
++      SOURCE_ENTRY("eth1txp", "COUNTER", 240, 0, 120000000)
+       {},
+ };
+ struct rrd_archive network_archives[] = {
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 1, 720)
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 7, 720)
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 31, 720)
+       ARCHIVE_ENTRY("AVERAGE", 0.5, 365, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 1, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 7, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 31, 720)
+       ARCHIVE_ENTRY("MIN", 0.5, 365, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 1, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 7, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 31, 720)
+       ARCHIVE_ENTRY("MAX", 0.5, 365, 720)
+       {},
+ };
  static struct rrd_database cpumem_rrd = {
        .filename       = SYSINFO_RRD_PATH,
        .interval       = 120,
        .parse          = cpu_mem_parser,
        .images         = (struct rrd_image **)&cpu_mem_images,
 -      .sources        = cpumem_sources,
 -      .archives       = cpumem_archives,
 -      .name           = "cpumem",
 +      .name           = "cpumem"
 +};
 +
 +static struct rrd_database digitemp_rrd = {
 +      .filename       = DIGITEMP_RRD_PATH,
 +      .interval       = 300,
 +      .parse          = digitemp_parser_mod,
 +      .images         = (struct rrd_image **)&temp_images,
 +      .name           = "digitemp",
  };
  
 -static struct rrd_database systemp_rrd = {
 +static struct rrd_database hdtemp_rrd = {
 +      .filename       = HDTEMP_RRD_PATH,
        .interval       = 300,
 -      .parse          = NULL,
 -      .filename       = NULL,
 -      .images         = (struct rrd_image **)&systemp_images,
 -      .name           = "systemp",
 +      .parse          = 0,
 +      .images         = (struct rrd_image **)&hdcpu_images,
 +      .name           = "hdtemp",
  };
  
+ char *network_interfaces[] = {
+       "eth0",
+       "eth1",
+       NULL,
+ };
+ static struct rrd_database network_rrd = {
+       .name           = "network",
+       .filename       = NETWORK_RRD_PATH,
+       .interval       = 120,
+       .parse          = netstats_parser,
+       .sources        = network_sources,
+       .archives       = network_archives,
+       .parser_data    = network_interfaces,
+       .images         = network_images,
+ };
  
  static struct rrd_database *all_rrds[] = {
        &cpumem_rrd,
 -      &systemp_rrd,
 +      &digitemp_rrd,
 +      &hdtemp_rrd,
+       &network_rrd,
 -      0
 +      0,
  };
  
  #endif