#include "scheduler.h"
#include "parser.h"
-const char blank[] = "COMMENT: ";
+const char blank[] = "COMMENT: ";
#define numfmt " % 8.2lf "
#define SYSINFO_PATH "/home/kaapeli/rrdd/sysinfo/"
#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",
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",
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",
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);
static struct rrd_image *cpu_mem_images[] = {
&cpudaily,
0
};
+static struct rrd_image *network_images[] = {
+ ð0daily,
+ ð0weekly,
+ ð0monthly,
+ ð0yearly,
+ ð1daily,
+ ð1weekly,
+ ð1monthly,
+ ð1yearly,
+ NULL,
+};
+
static struct rrd_image *systemp_images[] = {
&systempdaily,
&systempweekly,
{},
};
+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,
.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,
+ &network_rrd,
0
};