X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnfs.c;h=a7adc920b1d23cf2075d337a85e1d7120c54f963;hb=5dbb7471b0a7ca7506f56f4c6dbaf58e790c6b7c;hp=2f628218448381d9290ff5f4126fca0a962253ee;hpb=e56e0ec209345beb11f35ad76c4e4cbcac03de5d;p=collectd.git diff --git a/src/nfs.c b/src/nfs.c index 2f628218..a7adc920 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -31,11 +31,11 @@ #include #endif -static const char *config_keys[] = {"IgnoreV2", "IgnoreV3", "IgnoreV4"}; +static const char *config_keys[] = {"ReportV2", "ReportV3", "ReportV4"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static int ignore_v2 = 0; -static int ignore_v3 = 0; -static int ignore_v4 = 0; +static _Bool report_v2 = 1; +static _Bool report_v3 = 1; +static _Bool report_v4 = 1; /* see /proc/net/rpc/nfs @@ -302,12 +302,12 @@ static kstat_t *nfs4_ksp_server; #endif static int nfs_config(const char *key, const char *value) { - if (strcasecmp(key, "IgnoreV2") == 0 && IS_TRUE(value)) - ignore_v2 = 1; - else if (strcasecmp(key, "IgnoreV3") == 0 && IS_TRUE(value)) - ignore_v3 = 1; - else if (strcasecmp(key, "IgnoreV4") == 0 && IS_TRUE(value)) - ignore_v4 = 1; + if (strcasecmp(key, "ReportV2") == 0) + report_v2 = IS_TRUE(value); + else if (strcasecmp(key, "ReportV3") == 0) + report_v3 = IS_TRUE(value); + else if (strcasecmp(key, "ReportV4") == 0) + report_v4 = IS_TRUE(value); else return -1; @@ -514,18 +514,18 @@ static void nfs_read_linux(FILE *fh, const char *inst) { if (fields_num < 3) continue; - if (strcmp(fields[0], "proc2") == 0 && ignore_v2 == 0) { + if (strcmp(fields[0], "proc2") == 0 && report_v2) { nfs_submit_fields_safe(/* version = */ 2, inst, fields + 2, (size_t)(fields_num - 2), nfs2_procedures_names, nfs2_procedures_names_num); - } else if (strncmp(fields[0], "proc3", 5) == 0 && ignore_v3 == 0) { + } else if (strncmp(fields[0], "proc3", 5) == 0 && report_v3) { nfs_submit_fields_safe(/* version = */ 3, inst, fields + 2, (size_t)(fields_num - 2), nfs3_procedures_names, nfs3_procedures_names_num); - } else if (strcmp(fields[0], "proc4ops") == 0 && ignore_v4 == 0) { + } else if (strcmp(fields[0], "proc4ops") == 0 && report_v4) { if (inst[0] == 's') nfs_submit_nfs4_server(inst, fields + 2, (size_t)(fields_num - 2)); - } else if (strcmp(fields[0], "proc4") == 0 && ignore_v4 == 0) { + } else if (strcmp(fields[0], "proc4") == 0 && report_v4) { if (inst[0] == 'c') nfs_submit_nfs4_client(inst, fields + 2, (size_t)(fields_num - 2)); } @@ -580,19 +580,19 @@ static int nfs_read(void) { #elif HAVE_LIBKSTAT static int nfs_read(void) { - if (ignore_v2 == 0) { + if (report_v2) { nfs_read_kstat(nfs2_ksp_client, /* version = */ 2, "client", nfs2_procedures_names, nfs2_procedures_names_num); nfs_read_kstat(nfs2_ksp_server, /* version = */ 2, "server", nfs2_procedures_names, nfs2_procedures_names_num); } - if (ignore_v3 == 0) { + if (report_v3) { nfs_read_kstat(nfs3_ksp_client, /* version = */ 3, "client", nfs3_procedures_names, nfs3_procedures_names_num); nfs_read_kstat(nfs3_ksp_server, /* version = */ 3, "server", nfs3_procedures_names, nfs3_procedures_names_num); } - if (ignore_v2 == 0) { + if (report_v4) { nfs_read_kstat(nfs4_ksp_client, /* version = */ 4, "client", nfs4_procedures_names, nfs4_procedures_names_num); nfs_read_kstat(nfs4_ksp_server, /* version = */ 4, "server",