@cryptotaxi247 / netdata-1 / commits / f9eaa6fd2

made HardwareCorrupted appear only when the machine reports it

Costa Tsaousis (ktsaou) committed Apr 17, 2014 at 21:54 UTC f9eaa6fd251d53b556f514ace4fa0f6d77dc7be5
1 file changed +16 -10
netdata.c
+16 -10
@@ -1540,6 +1540,8 @@ int web_client_data_request(struct web_client *w, char *url, int datasource_type
1540 unsigned long last_timestamp_in_data = 0;
1541 if(datasource_type == DATASOURCE_GOOGLE_JSON || datasource_type == DATASOURCE_GOOGLE_JSONP) {
1542
1543 + w->data->contenttype = CT_APPLICATION_X_JAVASCRIPT;
1544 +
1545 while(args) {
1546 tok = mystrsep(&args, "&");
1547 if(tok) {
@@ -3629,6 +3631,8 @@ int do_proc_meminfo() {
3631 return 1;
3632 }
3633
3634 + int hwcorrupted = 0;
3635 +
3636 unsigned long long MemTotal = 0, MemFree = 0, Buffers = 0, Cached = 0, SwapCached = 0,
3637 Active = 0, Inactive = 0, ActiveAnon = 0, InactiveAnon = 0, ActiveFile = 0, InactiveFile = 0,
3638 Unevictable = 0, Mlocked = 0, SwapTotal = 0, SwapFree = 0, Dirty = 0, Writeback = 0, AnonPages = 0,
@@ -3686,7 +3690,7 @@ int do_proc_meminfo() {
3690 else if(!VmallocTotal && strcmp(name, "VmallocTotal") == 0) VmallocTotal = value;
3691 else if(!VmallocUsed && strcmp(name, "VmallocUsed") == 0) VmallocUsed = value;
3692 else if(!VmallocChunk && strcmp(name, "VmallocChunk") == 0) VmallocChunk = value;
3689 - else if(!HardwareCorrupted && strcmp(name, "HardwareCorrupted") == 0) HardwareCorrupted = value;
3693 + else if(!HardwareCorrupted && strcmp(name, "HardwareCorrupted") == 0) { HardwareCorrupted = value; hwcorrupted = 1; }
3694 else if(!AnonHugePages && strcmp(name, "AnonHugePages") == 0) AnonHugePages = value;
3695 else if(!HugePages_Total && strcmp(name, "HugePages_Total") == 0) HugePages_Total = value;
3696 else if(!HugePages_Free && strcmp(name, "HugePages_Free") == 0) HugePages_Free = value;
@@ -3740,17 +3744,19 @@ int do_proc_meminfo() {
3744
3745 // --------------------------------------------------------------------
3746
3743 - st = rrd_stats_find("mem.hwcorrupt");
3744 - if(!st) {
3745 - st = rrd_stats_create("mem", "hwcorrupt", NULL, "mem", "Hardware Corrupted ECC", "MB", save_history);
3746 - st->isdetail = 1;
3747 + if(hwcorrupted) {
3748 + st = rrd_stats_find("mem.hwcorrupt");
3749 + if(!st) {
3750 + st = rrd_stats_create("mem", "hwcorrupt", NULL, "mem", "Hardware Corrupted ECC", "MB", save_history);
3751 + st->isdetail = 1;
3752
3748 - rrd_stats_dimension_add(st, "HardwareCorrupted", NULL, sizeof(unsigned long long), 0, 1, 1024, RRD_DIMENSION_ABSOLUTE, NULL);
3749 - }
3750 - else rrd_stats_next(st);
3753 + rrd_stats_dimension_add(st, "HardwareCorrupted", NULL, sizeof(unsigned long long), 0, 1, 1024, RRD_DIMENSION_ABSOLUTE, NULL);
3754 + }
3755 + else rrd_stats_next(st);
3756
3752 - rrd_stats_dimension_set(st, "HardwareCorrupted", &HardwareCorrupted, NULL);
3753 - rrd_stats_done(st);
3757 + rrd_stats_dimension_set(st, "HardwareCorrupted", &HardwareCorrupted, NULL);
3758 + rrd_stats_done(st);
3759 + }
3760
3761 // --------------------------------------------------------------------
3762