diff --git a/plugins/inputs/lustre2/lustre2.go b/plugins/inputs/lustre2/lustre2.go index 9b2443df2..8ef9223b5 100644 --- a/plugins/inputs/lustre2/lustre2.go +++ b/plugins/inputs/lustre2/lustre2.go @@ -168,52 +168,52 @@ var wanted_ost_jobstats_fields = []*mapping{ reportAs: "jobstats_write_bytes", }, { - inProc: "getattr", + inProc: "getattr", field: 3, reportAs: "jobstats_ost_getattr", }, { - inProc: "setattr", + inProc: "setattr", field: 3, reportAs: "jobstats_ost_setattr", }, { - inProc: "punch", + inProc: "punch", field: 3, reportAs: "jobstats_punch", }, { - inProc: "sync", + inProc: "sync", field: 3, reportAs: "jobstats_ost_sync", }, { - inProc: "destroy", + inProc: "destroy", field: 3, reportAs: "jobstats_destroy", }, { - inProc: "create", + inProc: "create", field: 3, reportAs: "jobstats_create", }, { - inProc: "statfs", + inProc: "statfs", field: 3, reportAs: "jobstats_ost_statfs", }, { - inProc: "get_info", + inProc: "get_info", field: 3, reportAs: "jobstats_get_info", }, { - inProc: "set_info", + inProc: "set_info", field: 3, reportAs: "jobstats_set_info", }, { - inProc: "quotactl", + inProc: "quotactl", field: 3, reportAs: "jobstats_quotactl", }, @@ -272,82 +272,82 @@ var wanted_mds_fields = []*mapping{ var wanted_mdt_jobstats_fields = []*mapping{ { - inProc: "open", + inProc: "open", field: 3, reportAs: "jobstats_open", }, { - inProc: "close", + inProc: "close", field: 3, reportAs: "jobstats_close", }, { - inProc: "mknod", + inProc: "mknod", field: 3, reportAs: "jobstats_mknod", }, { - inProc: "link", + inProc: "link", field: 3, reportAs: "jobstats_link", }, { - inProc: "unlink", + inProc: "unlink", field: 3, reportAs: "jobstats_unlink", }, { - inProc: "mkdir", + inProc: "mkdir", field: 3, reportAs: "jobstats_mkdir", }, { - inProc: "rmdir", + inProc: "rmdir", field: 3, reportAs: "jobstats_rmdir", }, { - inProc: "rename", + inProc: "rename", field: 3, reportAs: "jobstats_rename", }, { - inProc: "getattr", + inProc: "getattr", field: 3, reportAs: "jobstats_getattr", }, { - inProc: "setattr", + inProc: "setattr", field: 3, reportAs: "jobstats_setattr", }, { - inProc: "getxattr", + inProc: "getxattr", field: 3, reportAs: "jobstats_getxattr", }, { - inProc: "setxattr", + inProc: "setxattr", field: 3, reportAs: "jobstats_setxattr", }, { - inProc: "statfs", + inProc: "statfs", field: 3, reportAs: "jobstats_statfs", }, { - inProc: "sync", + inProc: "sync", field: 3, reportAs: "jobstats_sync", }, { - inProc: "samedir_rename", + inProc: "samedir_rename", field: 3, reportAs: "jobstats_samedir_rename", }, { - inProc: "crossdir_rename", + inProc: "crossdir_rename", field: 3, reportAs: "jobstats_crossdir_rename", }, @@ -388,7 +388,7 @@ func (l *Lustre2) GetLustreProcStats(fileglob string, wanted_fields []*mapping, for _, wanted := range wanted_fields { var data uint64 - if strings.TrimSuffix(parts[0],":") == wanted.inProc { + if strings.TrimSuffix(parts[0], ":") == wanted.inProc { wanted_field := wanted.field // if not set, assume field[1]. Shouldn't be field[0], as // that's a string diff --git a/plugins/inputs/lustre2/lustre2_test.go b/plugins/inputs/lustre2/lustre2_test.go index ed21939cd..5cc9c0e43 100644 --- a/plugins/inputs/lustre2/lustre2_test.go +++ b/plugins/inputs/lustre2/lustre2_test.go @@ -160,7 +160,7 @@ func TestLustre2GeneratesMetrics(t *testing.T) { "unlink": uint64(3549417), "write_bytes": uint64(15201500833981), "write_calls": uint64(71893382), - } + } acc.AssertContainsTaggedFields(t, "lustre2", fields, tags) @@ -200,46 +200,46 @@ func TestLustre2GeneratesJobstatsMetrics(t *testing.T) { require.NoError(t, err) tags := map[string]string{ - "name": ost_name, + "name": ost_name, "jobid": job_name, } fields := map[string]interface{}{ - "jobstats_read_calls": uint64(1), - "jobstats_read_min_size": uint64(4096), - "jobstats_read_max_size": uint64(4096), - "jobstats_read_bytes": uint64(4096), - "jobstats_write_calls": uint64(25), - "jobstats_write_min_size": uint64(1048576), - "jobstats_write_max_size": uint64(1048576), - "jobstats_write_bytes": uint64(26214400), - "jobstats_ost_getattr": uint64(0), - "jobstats_ost_setattr": uint64(0), - "jobstats_punch": uint64(1), - "jobstats_ost_sync": uint64(0), - "jobstats_destroy": uint64(0), - "jobstats_create": uint64(0), - "jobstats_ost_statfs": uint64(0), - "jobstats_get_info": uint64(0), - "jobstats_set_info": uint64(0), - "jobstats_quotactl": uint64(0), - "jobstats_open": uint64(5), - "jobstats_close": uint64(4), - "jobstats_mknod": uint64(6), - "jobstats_link": uint64(8), - "jobstats_unlink": uint64(90), - "jobstats_mkdir": uint64(521), - "jobstats_rmdir": uint64(520), - "jobstats_rename": uint64(9), - "jobstats_getattr": uint64(11), - "jobstats_setattr": uint64(1), - "jobstats_getxattr": uint64(3), - "jobstats_setxattr": uint64(4), - "jobstats_statfs": uint64(1205), - "jobstats_sync": uint64(2), - "jobstats_samedir_rename": uint64(705), - "jobstats_crossdir_rename": uint64(200), - } + "jobstats_read_calls": uint64(1), + "jobstats_read_min_size": uint64(4096), + "jobstats_read_max_size": uint64(4096), + "jobstats_read_bytes": uint64(4096), + "jobstats_write_calls": uint64(25), + "jobstats_write_min_size": uint64(1048576), + "jobstats_write_max_size": uint64(1048576), + "jobstats_write_bytes": uint64(26214400), + "jobstats_ost_getattr": uint64(0), + "jobstats_ost_setattr": uint64(0), + "jobstats_punch": uint64(1), + "jobstats_ost_sync": uint64(0), + "jobstats_destroy": uint64(0), + "jobstats_create": uint64(0), + "jobstats_ost_statfs": uint64(0), + "jobstats_get_info": uint64(0), + "jobstats_set_info": uint64(0), + "jobstats_quotactl": uint64(0), + "jobstats_open": uint64(5), + "jobstats_close": uint64(4), + "jobstats_mknod": uint64(6), + "jobstats_link": uint64(8), + "jobstats_unlink": uint64(90), + "jobstats_mkdir": uint64(521), + "jobstats_rmdir": uint64(520), + "jobstats_rename": uint64(9), + "jobstats_getattr": uint64(11), + "jobstats_setattr": uint64(1), + "jobstats_getxattr": uint64(3), + "jobstats_setxattr": uint64(4), + "jobstats_statfs": uint64(1205), + "jobstats_sync": uint64(2), + "jobstats_samedir_rename": uint64(705), + "jobstats_crossdir_rename": uint64(200), + } acc.AssertContainsTaggedFields(t, "lustre2", fields, tags)