-#ifndef _TESTDATA_H
-#define _TESTDATA_H
-
-#include "rrdtool.h"
-#include "parser.h"
-
-const char blank[] = "COMMENT: ";
-#define numfmt " % 8.2lf "
-
-#define SYSINFO_PATH "./"
-#define SYSINFO_RRD_PATH SYSINFO_PATH "sysinfo.rrd"
-#define SYSINFO_IMAGES_PATH SYSINFO_PATH "images/"
-
-#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",
- "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: "
- "MIN MAX AVG Last\\n",
- blank,
- "AREA:sy#ff0000:System ",
- "GPRINT:sy:MIN:" numfmt,
- "GPRINT:sy:MAX:" numfmt,
- "GPRINT:sy:AVERAGE:" numfmt,
- "GPRINT:sy:LAST:" numfmt "\\n",
- blank,
- "STACK:us#0000ff:User ",
- "GPRINT:us:MIN:" numfmt,
- "GPRINT:us:MAX:" numfmt,
- "GPRINT:us:AVERAGE:" numfmt,
- "GPRINT:us:LAST:" numfmt "\\n",
- blank,
- "STACK:ni#00ff00:Nice ",
- "GPRINT:ni:MIN:" numfmt,
- "GPRINT:ni:MAX:" numfmt,
- "GPRINT:ni:AVERAGE:" numfmt,
- "GPRINT:ni:LAST:" numfmt "\\n",
- blank,
- "STACK:id#ffffff:Idle ",
- "GPRINT:id:MIN:" numfmt,
- "GPRINT:id:MAX:" numfmt,
- "GPRINT:id:AVERAGE:" numfmt,
- "GPRINT:id:LAST:" numfmt "\\n",
- blank,
- "STACK:wa#ff00ff:IO wait ",
- "GPRINT:wa:MIN:" numfmt,
- "GPRINT:wa:MAX:" numfmt,
- "GPRINT:wa:AVERAGE:" numfmt,
- "GPRINT:wa:LAST:" numfmt "\\n",
- blank,
- "STACK:in#ffff00:IRQ ",
- "GPRINT:in:MIN:" numfmt,
- "GPRINT:in:MAX:" numfmt,
- "GPRINT:in:AVERAGE:" numfmt,
- "GPRINT:in:LAST:" numfmt "\\n",
- blank,
- "STACK:so#00ffff:Soft IRQ ",
- "GPRINT:so:MIN:" numfmt,
- "GPRINT:so:MAX:" numfmt,
- "GPRINT:so:AVERAGE:" numfmt,
- "GPRINT:so:LAST:" numfmt "\\n",
- "COMMENT: \\n",
- 0
-};
-
-const char *memtext[] = {
- "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:ot=" SYSINFO_RRD_PATH ":Other:AVERAGE",
- "DEF:sw=" SYSINFO_RRD_PATH ":Swap:AVERAGE",
- "COMMENT:\\n",
- blank,
- "COMMENT: "
- "MIN MAX AVG Last\\n",
- blank,
- "AREA:bu#ffff00:Buffers ",
- "GPRINT:bu:MIN:" numfmt,
- "GPRINT:bu:MAX:" numfmt,
- "GPRINT:bu:AVERAGE:" numfmt,
- "GPRINT:bu:LAST:" numfmt "\\n",
- blank,
- "STACK:an#000000:AnonPages ",
- "GPRINT:an:MIN:" numfmt,
- "GPRINT:an:MAX:" numfmt,
- "GPRINT:an:AVERAGE:" numfmt,
- "GPRINT:an:LAST:" numfmt "\\n",
- blank,
- "STACK:ca#00ff00:Cached ",
- "GPRINT:ca:MIN:" numfmt,
- "GPRINT:ca:MAX:" numfmt,
- "GPRINT:ca:AVERAGE:" numfmt,
- "GPRINT:ca:LAST:" numfmt "\\n",
- blank,
- "STACK:fr#ffffff:Free ",
- "GPRINT:fr:MIN:" numfmt,
- "GPRINT:fr:MAX:" numfmt,
- "GPRINT:fr:AVERAGE:" numfmt,
- "GPRINT:fr:LAST:" numfmt "\\n",
- blank,
- "STACK:sl#00ffff:Slab ",
- "GPRINT:sl:MIN:" numfmt,
- "GPRINT:sl:MAX:" numfmt,
- "GPRINT:sl:AVERAGE:" numfmt,
- "GPRINT:sl:LAST:" numfmt "\\n",
- blank,
- "STACK:ta#0000ff:PageTables ",
- "GPRINT:ta:MIN:" numfmt,
- "GPRINT:ta:MAX:" numfmt,
- "GPRINT:ta:AVERAGE:" numfmt,
- "GPRINT:ta:LAST:" numfmt "\\n",
- blank,
- "STACK:ot#a0a0a0:Other ",
- "GPRINT:ot:MIN:" numfmt,
- "GPRINT:ot:MAX:" numfmt,
- "GPRINT:ot:AVERAGE:" numfmt,
- "GPRINT:ot:LAST:" numfmt "\\n",
- blank,
- "STACK:sw#ff0000:Swap ",
- "GPRINT:sw:MIN:" numfmt,
- "GPRINT:sw:MAX:" numfmt,
- "GPRINT:sw:AVERAGE:" numfmt,
- "GPRINT:sw:LAST:" numfmt "\\n",
- "COMMENT: \\n",
- 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 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 *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",
- "COMMENT:\\n",
- blank,
- "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",
- 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",
- 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",
- "COMMENT: \\n",
- 0
-};
-
-const char *cpuoptions[] = {
- "--alt-autoscale-max",
- "--lower-limit", "0",
- "--vertical-label",
- "CPU Tics",
- 0
-};
-
-const char *memoptions[] = {
- "--alt-autoscale-max",
- "--lower-limit", "0",
- "--vertical-label",
- "Mem usage (MB)",
- "--units-exponent", "0",
- "--base", "1024",
- 0
-};
-
-const char *eth0options[] = {
- "--alt-autoscale-max",
- "--vertical-label", "Bytes",
- "--lower-limit", "0",
- 0
-};
-
-const char *eth1options[] = {
- "--alt-autoscale-max",
- "--vertical-label", "Bytes",
- "--lower-limit", "0",
- 0
-};
-
-const char *systempoptions[] = {
- "--alt-autoscale",
- "--vertical-label", "Temp °C",
- 0
-};
-
-#define DEFINE_IMAGE(rrdname, _filename, _width, _height, time) \
- static struct rrd_image rrdname ## daily = { \
- .image_filename = _filename "_daily.png", \
- .width = _width, \
- .height = _height, \
- .timestart = "end-" #time "d", \
- .timeend = "now", \
- .imageformat = "PNG", \
- .options = (const char **)&rrdname ## options, \
- .text = (const char **)&rrdname ## text, \
- }; \
- static struct rrd_image rrdname ## weekly = { \
- .image_filename = _filename "_weekly.png", \
- .width = _width, \
- .height = _height, \
- .timestart = "end-" #time "w", \
- .timeend = "now", \
- .imageformat = "PNG", \
- .options = (const char **)&rrdname ## options, \
- .text = (const char **)&rrdname ## text, \
- }; \
- static struct rrd_image rrdname ## monthly = { \
- .image_filename = _filename "_monthly.png", \
- .width = _width, \
- .height = _height, \
- .timestart = "end-" #time "m", \
- .timeend = "now", \
- .imageformat = "PNG", \
- .options = (const char **)&rrdname ## options, \
- .text = (const char **)&rrdname ## text, \
- }; \
- static struct rrd_image rrdname ## yearly = { \
- .image_filename = _filename "_yearly.png", \
- .width = _width, \
- .height = _height, \
- .timestart = "end-" #time "y", \
- .timeend = "now", \
- .imageformat = "PNG", \
- .options = (const char **)&rrdname ## options, \
- .text = (const char **)&rrdname ## text, \
- };
-
-DEFINE_IMAGE(cpu, SYSINFO_PATH "/images/cpu", 720, 480, 1);
-DEFINE_IMAGE(mem, SYSINFO_PATH "/images/mem", 720, 480, 1);
-DEFINE_IMAGE(systemp, SYSINFO_PATH "/images/systemp", 720,480,1);
-DEFINE_IMAGE(eth0, SYSINFO_PATH "/images/eth0", 720, 200, 1);
-DEFINE_IMAGE(eth1, SYSINFO_PATH "/images/eth1", 720, 200, 1);
-
-static struct rrd_image *cpu_mem_images[] = {
- &cpudaily,
- &cpuweekly,
- &cpumonthly,
- &cpuyearly,
- &memdaily,
- &memweekly,
- &memmonthly,
- &memyearly,
- 0
-};
-
-static struct rrd_image *network_images[] = {
- ð0daily,
- ð0weekly,
- ð0monthly,
- ð0yearly,
- ð1daily,
- ð1weekly,
- ð1monthly,
- ð1yearly,
- NULL,
-};
-
-static struct rrd_image *systemp_images[] = {
- &systempdaily,
- &systempweekly,
- &systempmonthly,
- &systempyearly,
- 0
-};
-
-#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("Other", "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, 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)
- {},
-};
-
-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",
-};
-
-static struct rrd_database systemp_rrd = {
- .interval = 300,
- .parse = NULL,
- .filename = NULL,
- .images = (struct rrd_image **)&systemp_images,
- .name = "systemp",
-};
-
-const 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 *default_rrds[] = {
- &cpumem_rrd,
- &systemp_rrd,
- &network_rrd,
- 0
-};
-
-#endif