"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,
"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,
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)
{},
};
{
char buf[1024], word[1024];
int free = 0, buffered = 0, cache = 0, active = 0, inactive = 0,
- swapfree = 0, anon = 0, slab = 0, tables = 0, swaptotal = 0;
+ swapfree = 0, anon = 0, slab = 0, tables = 0, other = 0,
+ swaptotal = 0, total = 0;
FILE *file = fopen(MEMFILE, "r");
if (file == NULL) {
if (!strcmp(word, "MemFree:")) {
free = dec_to_int(buf, NULL);
+ } else if (!strcmp(word, "MemTotal:")) {
+ total = dec_to_int(buf, NULL);
} else if (!strcmp(word, "Buffers:")) {
buffered = dec_to_int(buf, NULL);
} else if (!strcmp(word, "Cached:")) {
}
fclose(file);
- snprintf(data, RRD_DATA_MAX_LEN, "%f:%f:%f:%f:%f:%f:%f:%f:%f:%f",
+ other = total - free - buffered - cache - anon - slab - tables;
+
+ snprintf(data, RRD_DATA_MAX_LEN, "%f:%f:%f:%f:%f:%f:%f:%f:%f:%f:%f",
free / 1024.0,
buffered / 1024.0,
cache / 1024.0,
anon / 1024.0,
slab / 1024.0,
tables / 1024.0,
+ other / 1024.0,
(swaptotal - swapfree) / 1024.0);
return 0;