]> git.itanic.dy.fi Git - rrdd/commitdiff
itanic: Changes
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 27 Mar 2011 19:59:17 +0000 (22:59 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 27 Mar 2011 19:59:17 +0000 (22:59 +0300)
- Add network statistics
- Adjust some fields
- Remove unused systemp images

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

index 1ce8ab900fca51cffb1ea98fcc52bc7ad6bb2d3d..80aea773f2c0fb90896dd67e5bcd6974edbaf836 100644 (file)
@@ -18,6 +18,8 @@ const char blank[] = "COMMENT:       ";
 
 #define SYSTEMP_RRD_PATH       "/root/systemp/systemp.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",
@@ -134,6 +136,50 @@ const char *memtext[] = {
        0
 };
 
+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 rx bytes        ",
+       "GPRINT:rxb:MIN:  %5.0lf B",
+       "GPRINT:rxb:MAX:     %5.0lf B",
+       "GPRINT:rxb:AVERAGE:      %5.0lf B",
+       "GPRINT:rxb:LAST:      %5.0lf B\\n",
+       blank,
+       "LINE1:txb#00FF00:eth0 tx bytes        ",
+       "GPRINT:txb:MIN:  %5.0lf B",
+       "GPRINT:txb:MAX:     %5.0lf B",
+       "GPRINT:txb:AVERAGE:      %5.0lf B",
+       "GPRINT:txb:LAST:      %5.0lf B\\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 rx bytes        ",
+       "GPRINT:rxb:MIN:  %5.0lf B",
+       "GPRINT:rxb:MAX:     %5.0lf B",
+       "GPRINT:rxb:AVERAGE:      %5.0lf B",
+       "GPRINT:rxb:LAST:      %5.0lf B\\n",
+       blank,
+       "LINE1:txb#00FF00:eth1 tx bytes        ",
+       "GPRINT:txb:MIN:  %5.0lf B",
+       "GPRINT:txb:MAX:     %5.0lf B",
+       "GPRINT:txb:AVERAGE:      %5.0lf B",
+       "GPRINT:txb:LAST:      %5.0lf B\\n",
+       0
+};
+
 const char *systemptext[] = {
        "DEF:sda_c=" SYSTEMP_RRD_PATH ":sda:AVERAGE",
        "DEF:SYS_c=" SYSTEMP_RRD_PATH ":SYS:AVERAGE",
@@ -298,6 +344,18 @@ const char *memoptions[] = {
        0
 };
 
+const char *eth0options[] = {
+       "--alt-autoscale",
+       "--vertical-label", "Bytes",
+       0
+};
+
+const char *eth1options[] = {
+       "--alt-autoscale",
+       "--vertical-label", "Bytes",
+       0
+};
+
 const char *systempoptions[] = {
        "--alt-autoscale",
        "--vertical-label", "Temp °C",
@@ -307,14 +365,14 @@ const char *systempoptions[] = {
 const char *freqoptions[] = {
        "--alt-autoscale",
        "--vertical-label", "Taajuus Hz",
-       "--units-exponent", "-2",
+       "--units-exponent", "-3",
        0
 };
 
 const char *deviationoptions[] = {
        "--alt-autoscale",
        "--vertical-label", "Aikapoikkeama s",
-       "--units-exponent", "-2",
+       "--units-exponent", "-3",
        0
 };
 
@@ -392,6 +450,8 @@ DEFINE_IMAGE(power, "/home/kaapeli/rrdd/power/images/power", 480, 480);
 DEFINE_IMAGE(freq,     "/home/kaapeli/rrdd/power/images/freq", 480, 240);
 DEFINE_IMAGE(deviation,        "/home/kaapeli/rrdd/power/images/deviation", 480, 240);
 DEFINE_IMAGE(price,    "/home/kaapeli/rrdd/power/images/price", 480, 240);
+DEFINE_IMAGE(eth0,     "/home/kaapeli/rrdd/sysinfo/images/eth0", 720, 200);
+DEFINE_IMAGE(eth1,     "/home/kaapeli/rrdd/sysinfo/images/eth1", 720, 200);
 
 static struct rrd_image *cpu_mem_images[] = {
        &cpudaily,
@@ -405,6 +465,18 @@ static struct rrd_image *cpu_mem_images[] = {
        0
 };
 
+static struct rrd_image *network_images[] = {
+       &eth0daily,
+       &eth0weekly,
+       &eth0monthly,
+       &eth0yearly,
+       &eth1daily,
+       &eth1weekly,
+       &eth1monthly,
+       &eth1yearly,
+       NULL,
+};
+
 static struct rrd_image *systemp_images[] = {
        &systempdaily,
        &systempweekly,
@@ -487,6 +559,34 @@ struct rrd_archive cpumem_archives[] = {
        {},
 };
 
+struct rrd_data_source network_sources[] = {
+       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)
+       {},
+};
+
+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)
+       {},
+};
+
 struct rrd_data_source power_sources[] = {
        SOURCE_ENTRY("kulutus", "GAUGE", 360, 0, 3000)
        SOURCE_ENTRY("tuotanto", "GAUGE", 360, 0, 3000)
@@ -557,10 +657,27 @@ static struct rrd_database systemp_rrd = {
        .name           = "systemp",
 };
 
+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,
        &power_rrd,
+       &network_rrd,
        0
 };