]> arthur.barton.de Git - netdata.git/blobdiff - src/sys_devices_system_edac_mc.c
dns_query_time plugin: replace "." with "_" in dimensions
[netdata.git] / src / sys_devices_system_edac_mc.c
index 868329e3ade696bb034a4a1ddd76966248368e59..c41ad7faa1d9401926343fa9132ede7fa0c4f831 100644 (file)
@@ -23,7 +23,7 @@ static struct mc *mc_root = NULL;
 
 static void find_all_mc() {
     char name[FILENAME_MAX + 1];
-    snprintfz(name, FILENAME_MAX, "%s%s", global_host_prefix, "/sys/devices/system/edac/mc");
+    snprintfz(name, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/sys/devices/system/edac/mc");
     char *dirname = config_get("plugin:proc:/sys/devices/system/edac/mc", "directory to monitor", name);
 
     DIR *dir = opendir(dirname);
@@ -76,11 +76,11 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
     struct mc *m;
 
     if(unlikely(do_ce == -1)) {
-        do_ce = config_get_boolean_ondemand("plugin:proc:/sys/devices/system/edac/mc", "enable ECC memory correctable errors", CONFIG_ONDEMAND_ONDEMAND);
-        do_ue = config_get_boolean_ondemand("plugin:proc:/sys/devices/system/edac/mc", "enable ECC memory uncorrectable errors", CONFIG_ONDEMAND_ONDEMAND);
+        do_ce = config_get_boolean_ondemand("plugin:proc:/sys/devices/system/edac/mc", "enable ECC memory correctable errors", CONFIG_BOOLEAN_AUTO);
+        do_ue = config_get_boolean_ondemand("plugin:proc:/sys/devices/system/edac/mc", "enable ECC memory uncorrectable errors", CONFIG_BOOLEAN_AUTO);
     }
 
-    if(do_ce != CONFIG_ONDEMAND_NO) {
+    if(do_ce != CONFIG_BOOLEAN_NO) {
         for(m = mc_root; m; m = m->next) {
             if(m->ce_count_filename) {
                 m->ce_updated = 0;
@@ -95,14 +95,14 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
                 if(unlikely(!m->ce_ff || procfile_lines(m->ce_ff) < 1 || procfile_linewords(m->ce_ff, 0) < 1))
                     continue;
 
-                m->ce_count = strtoull(procfile_lineword(m->ce_ff, 0, 0), NULL, 0);
+                m->ce_count = str2ull(procfile_lineword(m->ce_ff, 0, 0));
                 ce_sum += m->ce_count;
                 m->ce_updated = 1;
             }
         }
     }
 
-    if(do_ue != CONFIG_ONDEMAND_NO) {
+    if(do_ue != CONFIG_BOOLEAN_NO) {
         for(m = mc_root; m; m = m->next) {
             if(m->ue_count_filename) {
                 m->ue_updated = 0;
@@ -117,7 +117,7 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
                 if(unlikely(!m->ue_ff || procfile_lines(m->ue_ff) < 1 || procfile_linewords(m->ue_ff, 0) < 1))
                     continue;
 
-                m->ue_count = strtoull(procfile_lineword(m->ue_ff, 0, 0), NULL, 0);
+                m->ue_count = str2ull(procfile_lineword(m->ue_ff, 0, 0));
                 ue_sum += m->ue_count;
                 m->ue_updated = 1;
             }
@@ -126,20 +126,20 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
 
     // --------------------------------------------------------------------
 
-    if(do_ce == CONFIG_ONDEMAND_YES || (do_ce == CONFIG_ONDEMAND_ONDEMAND && ce_sum > 0)) {
-        do_ce = CONFIG_ONDEMAND_YES;
+    if(do_ce == CONFIG_BOOLEAN_YES || (do_ce == CONFIG_BOOLEAN_AUTO && ce_sum > 0)) {
+        do_ce = CONFIG_BOOLEAN_YES;
 
         static RRDSET *ce_st = NULL;
 
         if(unlikely(!ce_st)) {
-            ce_st = rrdset_find("mem.ecc_ce");
+            ce_st = rrdset_find_localhost("mem.ecc_ce");
             if(unlikely(!ce_st))
-                ce_st = rrdset_create("mem", "ecc_ce", NULL, "ecc", NULL, "ECC Memory Correctable Errors", "errors",
-                        6600, update_every, RRDSET_TYPE_LINE);
+                ce_st = rrdset_create_localhost("mem", "ecc_ce", NULL, "ecc", NULL, "ECC Memory Correctable Errors"
+                                                , "errors", 6600, update_every, RRDSET_TYPE_LINE);
 
             for(m = mc_root; m; m = m->next)
                 if(m->ce_count_filename)
-                    m->ce_rd = rrddim_add(ce_st, m->name, NULL, 1, 1, RRDDIM_INCREMENTAL);
+                    m->ce_rd = rrddim_add(ce_st, m->name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
         }
         else
             rrdset_next(ce_st);
@@ -153,21 +153,21 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
 
     // --------------------------------------------------------------------
 
-    if(do_ue == CONFIG_ONDEMAND_YES || (do_ue == CONFIG_ONDEMAND_ONDEMAND && ue_sum > 0)) {
-        do_ue = CONFIG_ONDEMAND_YES;
+    if(do_ue == CONFIG_BOOLEAN_YES || (do_ue == CONFIG_BOOLEAN_AUTO && ue_sum > 0)) {
+        do_ue = CONFIG_BOOLEAN_YES;
 
         static RRDSET *ue_st = NULL;
 
         if(unlikely(!ue_st)) {
-            ue_st = rrdset_find("mem.ecc_ue");
+            ue_st = rrdset_find_localhost("mem.ecc_ue");
 
             if(unlikely(!ue_st))
-                ue_st = rrdset_create("mem", "ecc_ue", NULL, "ecc", NULL, "ECC Memory Uncorrectable Errors", "errors",
-                        6610, update_every, RRDSET_TYPE_LINE);
+                ue_st = rrdset_create_localhost("mem", "ecc_ue", NULL, "ecc", NULL, "ECC Memory Uncorrectable Errors"
+                                                , "errors", 6610, update_every, RRDSET_TYPE_LINE);
 
             for(m = mc_root; m; m = m->next)
                 if(m->ue_count_filename)
-                    m->ue_rd = rrddim_add(ue_st, m->name, NULL, 1, 1, RRDDIM_INCREMENTAL);
+                    m->ue_rd = rrddim_add(ue_st, m->name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
         }
         else
             rrdset_next(ue_st);