From 00bf8a811b15f6fed31de6335096cfa940203bb8 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Mon, 3 Aug 2020 14:07:37 +0000 Subject: [PATCH 01/38] Added IO data read/written to struct definition --- .../client/internal/monitoring/resource_usage_fetcher.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 96fa98b2..b4c41bb6 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -39,6 +39,12 @@ type ResourceUsage struct { // Resident set size for a process, in bytes. ResidentMemory int64 + + // Client IO data read so far, in bytes. + ClientIORead int64 + + // Client IO data written so far, in bytes. + ClientIOWrite int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. From 0114836f5287d1f30e7fd7c03859f79cd9321fac Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Mon, 3 Aug 2020 14:20:10 +0000 Subject: [PATCH 02/38] Elaborated doc of ResourceUsageFromFinishedCmd --- .../src/client/internal/monitoring/resource_usage_fetcher.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index b4c41bb6..8ba0a026 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -54,7 +54,8 @@ type ResourceUsageFetcher struct{} // information from exec.Cmd.ProcessState. NOTE that this is only possible // after the process has finished and has been waited for, and will most // probably panic otherwise. -// This function doesn't fill in ResourceUsage.ResidentMemory. +// This function doesn't fill in ResourceUsage.ResidentMemory, ResourceUsage.ClientIORead +// and ResourceUsage.ClientIOWrite. func (f ResourceUsageFetcher) ResourceUsageFromFinishedCmd(cmd *exec.Cmd) *ResourceUsage { return &ResourceUsage{ Timestamp: time.Now(), From 5e7268d4990203cd6f747b60be8bba0f3b5f2cef Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Mon, 3 Aug 2020 14:26:38 +0000 Subject: [PATCH 03/38] Data collected in ResourceUsageForPID --- .../client/internal/monitoring/resource_usage_fetcher.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 8ba0a026..83340a0d 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -85,11 +85,18 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro return nil, err } + ioCounters, err := process.IOCounters() + if err != nil { + return nil, err + } + return &ResourceUsage{ Timestamp: timestamp, UserCPUMillis: times.User * 1e3, SystemCPUMillis: times.System * 1e3, ResidentMemory: int64(memoryInfo.RSS), + ClientIORead: int64(ioCounters.ReadBytes), + ClientIOWrite: int64(ioCounters.WriteBytes), }, nil } From f6825c3ae42b66cb2debc4d5023767a0c6b936bb Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Mon, 3 Aug 2020 14:28:38 +0000 Subject: [PATCH 04/38] Added ClientIOReadCount and ClientIOWriteCount --- .../monitoring/resource_usage_fetcher.go | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 83340a0d..5be00ea2 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -45,6 +45,12 @@ type ResourceUsage struct { // Client IO data written so far, in bytes. ClientIOWrite int64 + + // Client IO read operations count so far. + ClientIOReadCount int64 + + // Client IO write operations count so far. + ClientIOWriteCount int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. @@ -91,12 +97,14 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro } return &ResourceUsage{ - Timestamp: timestamp, - UserCPUMillis: times.User * 1e3, - SystemCPUMillis: times.System * 1e3, - ResidentMemory: int64(memoryInfo.RSS), - ClientIORead: int64(ioCounters.ReadBytes), - ClientIOWrite: int64(ioCounters.WriteBytes), + Timestamp: timestamp, + UserCPUMillis: times.User * 1e3, + SystemCPUMillis: times.System * 1e3, + ResidentMemory: int64(memoryInfo.RSS), + ClientIORead: int64(ioCounters.ReadBytes), + ClientIOWrite: int64(ioCounters.WriteBytes), + ClientIOReadCount: int64(ioCounters.ReadCount), + ClientIOWriteCount: int64(ioCounters.WriteCount), }, nil } From 18d64109c27b1236db35ba9319d5518aca3cc836 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 14:40:33 +0000 Subject: [PATCH 05/38] Delete IO Count --- .../monitoring/resource_usage_fetcher.go | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 5be00ea2..83340a0d 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -45,12 +45,6 @@ type ResourceUsage struct { // Client IO data written so far, in bytes. ClientIOWrite int64 - - // Client IO read operations count so far. - ClientIOReadCount int64 - - // Client IO write operations count so far. - ClientIOWriteCount int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. @@ -97,14 +91,12 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro } return &ResourceUsage{ - Timestamp: timestamp, - UserCPUMillis: times.User * 1e3, - SystemCPUMillis: times.System * 1e3, - ResidentMemory: int64(memoryInfo.RSS), - ClientIORead: int64(ioCounters.ReadBytes), - ClientIOWrite: int64(ioCounters.WriteBytes), - ClientIOReadCount: int64(ioCounters.ReadCount), - ClientIOWriteCount: int64(ioCounters.WriteCount), + Timestamp: timestamp, + UserCPUMillis: times.User * 1e3, + SystemCPUMillis: times.System * 1e3, + ResidentMemory: int64(memoryInfo.RSS), + ClientIORead: int64(ioCounters.ReadBytes), + ClientIOWrite: int64(ioCounters.WriteBytes), }, nil } From e70b34707b51ea0990631d49dab643b1d91a8c89 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 14:40:58 +0000 Subject: [PATCH 06/38] Add aggregated fields to resource msg proto --- fleetspeak/src/server/proto/fleetspeak_server/resource.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto index 228ef8d5..31ec1df2 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto @@ -33,4 +33,9 @@ message ClientResourceUsageRecord { int32 mean_resident_memory_mib = 10; int32 max_resident_memory_mib = 11; + + int32 mean_io_read_bytes = 12; + int32 max_io_read_bytes = 13; + int32 mean_io_write_bytes = 14; + int32 max_io_write_bytes = 15; } From 1da76b7b705c76e555038596f3971646fc4d3164 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 14:42:00 +0000 Subject: [PATCH 07/38] Changed unit from bytes to mib --- .../src/server/proto/fleetspeak_server/resource.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto index 31ec1df2..eed5c418 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto @@ -34,8 +34,8 @@ message ClientResourceUsageRecord { int32 mean_resident_memory_mib = 10; int32 max_resident_memory_mib = 11; - int32 mean_io_read_bytes = 12; - int32 max_io_read_bytes = 13; - int32 mean_io_write_bytes = 14; - int32 max_io_write_bytes = 15; + int32 mean_io_read_mib = 12; + int32 max_io_read_mib = 13; + int32 mean_io_write_mib = 14; + int32 max_io_write_mib = 15; } From 7fa2f9eaa8ffd343fb9fe5284d659075ba948003 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 15:09:06 +0000 Subject: [PATCH 08/38] Added fields to unix struct --- .../internal/monitoring/resource_usage_fetcher_unix.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go index 006d9ac8..f768daa2 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go @@ -42,6 +42,12 @@ type ResourceUsage struct { // Resident set size for a process. ResidentMemory int64 + + // Client IO data read so far, in bytes. + ClientIORead int64 + + // Client IO data written so far, in bytes. + ClientIOWrite int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. From 85908a53c87bca44fb59dfdf4cc16d95a8ad8f0d Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 15:16:05 +0000 Subject: [PATCH 09/38] Changed resource proto & compiled proto --- .../proto/fleetspeak_server/resource.pb.go | 359 ++++++++++++------ .../proto/fleetspeak_server/resource.proto | 8 +- 2 files changed, 251 insertions(+), 116 deletions(-) diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go index d5622c91..024564dd 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go @@ -1,29 +1,38 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: fleetspeak/src/server/proto/fleetspeak_server/resource.proto +// versions: +// protoc-gen-go v1.23.0-devel +// protoc v3.12.1 +// source: resource.proto package fleetspeak_server import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" timestamp "github.com/golang/protobuf/ptypes/timestamp" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 // Represents client resource-usage data in the data-store. // Next id: 13 type ClientResourceUsageRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Name of the client service that resource usage is charged/attributed to // e.g 'system' for the system Fleetspeak service, or the name of a daemon // service as specified in its config. @@ -38,159 +47,285 @@ type ClientResourceUsageRecord struct { // the final resource-usage record for that process. ProcessTerminated bool `protobuf:"varint,12,opt,name=process_terminated,json=processTerminated,proto3" json:"process_terminated,omitempty"` // CPU-usage is in millis per second. - MeanUserCpuRate float32 `protobuf:"fixed32,6,opt,name=mean_user_cpu_rate,json=meanUserCpuRate,proto3" json:"mean_user_cpu_rate,omitempty"` - MaxUserCpuRate float32 `protobuf:"fixed32,7,opt,name=max_user_cpu_rate,json=maxUserCpuRate,proto3" json:"max_user_cpu_rate,omitempty"` - MeanSystemCpuRate float32 `protobuf:"fixed32,8,opt,name=mean_system_cpu_rate,json=meanSystemCpuRate,proto3" json:"mean_system_cpu_rate,omitempty"` - MaxSystemCpuRate float32 `protobuf:"fixed32,9,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` - MeanResidentMemoryMib int32 `protobuf:"varint,10,opt,name=mean_resident_memory_mib,json=meanResidentMemoryMib,proto3" json:"mean_resident_memory_mib,omitempty"` - MaxResidentMemoryMib int32 `protobuf:"varint,11,opt,name=max_resident_memory_mib,json=maxResidentMemoryMib,proto3" json:"max_resident_memory_mib,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClientResourceUsageRecord) Reset() { *m = ClientResourceUsageRecord{} } -func (m *ClientResourceUsageRecord) String() string { return proto.CompactTextString(m) } -func (*ClientResourceUsageRecord) ProtoMessage() {} -func (*ClientResourceUsageRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_e6a44a47dea9fbac, []int{0} + MeanUserCpuRate float32 `protobuf:"fixed32,6,opt,name=mean_user_cpu_rate,json=meanUserCpuRate,proto3" json:"mean_user_cpu_rate,omitempty"` + MaxUserCpuRate float32 `protobuf:"fixed32,7,opt,name=max_user_cpu_rate,json=maxUserCpuRate,proto3" json:"max_user_cpu_rate,omitempty"` + MeanSystemCpuRate float32 `protobuf:"fixed32,8,opt,name=mean_system_cpu_rate,json=meanSystemCpuRate,proto3" json:"mean_system_cpu_rate,omitempty"` + MaxSystemCpuRate float32 `protobuf:"fixed32,9,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` + MeanResidentMemoryMib int32 `protobuf:"varint,10,opt,name=mean_resident_memory_mib,json=meanResidentMemoryMib,proto3" json:"mean_resident_memory_mib,omitempty"` + MaxResidentMemoryMib int32 `protobuf:"varint,11,opt,name=max_resident_memory_mib,json=maxResidentMemoryMib,proto3" json:"max_resident_memory_mib,omitempty"` + MeanIoReadMib int32 `protobuf:"varint,13,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` + MaxIoReadMib int32 `protobuf:"varint,14,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` + MeanIoWriteMib int32 `protobuf:"varint,15,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` + MaxIoWriteMib int32 `protobuf:"varint,16,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` } -func (m *ClientResourceUsageRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ClientResourceUsageRecord.Unmarshal(m, b) -} -func (m *ClientResourceUsageRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ClientResourceUsageRecord.Marshal(b, m, deterministic) -} -func (m *ClientResourceUsageRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientResourceUsageRecord.Merge(m, src) +func (x *ClientResourceUsageRecord) Reset() { + *x = ClientResourceUsageRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_resource_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ClientResourceUsageRecord) XXX_Size() int { - return xxx_messageInfo_ClientResourceUsageRecord.Size(m) + +func (x *ClientResourceUsageRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ClientResourceUsageRecord) XXX_DiscardUnknown() { - xxx_messageInfo_ClientResourceUsageRecord.DiscardUnknown(m) + +func (*ClientResourceUsageRecord) ProtoMessage() {} + +func (x *ClientResourceUsageRecord) ProtoReflect() protoreflect.Message { + mi := &file_resource_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ClientResourceUsageRecord proto.InternalMessageInfo +// Deprecated: Use ClientResourceUsageRecord.ProtoReflect.Descriptor instead. +func (*ClientResourceUsageRecord) Descriptor() ([]byte, []int) { + return file_resource_proto_rawDescGZIP(), []int{0} +} -func (m *ClientResourceUsageRecord) GetScope() string { - if m != nil { - return m.Scope +func (x *ClientResourceUsageRecord) GetScope() string { + if x != nil { + return x.Scope } return "" } -func (m *ClientResourceUsageRecord) GetPid() int64 { - if m != nil { - return m.Pid +func (x *ClientResourceUsageRecord) GetPid() int64 { + if x != nil { + return x.Pid } return 0 } -func (m *ClientResourceUsageRecord) GetProcessStartTime() *timestamp.Timestamp { - if m != nil { - return m.ProcessStartTime +func (x *ClientResourceUsageRecord) GetProcessStartTime() *timestamp.Timestamp { + if x != nil { + return x.ProcessStartTime } return nil } -func (m *ClientResourceUsageRecord) GetClientTimestamp() *timestamp.Timestamp { - if m != nil { - return m.ClientTimestamp +func (x *ClientResourceUsageRecord) GetClientTimestamp() *timestamp.Timestamp { + if x != nil { + return x.ClientTimestamp } return nil } -func (m *ClientResourceUsageRecord) GetServerTimestamp() *timestamp.Timestamp { - if m != nil { - return m.ServerTimestamp +func (x *ClientResourceUsageRecord) GetServerTimestamp() *timestamp.Timestamp { + if x != nil { + return x.ServerTimestamp } return nil } -func (m *ClientResourceUsageRecord) GetProcessTerminated() bool { - if m != nil { - return m.ProcessTerminated +func (x *ClientResourceUsageRecord) GetProcessTerminated() bool { + if x != nil { + return x.ProcessTerminated } return false } -func (m *ClientResourceUsageRecord) GetMeanUserCpuRate() float32 { - if m != nil { - return m.MeanUserCpuRate +func (x *ClientResourceUsageRecord) GetMeanUserCpuRate() float32 { + if x != nil { + return x.MeanUserCpuRate + } + return 0 +} + +func (x *ClientResourceUsageRecord) GetMaxUserCpuRate() float32 { + if x != nil { + return x.MaxUserCpuRate + } + return 0 +} + +func (x *ClientResourceUsageRecord) GetMeanSystemCpuRate() float32 { + if x != nil { + return x.MeanSystemCpuRate } return 0 } -func (m *ClientResourceUsageRecord) GetMaxUserCpuRate() float32 { - if m != nil { - return m.MaxUserCpuRate +func (x *ClientResourceUsageRecord) GetMaxSystemCpuRate() float32 { + if x != nil { + return x.MaxSystemCpuRate } return 0 } -func (m *ClientResourceUsageRecord) GetMeanSystemCpuRate() float32 { - if m != nil { - return m.MeanSystemCpuRate +func (x *ClientResourceUsageRecord) GetMeanResidentMemoryMib() int32 { + if x != nil { + return x.MeanResidentMemoryMib } return 0 } -func (m *ClientResourceUsageRecord) GetMaxSystemCpuRate() float32 { - if m != nil { - return m.MaxSystemCpuRate +func (x *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { + if x != nil { + return x.MaxResidentMemoryMib } return 0 } -func (m *ClientResourceUsageRecord) GetMeanResidentMemoryMib() int32 { - if m != nil { - return m.MeanResidentMemoryMib +func (x *ClientResourceUsageRecord) GetMeanIoReadMib() int32 { + if x != nil { + return x.MeanIoReadMib } return 0 } -func (m *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { - if m != nil { - return m.MaxResidentMemoryMib +func (x *ClientResourceUsageRecord) GetMaxIoReadMib() int32 { + if x != nil { + return x.MaxIoReadMib } return 0 } -func init() { - proto.RegisterType((*ClientResourceUsageRecord)(nil), "fleetspeak.server.ClientResourceUsageRecord") -} - -func init() { - proto.RegisterFile("fleetspeak/src/server/proto/fleetspeak_server/resource.proto", fileDescriptor_e6a44a47dea9fbac) -} - -var fileDescriptor_e6a44a47dea9fbac = []byte{ - // 393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0xc1, 0x8e, 0xd3, 0x30, - 0x10, 0x86, 0x95, 0xed, 0x76, 0xd9, 0xf5, 0x22, 0x36, 0x31, 0x45, 0x98, 0x5e, 0x88, 0x38, 0x05, - 0xa1, 0x26, 0x12, 0x08, 0x71, 0xe1, 0x56, 0x21, 0x71, 0xe9, 0xc5, 0x6d, 0xcf, 0x96, 0x93, 0x4c, - 0xab, 0x88, 0xba, 0xb6, 0x6c, 0x07, 0xa5, 0xaf, 0xcd, 0x13, 0x20, 0xdb, 0x69, 0x53, 0xca, 0x4a, - 0xbd, 0xb5, 0xf3, 0x7f, 0xff, 0xe7, 0xc9, 0xa0, 0xef, 0x9b, 0x1d, 0x80, 0x35, 0x0a, 0xf8, 0xaf, - 0xc2, 0xe8, 0xaa, 0x30, 0xa0, 0x7f, 0x83, 0x2e, 0x94, 0x96, 0x56, 0x16, 0x43, 0xc6, 0xfa, 0xb9, - 0x06, 0x23, 0x5b, 0x5d, 0x41, 0xee, 0x01, 0x9c, 0x0c, 0x44, 0x1e, 0x88, 0xe9, 0xfb, 0xad, 0x94, - 0xdb, 0x1d, 0x04, 0x43, 0xd9, 0x6e, 0x0a, 0xdb, 0x08, 0x30, 0x96, 0x0b, 0x15, 0x3a, 0x1f, 0xfe, - 0xdc, 0xa2, 0x77, 0xf3, 0x5d, 0x03, 0x7b, 0x4b, 0x7b, 0xd9, 0xda, 0xf0, 0x2d, 0x50, 0xa8, 0xa4, - 0xae, 0xf1, 0x04, 0x8d, 0x4d, 0x25, 0x15, 0x90, 0x28, 0x8d, 0xb2, 0x07, 0x1a, 0xfe, 0xe0, 0x18, - 0x8d, 0x54, 0x53, 0x93, 0x9b, 0x34, 0xca, 0x46, 0xd4, 0xfd, 0xc4, 0x3f, 0x11, 0x56, 0x5a, 0x56, - 0x60, 0x0c, 0x33, 0x96, 0x6b, 0xcb, 0xdc, 0x33, 0x64, 0x94, 0x46, 0xd9, 0xe3, 0xe7, 0x69, 0x1e, - 0x76, 0xc8, 0x8f, 0x3b, 0xe4, 0xab, 0xe3, 0x0e, 0x34, 0xee, 0x5b, 0x4b, 0x57, 0x72, 0x63, 0xfc, - 0x03, 0xc5, 0x95, 0x5f, 0x87, 0x9d, 0x36, 0x25, 0xb7, 0x57, 0x3d, 0x4f, 0xa1, 0x73, 0x1a, 0x38, - 0x4d, 0xb8, 0xc0, 0x99, 0x66, 0x7c, 0x5d, 0x13, 0x3a, 0x83, 0x66, 0x36, 0x7c, 0x97, 0x05, 0x2d, - 0x9a, 0x3d, 0xb7, 0x50, 0x93, 0x97, 0x69, 0x94, 0xdd, 0xd3, 0xa4, 0x4f, 0x56, 0xa7, 0x00, 0x7f, - 0x42, 0x58, 0x00, 0xdf, 0xb3, 0xd6, 0x80, 0x66, 0x95, 0x6a, 0x99, 0xe6, 0x16, 0xc8, 0x5d, 0x1a, - 0x65, 0x37, 0xf4, 0xc9, 0x25, 0x6b, 0x03, 0x7a, 0xae, 0x5a, 0xca, 0x2d, 0xe0, 0x8f, 0x28, 0x11, - 0xbc, 0xbb, 0x60, 0x5f, 0x78, 0xf6, 0x95, 0xe0, 0xdd, 0x39, 0x5a, 0xa0, 0x89, 0xf7, 0x9a, 0x83, - 0xb1, 0x20, 0x06, 0xfa, 0xde, 0xd3, 0x89, 0xcb, 0x96, 0x3e, 0x3a, 0x16, 0x66, 0xe8, 0xb5, 0x73, - 0x5f, 0xf2, 0x0f, 0x9e, 0x8f, 0x05, 0xef, 0xfe, 0xc5, 0xbf, 0x21, 0xe2, 0xfd, 0x1a, 0x4c, 0x53, - 0xbb, 0xdb, 0x0b, 0x10, 0x52, 0x1f, 0x98, 0x68, 0x4a, 0x82, 0xd2, 0x28, 0x1b, 0xd3, 0x37, 0x2e, - 0xa7, 0x7d, 0xbc, 0xf0, 0xe9, 0xa2, 0x29, 0xf1, 0x57, 0xf4, 0xd6, 0xbd, 0xf3, 0x5c, 0xef, 0xd1, - 0xf7, 0x26, 0x82, 0x77, 0xff, 0xd5, 0xca, 0x3b, 0x7f, 0xfb, 0x2f, 0x7f, 0x03, 0x00, 0x00, 0xff, - 0xff, 0x32, 0x32, 0xd4, 0xeb, 0xef, 0x02, 0x00, 0x00, +func (x *ClientResourceUsageRecord) GetMeanIoWriteMib() int32 { + if x != nil { + return x.MeanIoWriteMib + } + return 0 +} + +func (x *ClientResourceUsageRecord) GetMaxIoWriteMib() int32 { + if x != nil { + return x.MaxIoWriteMib + } + return 0 +} + +var File_resource_proto protoreflect.FileDescriptor + +var file_resource_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x06, 0x0a, 0x19, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x45, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x45, 0x0a, 0x10, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x65, + 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, + 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x6d, + 0x65, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x29, + 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, + 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x6d, 0x65, 0x61, + 0x6e, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, 0x13, 0x6d, 0x61, + 0x78, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, + 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6d, 0x65, 0x61, + 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x6d, 0x65, 0x61, + 0x6e, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x4d, + 0x69, 0x62, 0x12, 0x35, 0x0a, 0x17, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x65, 0x61, + 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, + 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, + 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, + 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, + 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x77, + 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, + 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_resource_proto_rawDescOnce sync.Once + file_resource_proto_rawDescData = file_resource_proto_rawDesc +) + +func file_resource_proto_rawDescGZIP() []byte { + file_resource_proto_rawDescOnce.Do(func() { + file_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_proto_rawDescData) + }) + return file_resource_proto_rawDescData +} + +var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_resource_proto_goTypes = []interface{}{ + (*ClientResourceUsageRecord)(nil), // 0: fleetspeak.server.ClientResourceUsageRecord + (*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp +} +var file_resource_proto_depIdxs = []int32{ + 1, // 0: fleetspeak.server.ClientResourceUsageRecord.process_start_time:type_name -> google.protobuf.Timestamp + 1, // 1: fleetspeak.server.ClientResourceUsageRecord.client_timestamp:type_name -> google.protobuf.Timestamp + 1, // 2: fleetspeak.server.ClientResourceUsageRecord.server_timestamp:type_name -> google.protobuf.Timestamp + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_resource_proto_init() } +func file_resource_proto_init() { + if File_resource_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientResourceUsageRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_resource_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_resource_proto_goTypes, + DependencyIndexes: file_resource_proto_depIdxs, + MessageInfos: file_resource_proto_msgTypes, + }.Build() + File_resource_proto = out.File + file_resource_proto_rawDesc = nil + file_resource_proto_goTypes = nil + file_resource_proto_depIdxs = nil } diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto index eed5c418..7a2df106 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto @@ -34,8 +34,8 @@ message ClientResourceUsageRecord { int32 mean_resident_memory_mib = 10; int32 max_resident_memory_mib = 11; - int32 mean_io_read_mib = 12; - int32 max_io_read_mib = 13; - int32 mean_io_write_mib = 14; - int32 max_io_write_mib = 15; + int32 mean_io_read_mib = 13; + int32 max_io_read_mib = 14; + int32 mean_io_write_mib = 15; + int32 max_io_write_mib = 16; } From 1d2c64ad3f2d2bd6314b148ef1e1cf7c9f049b64 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 15:18:02 +0000 Subject: [PATCH 10/38] Added new fields to resource proto & compiled proto --- .../fleetspeak_monitoring/resource.pb.go | 631 ++++++++++++------ .../fleetspeak_monitoring/resource.proto | 4 + 2 files changed, 428 insertions(+), 207 deletions(-) diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go index fec157e9..d132b9ac 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go @@ -1,25 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto +// versions: +// protoc-gen-go v1.23.0-devel +// protoc v3.12.1 +// source: resource.proto package fleetspeak_monitoring import ( - fmt "fmt" proto "github.com/golang/protobuf/proto" timestamp "github.com/golang/protobuf/ptypes/timestamp" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 type KillNotification_Reason int32 @@ -29,104 +34,165 @@ const ( KillNotification_MEMORY_EXCEEDED KillNotification_Reason = 2 ) -var KillNotification_Reason_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "HEARTBEAT_FAILURE", - 2: "MEMORY_EXCEEDED", -} +// Enum value maps for KillNotification_Reason. +var ( + KillNotification_Reason_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "HEARTBEAT_FAILURE", + 2: "MEMORY_EXCEEDED", + } + KillNotification_Reason_value = map[string]int32{ + "UNSPECIFIED": 0, + "HEARTBEAT_FAILURE": 1, + "MEMORY_EXCEEDED": 2, + } +) -var KillNotification_Reason_value = map[string]int32{ - "UNSPECIFIED": 0, - "HEARTBEAT_FAILURE": 1, - "MEMORY_EXCEEDED": 2, +func (x KillNotification_Reason) Enum() *KillNotification_Reason { + p := new(KillNotification_Reason) + *p = x + return p } func (x KillNotification_Reason) String() string { - return proto.EnumName(KillNotification_Reason_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KillNotification_Reason) Descriptor() protoreflect.EnumDescriptor { + return file_resource_proto_enumTypes[0].Descriptor() } +func (KillNotification_Reason) Type() protoreflect.EnumType { + return &file_resource_proto_enumTypes[0] +} + +func (x KillNotification_Reason) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use KillNotification_Reason.Descriptor instead. func (KillNotification_Reason) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4363d2f9d96c68b4, []int{2, 0} + return file_resource_proto_rawDescGZIP(), []int{2, 0} } // Contains resource-usage metrics for Fleetspeak clients. The stats are // arrived at by aggregating raw data retrieved from the OS. // CPU-usage is in milliseconds per second, and memory usage is in bytes. type AggregatedResourceUsage struct { - MeanUserCpuRate float64 `protobuf:"fixed64,1,opt,name=mean_user_cpu_rate,json=meanUserCpuRate,proto3" json:"mean_user_cpu_rate,omitempty"` - MaxUserCpuRate float64 `protobuf:"fixed64,2,opt,name=max_user_cpu_rate,json=maxUserCpuRate,proto3" json:"max_user_cpu_rate,omitempty"` - MeanSystemCpuRate float64 `protobuf:"fixed64,3,opt,name=mean_system_cpu_rate,json=meanSystemCpuRate,proto3" json:"mean_system_cpu_rate,omitempty"` - MaxSystemCpuRate float64 `protobuf:"fixed64,4,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` - MeanResidentMemory float64 `protobuf:"fixed64,5,opt,name=mean_resident_memory,json=meanResidentMemory,proto3" json:"mean_resident_memory,omitempty"` - MaxResidentMemory int64 `protobuf:"varint,6,opt,name=max_resident_memory,json=maxResidentMemory,proto3" json:"max_resident_memory,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AggregatedResourceUsage) Reset() { *m = AggregatedResourceUsage{} } -func (m *AggregatedResourceUsage) String() string { return proto.CompactTextString(m) } -func (*AggregatedResourceUsage) ProtoMessage() {} -func (*AggregatedResourceUsage) Descriptor() ([]byte, []int) { - return fileDescriptor_4363d2f9d96c68b4, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MeanUserCpuRate float64 `protobuf:"fixed64,1,opt,name=mean_user_cpu_rate,json=meanUserCpuRate,proto3" json:"mean_user_cpu_rate,omitempty"` + MaxUserCpuRate float64 `protobuf:"fixed64,2,opt,name=max_user_cpu_rate,json=maxUserCpuRate,proto3" json:"max_user_cpu_rate,omitempty"` + MeanSystemCpuRate float64 `protobuf:"fixed64,3,opt,name=mean_system_cpu_rate,json=meanSystemCpuRate,proto3" json:"mean_system_cpu_rate,omitempty"` + MaxSystemCpuRate float64 `protobuf:"fixed64,4,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` + MeanResidentMemory float64 `protobuf:"fixed64,5,opt,name=mean_resident_memory,json=meanResidentMemory,proto3" json:"mean_resident_memory,omitempty"` + MaxResidentMemory int64 `protobuf:"varint,6,opt,name=max_resident_memory,json=maxResidentMemory,proto3" json:"max_resident_memory,omitempty"` + MeanIoReadMib float64 `protobuf:"fixed64,7,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` + MaxIoReadMib int32 `protobuf:"varint,8,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` + MeanIoWriteMib float64 `protobuf:"fixed64,9,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` + MaxIoWriteMib int32 `protobuf:"varint,10,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` +} + +func (x *AggregatedResourceUsage) Reset() { + *x = AggregatedResourceUsage{} + if protoimpl.UnsafeEnabled { + mi := &file_resource_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AggregatedResourceUsage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AggregatedResourceUsage.Unmarshal(m, b) +func (x *AggregatedResourceUsage) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AggregatedResourceUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AggregatedResourceUsage.Marshal(b, m, deterministic) + +func (*AggregatedResourceUsage) ProtoMessage() {} + +func (x *AggregatedResourceUsage) ProtoReflect() protoreflect.Message { + mi := &file_resource_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *AggregatedResourceUsage) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregatedResourceUsage.Merge(m, src) + +// Deprecated: Use AggregatedResourceUsage.ProtoReflect.Descriptor instead. +func (*AggregatedResourceUsage) Descriptor() ([]byte, []int) { + return file_resource_proto_rawDescGZIP(), []int{0} +} + +func (x *AggregatedResourceUsage) GetMeanUserCpuRate() float64 { + if x != nil { + return x.MeanUserCpuRate + } + return 0 } -func (m *AggregatedResourceUsage) XXX_Size() int { - return xxx_messageInfo_AggregatedResourceUsage.Size(m) + +func (x *AggregatedResourceUsage) GetMaxUserCpuRate() float64 { + if x != nil { + return x.MaxUserCpuRate + } + return 0 } -func (m *AggregatedResourceUsage) XXX_DiscardUnknown() { - xxx_messageInfo_AggregatedResourceUsage.DiscardUnknown(m) + +func (x *AggregatedResourceUsage) GetMeanSystemCpuRate() float64 { + if x != nil { + return x.MeanSystemCpuRate + } + return 0 } -var xxx_messageInfo_AggregatedResourceUsage proto.InternalMessageInfo +func (x *AggregatedResourceUsage) GetMaxSystemCpuRate() float64 { + if x != nil { + return x.MaxSystemCpuRate + } + return 0 +} -func (m *AggregatedResourceUsage) GetMeanUserCpuRate() float64 { - if m != nil { - return m.MeanUserCpuRate +func (x *AggregatedResourceUsage) GetMeanResidentMemory() float64 { + if x != nil { + return x.MeanResidentMemory } return 0 } -func (m *AggregatedResourceUsage) GetMaxUserCpuRate() float64 { - if m != nil { - return m.MaxUserCpuRate +func (x *AggregatedResourceUsage) GetMaxResidentMemory() int64 { + if x != nil { + return x.MaxResidentMemory } return 0 } -func (m *AggregatedResourceUsage) GetMeanSystemCpuRate() float64 { - if m != nil { - return m.MeanSystemCpuRate +func (x *AggregatedResourceUsage) GetMeanIoReadMib() float64 { + if x != nil { + return x.MeanIoReadMib } return 0 } -func (m *AggregatedResourceUsage) GetMaxSystemCpuRate() float64 { - if m != nil { - return m.MaxSystemCpuRate +func (x *AggregatedResourceUsage) GetMaxIoReadMib() int32 { + if x != nil { + return x.MaxIoReadMib } return 0 } -func (m *AggregatedResourceUsage) GetMeanResidentMemory() float64 { - if m != nil { - return m.MeanResidentMemory +func (x *AggregatedResourceUsage) GetMeanIoWriteMib() float64 { + if x != nil { + return x.MeanIoWriteMib } return 0 } -func (m *AggregatedResourceUsage) GetMaxResidentMemory() int64 { - if m != nil { - return m.MaxResidentMemory +func (x *AggregatedResourceUsage) GetMaxIoWriteMib() int32 { + if x != nil { + return x.MaxIoWriteMib } return 0 } @@ -137,6 +203,10 @@ func (m *AggregatedResourceUsage) GetMaxResidentMemory() int64 { // // Next tag: 9 type ResourceUsageData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Name of the client service that resource usage is charged/attributed to // e.g 'system' for the system Fleetspeak service, or the name of a daemon // service as specified in its config. @@ -153,89 +223,93 @@ type ResourceUsageData struct { DebugStatus string `protobuf:"bytes,6,opt,name=debug_status,json=debugStatus,proto3" json:"debug_status,omitempty"` // If true, indicates that the process has terminated, and that this is // the final resource-usage report for that process. - ProcessTerminated bool `protobuf:"varint,7,opt,name=process_terminated,json=processTerminated,proto3" json:"process_terminated,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ProcessTerminated bool `protobuf:"varint,7,opt,name=process_terminated,json=processTerminated,proto3" json:"process_terminated,omitempty"` } -func (m *ResourceUsageData) Reset() { *m = ResourceUsageData{} } -func (m *ResourceUsageData) String() string { return proto.CompactTextString(m) } -func (*ResourceUsageData) ProtoMessage() {} -func (*ResourceUsageData) Descriptor() ([]byte, []int) { - return fileDescriptor_4363d2f9d96c68b4, []int{1} +func (x *ResourceUsageData) Reset() { + *x = ResourceUsageData{} + if protoimpl.UnsafeEnabled { + mi := &file_resource_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResourceUsageData) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResourceUsageData.Unmarshal(m, b) -} -func (m *ResourceUsageData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResourceUsageData.Marshal(b, m, deterministic) -} -func (m *ResourceUsageData) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResourceUsageData.Merge(m, src) +func (x *ResourceUsageData) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResourceUsageData) XXX_Size() int { - return xxx_messageInfo_ResourceUsageData.Size(m) -} -func (m *ResourceUsageData) XXX_DiscardUnknown() { - xxx_messageInfo_ResourceUsageData.DiscardUnknown(m) + +func (*ResourceUsageData) ProtoMessage() {} + +func (x *ResourceUsageData) ProtoReflect() protoreflect.Message { + mi := &file_resource_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResourceUsageData proto.InternalMessageInfo +// Deprecated: Use ResourceUsageData.ProtoReflect.Descriptor instead. +func (*ResourceUsageData) Descriptor() ([]byte, []int) { + return file_resource_proto_rawDescGZIP(), []int{1} +} -func (m *ResourceUsageData) GetScope() string { - if m != nil { - return m.Scope +func (x *ResourceUsageData) GetScope() string { + if x != nil { + return x.Scope } return "" } -func (m *ResourceUsageData) GetPid() int64 { - if m != nil { - return m.Pid +func (x *ResourceUsageData) GetPid() int64 { + if x != nil { + return x.Pid } return 0 } -func (m *ResourceUsageData) GetVersion() string { - if m != nil { - return m.Version +func (x *ResourceUsageData) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *ResourceUsageData) GetProcessStartTime() *timestamp.Timestamp { - if m != nil { - return m.ProcessStartTime +func (x *ResourceUsageData) GetProcessStartTime() *timestamp.Timestamp { + if x != nil { + return x.ProcessStartTime } return nil } -func (m *ResourceUsageData) GetDataTimestamp() *timestamp.Timestamp { - if m != nil { - return m.DataTimestamp +func (x *ResourceUsageData) GetDataTimestamp() *timestamp.Timestamp { + if x != nil { + return x.DataTimestamp } return nil } -func (m *ResourceUsageData) GetResourceUsage() *AggregatedResourceUsage { - if m != nil { - return m.ResourceUsage +func (x *ResourceUsageData) GetResourceUsage() *AggregatedResourceUsage { + if x != nil { + return x.ResourceUsage } return nil } -func (m *ResourceUsageData) GetDebugStatus() string { - if m != nil { - return m.DebugStatus +func (x *ResourceUsageData) GetDebugStatus() string { + if x != nil { + return x.DebugStatus } return "" } -func (m *ResourceUsageData) GetProcessTerminated() bool { - if m != nil { - return m.ProcessTerminated +func (x *ResourceUsageData) GetProcessTerminated() bool { + if x != nil { + return x.ProcessTerminated } return false } @@ -243,6 +317,10 @@ func (m *ResourceUsageData) GetProcessTerminated() bool { // Sent by clients when a service gets killed by Fleetspeak, e.g. for using // too much memory. type KillNotification struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Pid int64 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` // The self-reported version of the service. @@ -250,128 +328,267 @@ type KillNotification struct { // Time when the process was started by Fleetspeak. ProcessStartTime *timestamp.Timestamp `protobuf:"bytes,4,opt,name=process_start_time,json=processStartTime,proto3" json:"process_start_time,omitempty"` // Time when the process was killed by Fleetspeak. - KilledWhen *timestamp.Timestamp `protobuf:"bytes,5,opt,name=killed_when,json=killedWhen,proto3" json:"killed_when,omitempty"` - Reason KillNotification_Reason `protobuf:"varint,6,opt,name=reason,proto3,enum=fleetspeak.monitoring.KillNotification_Reason" json:"reason,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + KilledWhen *timestamp.Timestamp `protobuf:"bytes,5,opt,name=killed_when,json=killedWhen,proto3" json:"killed_when,omitempty"` + Reason KillNotification_Reason `protobuf:"varint,6,opt,name=reason,proto3,enum=fleetspeak.monitoring.KillNotification_Reason" json:"reason,omitempty"` } -func (m *KillNotification) Reset() { *m = KillNotification{} } -func (m *KillNotification) String() string { return proto.CompactTextString(m) } -func (*KillNotification) ProtoMessage() {} -func (*KillNotification) Descriptor() ([]byte, []int) { - return fileDescriptor_4363d2f9d96c68b4, []int{2} +func (x *KillNotification) Reset() { + *x = KillNotification{} + if protoimpl.UnsafeEnabled { + mi := &file_resource_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KillNotification) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KillNotification.Unmarshal(m, b) -} -func (m *KillNotification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KillNotification.Marshal(b, m, deterministic) -} -func (m *KillNotification) XXX_Merge(src proto.Message) { - xxx_messageInfo_KillNotification.Merge(m, src) +func (x *KillNotification) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KillNotification) XXX_Size() int { - return xxx_messageInfo_KillNotification.Size(m) -} -func (m *KillNotification) XXX_DiscardUnknown() { - xxx_messageInfo_KillNotification.DiscardUnknown(m) + +func (*KillNotification) ProtoMessage() {} + +func (x *KillNotification) ProtoReflect() protoreflect.Message { + mi := &file_resource_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KillNotification proto.InternalMessageInfo +// Deprecated: Use KillNotification.ProtoReflect.Descriptor instead. +func (*KillNotification) Descriptor() ([]byte, []int) { + return file_resource_proto_rawDescGZIP(), []int{2} +} -func (m *KillNotification) GetService() string { - if m != nil { - return m.Service +func (x *KillNotification) GetService() string { + if x != nil { + return x.Service } return "" } -func (m *KillNotification) GetPid() int64 { - if m != nil { - return m.Pid +func (x *KillNotification) GetPid() int64 { + if x != nil { + return x.Pid } return 0 } -func (m *KillNotification) GetVersion() string { - if m != nil { - return m.Version +func (x *KillNotification) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *KillNotification) GetProcessStartTime() *timestamp.Timestamp { - if m != nil { - return m.ProcessStartTime +func (x *KillNotification) GetProcessStartTime() *timestamp.Timestamp { + if x != nil { + return x.ProcessStartTime } return nil } -func (m *KillNotification) GetKilledWhen() *timestamp.Timestamp { - if m != nil { - return m.KilledWhen +func (x *KillNotification) GetKilledWhen() *timestamp.Timestamp { + if x != nil { + return x.KilledWhen } return nil } -func (m *KillNotification) GetReason() KillNotification_Reason { - if m != nil { - return m.Reason +func (x *KillNotification) GetReason() KillNotification_Reason { + if x != nil { + return x.Reason } return KillNotification_UNSPECIFIED } -func init() { - proto.RegisterEnum("fleetspeak.monitoring.KillNotification_Reason", KillNotification_Reason_name, KillNotification_Reason_value) - proto.RegisterType((*AggregatedResourceUsage)(nil), "fleetspeak.monitoring.AggregatedResourceUsage") - proto.RegisterType((*ResourceUsageData)(nil), "fleetspeak.monitoring.ResourceUsageData") - proto.RegisterType((*KillNotification)(nil), "fleetspeak.monitoring.KillNotification") -} - -func init() { - proto.RegisterFile("fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto", fileDescriptor_4363d2f9d96c68b4) -} - -var fileDescriptor_4363d2f9d96c68b4 = []byte{ - // 582 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xdd, 0x4e, 0xdb, 0x30, - 0x14, 0x5e, 0x5b, 0x28, 0xe0, 0x8e, 0x92, 0x1a, 0xd0, 0x2a, 0x6e, 0xc6, 0x7a, 0xc5, 0x34, 0x91, - 0x4c, 0xec, 0x72, 0x37, 0xeb, 0x68, 0x10, 0x68, 0x83, 0x4d, 0x6e, 0xab, 0x6d, 0x57, 0x96, 0x49, - 0x0e, 0xc1, 0x22, 0x8e, 0x23, 0xdb, 0x61, 0xf0, 0x0c, 0x7b, 0x9c, 0xbd, 0xd7, 0x9e, 0x61, 0xb2, - 0x93, 0xd0, 0xb5, 0x1a, 0xd5, 0xb4, 0xbb, 0xfa, 0x7c, 0x3f, 0xcd, 0xf9, 0xbe, 0x83, 0xde, 0x5d, - 0xa5, 0x00, 0x46, 0xe7, 0xc0, 0x6e, 0x02, 0xad, 0xa2, 0x20, 0x92, 0x42, 0xc8, 0x2c, 0xc8, 0x95, - 0x34, 0x32, 0x98, 0x61, 0x54, 0xc8, 0x8c, 0x1b, 0xa9, 0x78, 0x96, 0x04, 0x0a, 0xb4, 0x2c, 0x54, - 0x04, 0xbe, 0x23, 0xe1, 0xdd, 0x19, 0xcb, 0x9f, 0xb1, 0xf6, 0x9e, 0x27, 0x52, 0x26, 0x29, 0x94, - 0x4e, 0x97, 0xc5, 0x55, 0x60, 0xb8, 0x00, 0x6d, 0x98, 0xc8, 0x4b, 0xdd, 0xe0, 0x67, 0x13, 0x3d, - 0x1b, 0x26, 0x89, 0x82, 0x84, 0x19, 0x88, 0x49, 0x65, 0x3a, 0xd5, 0x2c, 0x01, 0xfc, 0x0a, 0x61, - 0x01, 0x2c, 0xa3, 0x85, 0x06, 0x45, 0xa3, 0xbc, 0xa0, 0x8a, 0x19, 0xe8, 0x37, 0xf6, 0x1b, 0x07, - 0x0d, 0xb2, 0x65, 0x91, 0xa9, 0x06, 0x75, 0x9c, 0x17, 0x84, 0x19, 0xc0, 0x2f, 0x51, 0x4f, 0xb0, - 0xbb, 0x05, 0x6e, 0xd3, 0x71, 0xbb, 0x82, 0xdd, 0xfd, 0x49, 0x0d, 0xd0, 0x8e, 0xf3, 0xd5, 0xf7, - 0xda, 0x80, 0x98, 0xb1, 0x5b, 0x8e, 0xdd, 0xb3, 0xd8, 0xd8, 0x41, 0xb5, 0xe0, 0x10, 0x6d, 0x5b, - 0xef, 0x45, 0xfe, 0x8a, 0xe3, 0x7b, 0x82, 0xdd, 0xcd, 0xd3, 0x5f, 0x57, 0xfe, 0x0a, 0x34, 0x8f, - 0x21, 0x33, 0x54, 0x80, 0x90, 0xea, 0xbe, 0xbf, 0xea, 0xf8, 0x6e, 0x27, 0x52, 0x41, 0xe7, 0x0e, - 0xc1, 0x7e, 0xf9, 0x07, 0x8b, 0x82, 0xf6, 0x7e, 0xe3, 0xa0, 0x45, 0xec, 0x5e, 0xf3, 0xfc, 0xc1, - 0x8f, 0x16, 0xea, 0xcd, 0x65, 0x35, 0x62, 0x86, 0xe1, 0x1d, 0xb4, 0xaa, 0x23, 0x99, 0x97, 0x11, - 0x6d, 0x90, 0xf2, 0x81, 0x3d, 0xd4, 0xca, 0x79, 0xec, 0xa2, 0x68, 0x11, 0xfb, 0x13, 0xf7, 0xd1, - 0xda, 0x2d, 0x28, 0xcd, 0x65, 0xd6, 0x5f, 0x77, 0xcc, 0xfa, 0x89, 0x4f, 0x11, 0xce, 0x95, 0x8c, - 0x40, 0x6b, 0xaa, 0x0d, 0x53, 0x86, 0xda, 0xba, 0x5c, 0x2e, 0x9d, 0xa3, 0x3d, 0xbf, 0xec, 0xd2, - 0xaf, 0xbb, 0xf4, 0x27, 0x75, 0x97, 0xc4, 0xab, 0x54, 0x63, 0x2b, 0xb2, 0x63, 0x3c, 0x44, 0xdd, - 0x98, 0x19, 0x46, 0x1f, 0xfa, 0x76, 0x69, 0x2d, 0x77, 0xd9, 0xb4, 0x8a, 0x87, 0x27, 0x9e, 0xa2, - 0x6e, 0x7d, 0x64, 0xb4, 0xb0, 0x4b, 0xba, 0x00, 0x3b, 0x47, 0xbe, 0xff, 0xd7, 0x5b, 0xf3, 0x1f, - 0x39, 0x23, 0xb2, 0xa9, 0xe6, 0xae, 0xea, 0x05, 0x7a, 0x1a, 0xc3, 0x65, 0x91, 0xd8, 0x0d, 0x4d, - 0xa1, 0x5d, 0xc8, 0x1b, 0xa4, 0xe3, 0x66, 0x63, 0x37, 0xc2, 0x87, 0xb3, 0x18, 0x0c, 0x28, 0xc1, - 0x33, 0x6b, 0xda, 0x5f, 0xdb, 0x6f, 0x1c, 0xac, 0x93, 0x5e, 0x85, 0x4c, 0x1e, 0x80, 0xc1, 0xaf, - 0x26, 0xf2, 0x3e, 0xf0, 0x34, 0xbd, 0x90, 0x86, 0x5f, 0xf1, 0x88, 0x19, 0x1b, 0x65, 0x1f, 0xad, - 0x69, 0x50, 0xb7, 0x3c, 0xaa, 0xeb, 0xa8, 0x9f, 0xcb, 0x0b, 0x69, 0xfd, 0x4b, 0x21, 0x2b, 0xff, - 0x51, 0xc8, 0x5b, 0xd4, 0xb9, 0xe1, 0x69, 0x0a, 0x31, 0xfd, 0x7e, 0x0d, 0x59, 0x15, 0xe5, 0x32, - 0x0b, 0x54, 0xd2, 0xbf, 0x5c, 0x43, 0x86, 0x4f, 0x50, 0x5b, 0x01, 0xd3, 0x32, 0x73, 0x69, 0x75, - 0x1f, 0xad, 0x60, 0x31, 0x05, 0x9f, 0x38, 0x15, 0xa9, 0xd4, 0x83, 0x10, 0xb5, 0xcb, 0x09, 0xde, - 0x42, 0x9d, 0xe9, 0xc5, 0xf8, 0x73, 0x78, 0x7c, 0x76, 0x72, 0x16, 0x8e, 0xbc, 0x27, 0x78, 0x17, - 0xf5, 0x4e, 0xc3, 0x21, 0x99, 0xbc, 0x0f, 0x87, 0x13, 0x7a, 0x32, 0x3c, 0xfb, 0x38, 0x25, 0xa1, - 0xd7, 0xc0, 0xdb, 0x68, 0xeb, 0x3c, 0x3c, 0xff, 0x44, 0xbe, 0xd1, 0xf0, 0xeb, 0x71, 0x18, 0x8e, - 0xc2, 0x91, 0xd7, 0xbc, 0x6c, 0xbb, 0xcf, 0x7d, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x4c, - 0x7a, 0xe2, 0xb7, 0x04, 0x00, 0x00, +var File_resource_proto protoreflect.FileDescriptor + +var file_resource_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x15, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd7, 0x03, 0x0a, 0x17, 0x41, 0x67, 0x67, + 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x0f, 0x6d, 0x65, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, + 0x65, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, + 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x6d, 0x61, + 0x78, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, + 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, + 0x72, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x6d, 0x65, 0x61, 0x6e, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, + 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, + 0x72, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x53, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x14, + 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x12, 0x6d, 0x65, 0x61, 0x6e, + 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x2e, + 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x6d, 0x61, 0x78, + 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x27, + 0x0a, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, + 0x69, 0x62, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, + 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, + 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, + 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, + 0x6d, 0x69, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, + 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, + 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, + 0x69, 0x62, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x64, 0x61, 0x74, 0x61, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, + 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x65, 0x72, + 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, + 0x22, 0xee, 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x5f, + 0x77, 0x68, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x57, 0x68, + 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, + 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, + 0x41, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, + 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, + 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_resource_proto_rawDescOnce sync.Once + file_resource_proto_rawDescData = file_resource_proto_rawDesc +) + +func file_resource_proto_rawDescGZIP() []byte { + file_resource_proto_rawDescOnce.Do(func() { + file_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_proto_rawDescData) + }) + return file_resource_proto_rawDescData +} + +var file_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_resource_proto_goTypes = []interface{}{ + (KillNotification_Reason)(0), // 0: fleetspeak.monitoring.KillNotification.Reason + (*AggregatedResourceUsage)(nil), // 1: fleetspeak.monitoring.AggregatedResourceUsage + (*ResourceUsageData)(nil), // 2: fleetspeak.monitoring.ResourceUsageData + (*KillNotification)(nil), // 3: fleetspeak.monitoring.KillNotification + (*timestamp.Timestamp)(nil), // 4: google.protobuf.Timestamp +} +var file_resource_proto_depIdxs = []int32{ + 4, // 0: fleetspeak.monitoring.ResourceUsageData.process_start_time:type_name -> google.protobuf.Timestamp + 4, // 1: fleetspeak.monitoring.ResourceUsageData.data_timestamp:type_name -> google.protobuf.Timestamp + 1, // 2: fleetspeak.monitoring.ResourceUsageData.resource_usage:type_name -> fleetspeak.monitoring.AggregatedResourceUsage + 4, // 3: fleetspeak.monitoring.KillNotification.process_start_time:type_name -> google.protobuf.Timestamp + 4, // 4: fleetspeak.monitoring.KillNotification.killed_when:type_name -> google.protobuf.Timestamp + 0, // 5: fleetspeak.monitoring.KillNotification.reason:type_name -> fleetspeak.monitoring.KillNotification.Reason + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_resource_proto_init() } +func file_resource_proto_init() { + if File_resource_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AggregatedResourceUsage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_resource_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResourceUsageData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_resource_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KillNotification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_resource_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_resource_proto_goTypes, + DependencyIndexes: file_resource_proto_depIdxs, + EnumInfos: file_resource_proto_enumTypes, + MessageInfos: file_resource_proto_msgTypes, + }.Build() + File_resource_proto = out.File + file_resource_proto_rawDesc = nil + file_resource_proto_goTypes = nil + file_resource_proto_depIdxs = nil } diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto index 0c7b69ae..7208ff8d 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto @@ -14,6 +14,10 @@ message AggregatedResourceUsage { double max_system_cpu_rate = 4; double mean_resident_memory = 5; int64 max_resident_memory = 6; + double mean_io_read_mib = 7; + int32 max_io_read_mib = 8; + double mean_io_write_mib = 9; + int32 max_io_write_mib = 10; } // A fleetspeak.Message with message type "ResourceUsage" is sent regularly by From 8cea970c5b1529a0e9ac3240b3f0c52e1efdb314 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 15:24:03 +0000 Subject: [PATCH 11/38] Changed max_io_read_mib and max_io_write_mib to int64 --- .../proto/fleetspeak_monitoring/resource.pb.go | 12 ++++++------ .../proto/fleetspeak_monitoring/resource.proto | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go index d132b9ac..f3c7b5ad 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go @@ -90,9 +90,9 @@ type AggregatedResourceUsage struct { MeanResidentMemory float64 `protobuf:"fixed64,5,opt,name=mean_resident_memory,json=meanResidentMemory,proto3" json:"mean_resident_memory,omitempty"` MaxResidentMemory int64 `protobuf:"varint,6,opt,name=max_resident_memory,json=maxResidentMemory,proto3" json:"max_resident_memory,omitempty"` MeanIoReadMib float64 `protobuf:"fixed64,7,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` - MaxIoReadMib int32 `protobuf:"varint,8,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` + MaxIoReadMib int64 `protobuf:"varint,8,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` MeanIoWriteMib float64 `protobuf:"fixed64,9,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` - MaxIoWriteMib int32 `protobuf:"varint,10,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` + MaxIoWriteMib int64 `protobuf:"varint,10,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` } func (x *AggregatedResourceUsage) Reset() { @@ -176,7 +176,7 @@ func (x *AggregatedResourceUsage) GetMeanIoReadMib() float64 { return 0 } -func (x *AggregatedResourceUsage) GetMaxIoReadMib() int32 { +func (x *AggregatedResourceUsage) GetMaxIoReadMib() int64 { if x != nil { return x.MaxIoReadMib } @@ -190,7 +190,7 @@ func (x *AggregatedResourceUsage) GetMeanIoWriteMib() float64 { return 0 } -func (x *AggregatedResourceUsage) GetMaxIoWriteMib() int32 { +func (x *AggregatedResourceUsage) GetMaxIoWriteMib() int64 { if x != nil { return x.MaxIoWriteMib } @@ -436,13 +436,13 @@ var file_resource_proto_rawDesc = []byte{ 0x0a, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, - 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, + 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, + 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto index 7208ff8d..893e3da1 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto @@ -15,9 +15,9 @@ message AggregatedResourceUsage { double mean_resident_memory = 5; int64 max_resident_memory = 6; double mean_io_read_mib = 7; - int32 max_io_read_mib = 8; + int64 max_io_read_mib = 8; double mean_io_write_mib = 9; - int32 max_io_write_mib = 10; + int64 max_io_write_mib = 10; } // A fleetspeak.Message with message type "ResourceUsage" is sent regularly by From 4f02c9ed45bf2514dda0ea769ebb98224cf783a1 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 15:26:29 +0000 Subject: [PATCH 12/38] Added code to initialize ClientIORead where needed --- .../internal/monitoring/resource_usage_monitor.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 7409082f..c3ce67e7 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -63,6 +63,8 @@ func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUC } aggRU.MeanResidentMemory = float64(currRU.ResidentMemory) / float64(numRUCalls) aggRU.MaxResidentMemory = currRU.ResidentMemory + aggRU.MeanIoReadMib = float64(currRU.ClientIORead) / float64(numRUCalls) + aggRU.MaxIoReadMib = currRU.ClientIORead return nil } @@ -119,6 +121,14 @@ func aggregateMemoryResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU * return nil } +func aggregateIOResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage) error { + aggRU.GetMeanIoReadMib += float64(currRU.ClientIORead) / float64(numRUCalls) + if currRU.ClientIORead > aggRU.MaxIoReadMib { + aggRU.MaxIoReadMib = currRU.ClientIORead + } + return nil +} + // AggregateResourceUsageForFinishedCmd computes resource-usage for a finished process, given // resource-usage before and after the process ran. func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*mpb.AggregatedResourceUsage, error) { From 56b24933d918214272bd4d2e31428a8cb324ea95 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Tue, 4 Aug 2020 15:27:50 +0000 Subject: [PATCH 13/38] Fixed variables & ammended comment --- .../client/internal/monitoring/resource_usage_monitor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index c3ce67e7..0fe8c6ed 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -122,7 +122,7 @@ func aggregateMemoryResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU * } func aggregateIOResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage) error { - aggRU.GetMeanIoReadMib += float64(currRU.ClientIORead) / float64(numRUCalls) + aggRU.MeanIoReadMib += float64(currRU.ClientIORead) / float64(numRUCalls) if currRU.ClientIORead > aggRU.MaxIoReadMib { aggRU.MaxIoReadMib = currRU.ClientIORead } @@ -142,12 +142,14 @@ func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*m return nil, err } - // If this field is untouched, we have not aggregated memory resource usage + // If this field is untouched, we have not aggregated memory and IO resources usage // for this process yet. We fill it in with what we have. // TODO if aggRU.MaxResidentMemory == 0 { aggRU.MeanResidentMemory = float64(initialRU.ResidentMemory) aggRU.MaxResidentMemory = initialRU.ResidentMemory + aggRU.MeanIoReadMib = float64(initialRU.ClientIORead) + aggRU.MaxIoReadMib = initialRU.ClientIORead } return &aggRU, nil From bc2b658210354334fcdcf9bdfd1edc54bcab0d3d Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 5 Aug 2020 06:32:11 +0000 Subject: [PATCH 14/38] Modified all relevant SQL statements --- fleetspeak/src/server/mysql/clientstore.go | 9 ++++++--- fleetspeak/src/server/mysql/mysql.go | 2 ++ fleetspeak/src/server/sqlite/sqlite.go | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 29f7a2c5..7f2b9113 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -343,7 +343,7 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien return d.runInTx(ctx, false, func(tx *sql.Tx) error { _, err := tx.ExecContext( ctx, - "INSERT INTO client_resource_usage_records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT INTO client_resource_usage_records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", id.Bytes(), rud.Scope, rud.Pid, @@ -356,7 +356,9 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MeanSystemCpuRate, rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB)) + int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), + int32(rud.ResourceUsage.MeanIoReadMib*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB)) return err }) } @@ -370,7 +372,8 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "SELECT "+ "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ - "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib "+ + "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib, "+ + "mean_io_read_mib, max_io_read_mib, "+ "FROM client_resource_usage_records WHERE client_id=? LIMIT ?", id.Bytes(), limit) diff --git a/fleetspeak/src/server/mysql/mysql.go b/fleetspeak/src/server/mysql/mysql.go index ec9c03ec..a0975141 100644 --- a/fleetspeak/src/server/mysql/mysql.go +++ b/fleetspeak/src/server/mysql/mysql.go @@ -154,6 +154,8 @@ mean_system_cpu_rate REAL, max_system_cpu_rate REAL, mean_resident_memory_mib INT4, max_resident_memory_mib INT4, +mean_io_read_mib INT4, +max_io_read_mib INT4, FOREIGN KEY (client_id) REFERENCES clients(client_id))`, `CREATE TABLE IF NOT EXISTS messages( message_id BINARY(32) NOT NULL, diff --git a/fleetspeak/src/server/sqlite/sqlite.go b/fleetspeak/src/server/sqlite/sqlite.go index df9c76b9..923252f7 100644 --- a/fleetspeak/src/server/sqlite/sqlite.go +++ b/fleetspeak/src/server/sqlite/sqlite.go @@ -135,6 +135,8 @@ mean_system_cpu_rate REAL, max_system_cpu_rate REAL, mean_resident_memory_mib INT4, max_resident_memory_mib INT4, +mean_io_read_mib INT4, +max_io_read_mib INT4, FOREIGN KEY (client_id) REFERENCES clients(client_id))`, `CREATE TABLE IF NOT EXISTS messages( message_id TEXT(64) NOT NULL, From 9870bbaafe5e76cb4d774acb623a3b71d6fda1ec Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 5 Aug 2020 07:13:01 +0000 Subject: [PATCH 15/38] Make sure aggregateIOResourceUsage is called --- .../src/client/internal/monitoring/resource_usage_monitor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 0fe8c6ed..b1b5f27b 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -82,6 +82,10 @@ func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUC return nil } + if err := aggregateIOResourceUsage(currRU, numRUCalls, aggRU); err != nil { + return err + } + return aggregateMemoryResourceUsage(currRU, numRUCalls, aggRU) } From 3a4d7a4174fc6c78afb0709186fde253a9e2337e Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 5 Aug 2020 08:19:50 +0000 Subject: [PATCH 16/38] Added full support for ClientIOWrite Added all relevant SQL statements and pieces for ClientIOWrite, so the columns MaxIoWriteMib and MeanIoWriteMib are added to the SQL database. --- .../client/internal/monitoring/resource_usage_fetcher.go | 4 ++-- .../client/internal/monitoring/resource_usage_monitor.go | 8 ++++++++ fleetspeak/src/server/mysql/clientstore.go | 6 ++++-- fleetspeak/src/server/mysql/mysql.go | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 83340a0d..af8e4c8f 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -54,8 +54,8 @@ type ResourceUsageFetcher struct{} // information from exec.Cmd.ProcessState. NOTE that this is only possible // after the process has finished and has been waited for, and will most // probably panic otherwise. -// This function doesn't fill in ResourceUsage.ResidentMemory, ResourceUsage.ClientIORead -// and ResourceUsage.ClientIOWrite. +// This function doesn't fill in ResourceUsage.ResidentMemory, ResourceUsage.ClientIORead, +// ResourceUsage.ClientIOWrite and ResourceUsage.ClientIOWrite. func (f ResourceUsageFetcher) ResourceUsageFromFinishedCmd(cmd *exec.Cmd) *ResourceUsage { return &ResourceUsage{ Timestamp: time.Now(), diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index b1b5f27b..17464c96 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -65,6 +65,8 @@ func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUC aggRU.MaxResidentMemory = currRU.ResidentMemory aggRU.MeanIoReadMib = float64(currRU.ClientIORead) / float64(numRUCalls) aggRU.MaxIoReadMib = currRU.ClientIORead + aggRU.MeanIoWriteMib = float64(currRU.ClientIOWrite) / float64(numRUCalls) + aggRU.MaxIoWriteMib = currRU.ClientIOWrite return nil } @@ -130,6 +132,10 @@ func aggregateIOResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU *mpb. if currRU.ClientIORead > aggRU.MaxIoReadMib { aggRU.MaxIoReadMib = currRU.ClientIORead } + aggRU.MeanIoWriteMib += float64(currRU.ClientIOWrite) / float64(numRUCalls) + if currRU.ClientIOWrite > aggRU.MaxIoWriteMib { + aggRU.MaxIoWriteMib = currRU.ClientIOWrite + } return nil } @@ -154,6 +160,8 @@ func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*m aggRU.MaxResidentMemory = initialRU.ResidentMemory aggRU.MeanIoReadMib = float64(initialRU.ClientIORead) aggRU.MaxIoReadMib = initialRU.ClientIORead + aggRU.MeanIoWriteMib = float64(initialRU.ClientIOWrite) + aggRU.MaxIoWriteMib = initialRU.ClientIOWrite } return &aggRU, nil diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 7f2b9113..d14fb36c 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -358,7 +358,9 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), int32(rud.ResourceUsage.MeanIoReadMib*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB)) + int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB), + int32(rud.ResourceUsage.MeanIoWriteMib*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoWriteMib)*bytesToMIB)) return err }) } @@ -373,7 +375,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib, "+ - "mean_io_read_mib, max_io_read_mib, "+ + "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib, "+ "FROM client_resource_usage_records WHERE client_id=? LIMIT ?", id.Bytes(), limit) diff --git a/fleetspeak/src/server/mysql/mysql.go b/fleetspeak/src/server/mysql/mysql.go index a0975141..508dce07 100644 --- a/fleetspeak/src/server/mysql/mysql.go +++ b/fleetspeak/src/server/mysql/mysql.go @@ -156,6 +156,8 @@ mean_resident_memory_mib INT4, max_resident_memory_mib INT4, mean_io_read_mib INT4, max_io_read_mib INT4, +mean_io_write_mib INT4, +max_io_write_mib INT4, FOREIGN KEY (client_id) REFERENCES clients(client_id))`, `CREATE TABLE IF NOT EXISTS messages( message_id BINARY(32) NOT NULL, From d046a3f5ef9f055ffffc2bf92f33c11289fb89ea Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 5 Aug 2020 08:34:59 +0000 Subject: [PATCH 17/38] Added space in SQL INSERT statement --- fleetspeak/src/server/mysql/clientstore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index d14fb36c..2c181a2a 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -343,7 +343,7 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien return d.runInTx(ctx, false, func(tx *sql.Tx) error { _, err := tx.ExecContext( ctx, - "INSERT INTO client_resource_usage_records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT INTO client_resource_usage_records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", id.Bytes(), rud.Scope, rud.Pid, From 0298851fdfb8615680fc85441807944f70d4c565 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 5 Aug 2020 08:47:05 +0000 Subject: [PATCH 18/38] Scan SQL rows with IO data --- fleetspeak/src/server/mysql/clientstore.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 2c181a2a..47b808aa 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -392,7 +392,8 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli err := rows.Scan( &record.Scope, &record.Pid, &processStartTime, &clientTimestamp, &serverTimestamp, &record.ProcessTerminated, &record.MeanUserCpuRate, &record.MaxUserCpuRate, &record.MeanSystemCpuRate, - &record.MaxSystemCpuRate, &record.MeanResidentMemoryMib, &record.MaxResidentMemoryMib) + &record.MaxSystemCpuRate, &record.MeanResidentMemoryMib, &record.MaxResidentMemoryMib, + &record.MeanIoReadMib, &record.MaxIoReadMib, &record.MeanIoWriteMib, &record.MaxIoWriteMib) if err != nil { return err From 813cec0455d212360ff2cc906f5394417b31c593 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 5 Aug 2020 08:49:46 +0000 Subject: [PATCH 19/38] Separate memory from IO usage --- .../client/internal/monitoring/resource_usage_monitor.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 17464c96..5a28fabe 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -152,14 +152,18 @@ func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*m return nil, err } - // If this field is untouched, we have not aggregated memory and IO resources usage + // If those field are untouched, we have not aggregated memory and IO resources usage // for this process yet. We fill it in with what we have. // TODO if aggRU.MaxResidentMemory == 0 { aggRU.MeanResidentMemory = float64(initialRU.ResidentMemory) aggRU.MaxResidentMemory = initialRU.ResidentMemory + } + if aggRU.MaxIoReadMib == 0 { aggRU.MeanIoReadMib = float64(initialRU.ClientIORead) aggRU.MaxIoReadMib = initialRU.ClientIORead + } + if aggRU.MaxIoWriteMib == 0 { aggRU.MeanIoWriteMib = float64(initialRU.ClientIOWrite) aggRU.MaxIoWriteMib = initialRU.ClientIOWrite } From 1a4299a9ee7e5e90890207f051c05ac52108f101 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Thu, 6 Aug 2020 06:52:35 +0000 Subject: [PATCH 20/38] Added more SQL statements to support IORead/write --- fleetspeak/src/server/sqlite/clientstore.go | 10 ++++++++-- fleetspeak/src/server/sqlite/sqlite.go | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index 003759a5..db840f69 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -360,7 +360,11 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MeanSystemCpuRate, rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB)) + int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), + int32(rud.ResourceUsage.MeanIoReadMib*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB), + int32(rud.ResourceUsage.MeanIoWriteMib*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoWriteMib)*bytesToMIB)) return err }) } @@ -376,6 +380,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib "+ + "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib, "+ "FROM client_resource_usage_records WHERE client_id=? LIMIT ?", id.String(), limit) @@ -392,7 +397,8 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli err := rows.Scan( &record.Scope, &record.Pid, &processStartTime, &clientTimestamp, &serverTimestamp, &record.ProcessTerminated, &record.MeanUserCpuRate, &record.MaxUserCpuRate, &record.MeanSystemCpuRate, - &record.MaxSystemCpuRate, &record.MeanResidentMemoryMib, &record.MaxResidentMemoryMib) + &record.MaxSystemCpuRate, &record.MeanResidentMemoryMib, &record.MaxResidentMemoryMib, + &record.MeanIoReadMib, &record.MaxIoReadMib, &record.MeanIoWriteMib, &record.MaxIoWriteMib) if err != nil { return err diff --git a/fleetspeak/src/server/sqlite/sqlite.go b/fleetspeak/src/server/sqlite/sqlite.go index 923252f7..e6c9141b 100644 --- a/fleetspeak/src/server/sqlite/sqlite.go +++ b/fleetspeak/src/server/sqlite/sqlite.go @@ -137,6 +137,8 @@ mean_resident_memory_mib INT4, max_resident_memory_mib INT4, mean_io_read_mib INT4, max_io_read_mib INT4, +mean_io_write_mib INT4, +max_io_write_mib INT4, FOREIGN KEY (client_id) REFERENCES clients(client_id))`, `CREATE TABLE IF NOT EXISTS messages( message_id TEXT(64) NOT NULL, From 5d798f43f7947c6717add8820e775664da7f8a0c Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Thu, 6 Aug 2020 06:54:22 +0000 Subject: [PATCH 21/38] Added gopsutil/process and calculate IO with it in unix --- .../monitoring/resource_usage_fetcher_unix.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go index f768daa2..f7db375c 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go @@ -25,6 +25,8 @@ import ( "strconv" "strings" "time" + + "github.com/shirou/gopsutil/process" ) // TODO: Support monitoring on other platforms. @@ -131,11 +133,23 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro return nil, fmt.Errorf("error while parsing resident from %s: %v", statmFilename, err) } + process, err := process.NewProcess(int32(pid)) + if err != nil { + return nil, err + } + + ioCounters, err := process.IOCounters() + if err != nil { + return nil, err + } + return &ResourceUsage{ Timestamp: timestamp, UserCPUMillis: float64((utime + cutime) * 10), // Assume rate of 100 ticks/second SystemCPUMillis: float64((stime + cstime) * 10), // Assume rate of 100 ticks/second ResidentMemory: resident * pageSize, + ClientIORead: int64(ioCounters.ReadBytes), + ClientIOWrite: int64(ioCounters.WriteBytes), }, nil } From d1005d3f2a727de360f92de7d51732e4c1438fe0 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Thu, 6 Aug 2020 11:46:57 +0000 Subject: [PATCH 22/38] Fixed SQL query for SQLite --- fleetspeak/src/server/sqlite/clientstore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index db840f69..b1bbb0b7 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -347,7 +347,7 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien return d.runInTx(func(tx *sql.Tx) error { _, err := tx.ExecContext( ctx, - "INSERT INTO client_resource_usage_records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT INTO client_resource_usage_records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", id.String(), rud.Scope, rud.Pid, From ea8a4cc80a412eaa61ed65c25e98ba7023231a56 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Fri, 7 Aug 2020 06:29:59 +0000 Subject: [PATCH 23/38] tests and logs --- .../client/internal/monitoring/resource_usage_fetcher.go | 6 +++++- .../internal/monitoring/resource_usage_fetcher_unix.go | 6 +++++- .../client/internal/monitoring/resource_usage_monitor.go | 3 +++ fleetspeak/src/server/mysql/clientstore.go | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index af8e4c8f..8aeee9db 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -21,6 +21,7 @@ import ( "os/exec" "time" + "github.com/prometheus/common/log" "github.com/shirou/gopsutil/process" ) @@ -89,7 +90,10 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro if err != nil { return nil, err } - + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") + log.Info("Value of int64(ioCounters.ReadBytes):") + log.Info(int64(ioCounters.ReadBytes)) + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") return &ResourceUsage{ Timestamp: timestamp, UserCPUMillis: times.User * 1e3, diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go index f7db375c..ab17ce2b 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go @@ -26,6 +26,7 @@ import ( "strings" "time" + "github.com/prometheus/common/log" "github.com/shirou/gopsutil/process" ) @@ -142,7 +143,10 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro if err != nil { return nil, err } - + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") + log.Info("Value of int64(ioCounters.ReadBytes):") + log.Info(int64(ioCounters.ReadBytes)) + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") return &ResourceUsage{ Timestamp: timestamp, UserCPUMillis: float64((utime + cutime) * 10), // Assume rate of 100 ticks/second diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 5a28fabe..85dbab56 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -49,6 +49,9 @@ const ( // We don't get memory usage data from finished commands. The commandFinished // bool argument makes this function skip memory usage aggregation. func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage, commandFinished bool) error { + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") + log.Info("Beginning of AggregateResourceUsage()") + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") if numRUCalls < 2 { return errors.New("number of resource-usage calls should be at least 2 (for rate computation)") } diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 47b808aa..653706e3 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -340,6 +340,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien if err != nil { return fmt.Errorf("failed to parse data timestamp: %v", err) } + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") + log.Info("Value of int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB):") + log.Info(int32(float64(rud.ResourceUsage.MaxIoReadMib) * bytesToMIB)) + log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") return d.runInTx(ctx, false, func(tx *sql.Tx) error { _, err := tx.ExecContext( ctx, From 5e179bef7d5705481e5d9f13fe9077064cc7a186 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 12 Aug 2020 07:07:49 +0000 Subject: [PATCH 24/38] Changed format of proto message Changed the existing format of (mean|max)_io_(read|write)_mib to format (mean|max)_io_(read|write) in order to be consistent with memory field. --- .../src/common/proto/fleetspeak_monitoring/resource.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto index 893e3da1..c74bc7dd 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto @@ -14,10 +14,10 @@ message AggregatedResourceUsage { double max_system_cpu_rate = 4; double mean_resident_memory = 5; int64 max_resident_memory = 6; - double mean_io_read_mib = 7; - int64 max_io_read_mib = 8; - double mean_io_write_mib = 9; - int64 max_io_write_mib = 10; + double mean_io_read = 7; + int64 max_io_read = 8; + double mean_io_write = 9; + int64 max_io_write = 10; } // A fleetspeak.Message with message type "ResourceUsage" is sent regularly by From a0534ebe89e0f307ff645585493a2b589f54bd16 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 12 Aug 2020 07:09:34 +0000 Subject: [PATCH 25/38] Recompiled relevant proto file --- .../fleetspeak_monitoring/resource.pb.go | 275 +++++++++--------- 1 file changed, 138 insertions(+), 137 deletions(-) diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go index f3c7b5ad..06d9dd65 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.23.0-devel -// protoc v3.12.1 -// source: resource.proto +// protoc-gen-go v1.25.0 +// protoc v3.8.0 +// source: fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto package fleetspeak_monitoring @@ -59,11 +59,11 @@ func (x KillNotification_Reason) String() string { } func (KillNotification_Reason) Descriptor() protoreflect.EnumDescriptor { - return file_resource_proto_enumTypes[0].Descriptor() + return file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_enumTypes[0].Descriptor() } func (KillNotification_Reason) Type() protoreflect.EnumType { - return &file_resource_proto_enumTypes[0] + return &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_enumTypes[0] } func (x KillNotification_Reason) Number() protoreflect.EnumNumber { @@ -72,7 +72,7 @@ func (x KillNotification_Reason) Number() protoreflect.EnumNumber { // Deprecated: Use KillNotification_Reason.Descriptor instead. func (KillNotification_Reason) EnumDescriptor() ([]byte, []int) { - return file_resource_proto_rawDescGZIP(), []int{2, 0} + return file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescGZIP(), []int{2, 0} } // Contains resource-usage metrics for Fleetspeak clients. The stats are @@ -89,16 +89,16 @@ type AggregatedResourceUsage struct { MaxSystemCpuRate float64 `protobuf:"fixed64,4,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemory float64 `protobuf:"fixed64,5,opt,name=mean_resident_memory,json=meanResidentMemory,proto3" json:"mean_resident_memory,omitempty"` MaxResidentMemory int64 `protobuf:"varint,6,opt,name=max_resident_memory,json=maxResidentMemory,proto3" json:"max_resident_memory,omitempty"` - MeanIoReadMib float64 `protobuf:"fixed64,7,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` - MaxIoReadMib int64 `protobuf:"varint,8,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` - MeanIoWriteMib float64 `protobuf:"fixed64,9,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` - MaxIoWriteMib int64 `protobuf:"varint,10,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` + MeanIoRead float64 `protobuf:"fixed64,7,opt,name=mean_io_read,json=meanIoRead,proto3" json:"mean_io_read,omitempty"` + MaxIoRead int64 `protobuf:"varint,8,opt,name=max_io_read,json=maxIoRead,proto3" json:"max_io_read,omitempty"` + MeanIoWrite float64 `protobuf:"fixed64,9,opt,name=mean_io_write,json=meanIoWrite,proto3" json:"mean_io_write,omitempty"` + MaxIoWrite int64 `protobuf:"varint,10,opt,name=max_io_write,json=maxIoWrite,proto3" json:"max_io_write,omitempty"` } func (x *AggregatedResourceUsage) Reset() { *x = AggregatedResourceUsage{} if protoimpl.UnsafeEnabled { - mi := &file_resource_proto_msgTypes[0] + mi := &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111,7 +111,7 @@ func (x *AggregatedResourceUsage) String() string { func (*AggregatedResourceUsage) ProtoMessage() {} func (x *AggregatedResourceUsage) ProtoReflect() protoreflect.Message { - mi := &file_resource_proto_msgTypes[0] + mi := &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -124,7 +124,7 @@ func (x *AggregatedResourceUsage) ProtoReflect() protoreflect.Message { // Deprecated: Use AggregatedResourceUsage.ProtoReflect.Descriptor instead. func (*AggregatedResourceUsage) Descriptor() ([]byte, []int) { - return file_resource_proto_rawDescGZIP(), []int{0} + return file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescGZIP(), []int{0} } func (x *AggregatedResourceUsage) GetMeanUserCpuRate() float64 { @@ -169,30 +169,30 @@ func (x *AggregatedResourceUsage) GetMaxResidentMemory() int64 { return 0 } -func (x *AggregatedResourceUsage) GetMeanIoReadMib() float64 { +func (x *AggregatedResourceUsage) GetMeanIoRead() float64 { if x != nil { - return x.MeanIoReadMib + return x.MeanIoRead } return 0 } -func (x *AggregatedResourceUsage) GetMaxIoReadMib() int64 { +func (x *AggregatedResourceUsage) GetMaxIoRead() int64 { if x != nil { - return x.MaxIoReadMib + return x.MaxIoRead } return 0 } -func (x *AggregatedResourceUsage) GetMeanIoWriteMib() float64 { +func (x *AggregatedResourceUsage) GetMeanIoWrite() float64 { if x != nil { - return x.MeanIoWriteMib + return x.MeanIoWrite } return 0 } -func (x *AggregatedResourceUsage) GetMaxIoWriteMib() int64 { +func (x *AggregatedResourceUsage) GetMaxIoWrite() int64 { if x != nil { - return x.MaxIoWriteMib + return x.MaxIoWrite } return 0 } @@ -229,7 +229,7 @@ type ResourceUsageData struct { func (x *ResourceUsageData) Reset() { *x = ResourceUsageData{} if protoimpl.UnsafeEnabled { - mi := &file_resource_proto_msgTypes[1] + mi := &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -242,7 +242,7 @@ func (x *ResourceUsageData) String() string { func (*ResourceUsageData) ProtoMessage() {} func (x *ResourceUsageData) ProtoReflect() protoreflect.Message { - mi := &file_resource_proto_msgTypes[1] + mi := &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -255,7 +255,7 @@ func (x *ResourceUsageData) ProtoReflect() protoreflect.Message { // Deprecated: Use ResourceUsageData.ProtoReflect.Descriptor instead. func (*ResourceUsageData) Descriptor() ([]byte, []int) { - return file_resource_proto_rawDescGZIP(), []int{1} + return file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescGZIP(), []int{1} } func (x *ResourceUsageData) GetScope() string { @@ -335,7 +335,7 @@ type KillNotification struct { func (x *KillNotification) Reset() { *x = KillNotification{} if protoimpl.UnsafeEnabled { - mi := &file_resource_proto_msgTypes[2] + mi := &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -348,7 +348,7 @@ func (x *KillNotification) String() string { func (*KillNotification) ProtoMessage() {} func (x *KillNotification) ProtoReflect() protoreflect.Message { - mi := &file_resource_proto_msgTypes[2] + mi := &file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -361,7 +361,7 @@ func (x *KillNotification) ProtoReflect() protoreflect.Message { // Deprecated: Use KillNotification.ProtoReflect.Descriptor instead. func (*KillNotification) Descriptor() ([]byte, []int) { - return file_resource_proto_rawDescGZIP(), []int{2} + return file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescGZIP(), []int{2} } func (x *KillNotification) GetService() string { @@ -406,116 +406,117 @@ func (x *KillNotification) GetReason() KillNotification_Reason { return KillNotification_UNSPECIFIED } -var File_resource_proto protoreflect.FileDescriptor - -var file_resource_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x15, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd7, 0x03, 0x0a, 0x17, 0x41, 0x67, 0x67, - 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x0f, 0x6d, 0x65, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, - 0x65, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, - 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x6d, 0x61, - 0x78, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, - 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, - 0x72, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x6d, 0x65, 0x61, 0x6e, - 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, - 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, - 0x72, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x14, - 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x12, 0x6d, 0x65, 0x61, 0x6e, - 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x2e, - 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, - 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x6d, 0x61, 0x78, - 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x27, - 0x0a, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, - 0x69, 0x62, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, - 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, - 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, - 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, - 0x6d, 0x69, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, - 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, - 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, - 0x69, 0x62, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, - 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, +var File_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto protoreflect.FileDescriptor + +var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDesc = []byte{ + 0x0a, 0x40, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2f, 0x73, 0x72, 0x63, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x6c, + 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, + 0x69, 0x6e, 0x67, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x15, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, + 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x03, 0x0a, 0x17, 0x41, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x0f, 0x6d, 0x65, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, + 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, + 0x6d, 0x61, 0x78, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2f, + 0x0a, 0x14, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, + 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x6d, 0x65, + 0x61, 0x6e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, + 0x2d, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, + 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x6d, 0x61, + 0x78, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x30, + 0x0a, 0x14, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, + 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x12, 0x6d, 0x65, + 0x61, 0x6e, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x6d, + 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, + 0x61, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, + 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, + 0x61, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, + 0x69, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x61, 0x6e, 0x49, + 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, + 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x61, + 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x64, 0x61, 0x74, 0x61, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, - 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x65, 0x72, - 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, - 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, - 0x22, 0xee, 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, - 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, - 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x5f, - 0x77, 0x68, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x57, 0x68, - 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, - 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, - 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, - 0x41, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, - 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, - 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, + 0x64, 0x61, 0x74, 0x61, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, + 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, + 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, + 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, + 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x22, 0xee, 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, + 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x77, 0x68, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, + 0x6c, 0x6c, 0x65, 0x64, 0x57, 0x68, 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, + 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, + 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, + 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, + 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, + 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_resource_proto_rawDescOnce sync.Once - file_resource_proto_rawDescData = file_resource_proto_rawDesc + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescOnce sync.Once + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescData = file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDesc ) -func file_resource_proto_rawDescGZIP() []byte { - file_resource_proto_rawDescOnce.Do(func() { - file_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_proto_rawDescData) +func file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescGZIP() []byte { + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescOnce.Do(func() { + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescData) }) - return file_resource_proto_rawDescData + return file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDescData } -var file_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_resource_proto_goTypes = []interface{}{ +var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_goTypes = []interface{}{ (KillNotification_Reason)(0), // 0: fleetspeak.monitoring.KillNotification.Reason (*AggregatedResourceUsage)(nil), // 1: fleetspeak.monitoring.AggregatedResourceUsage (*ResourceUsageData)(nil), // 2: fleetspeak.monitoring.ResourceUsageData (*KillNotification)(nil), // 3: fleetspeak.monitoring.KillNotification (*timestamp.Timestamp)(nil), // 4: google.protobuf.Timestamp } -var file_resource_proto_depIdxs = []int32{ +var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_depIdxs = []int32{ 4, // 0: fleetspeak.monitoring.ResourceUsageData.process_start_time:type_name -> google.protobuf.Timestamp 4, // 1: fleetspeak.monitoring.ResourceUsageData.data_timestamp:type_name -> google.protobuf.Timestamp 1, // 2: fleetspeak.monitoring.ResourceUsageData.resource_usage:type_name -> fleetspeak.monitoring.AggregatedResourceUsage @@ -529,13 +530,13 @@ var file_resource_proto_depIdxs = []int32{ 0, // [0:6] is the sub-list for field type_name } -func init() { file_resource_proto_init() } -func file_resource_proto_init() { - if File_resource_proto != nil { +func init() { file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_init() } +func file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_init() { + if File_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AggregatedResourceUsage); i { case 0: return &v.state @@ -547,7 +548,7 @@ func file_resource_proto_init() { return nil } } - file_resource_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResourceUsageData); i { case 0: return &v.state @@ -559,7 +560,7 @@ func file_resource_proto_init() { return nil } } - file_resource_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KillNotification); i { case 0: return &v.state @@ -576,19 +577,19 @@ func file_resource_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_proto_rawDesc, + RawDescriptor: file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDesc, NumEnums: 1, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_resource_proto_goTypes, - DependencyIndexes: file_resource_proto_depIdxs, - EnumInfos: file_resource_proto_enumTypes, - MessageInfos: file_resource_proto_msgTypes, + GoTypes: file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_goTypes, + DependencyIndexes: file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_depIdxs, + EnumInfos: file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_enumTypes, + MessageInfos: file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_msgTypes, }.Build() - File_resource_proto = out.File - file_resource_proto_rawDesc = nil - file_resource_proto_goTypes = nil - file_resource_proto_depIdxs = nil + File_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto = out.File + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDesc = nil + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_goTypes = nil + file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_depIdxs = nil } From 52c1aaee7d4e26c0bc21f930696a9086773d3c79 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 12 Aug 2020 07:12:18 +0000 Subject: [PATCH 26/38] Removed logs --- .../src/client/internal/monitoring/resource_usage_fetcher.go | 5 ----- .../internal/monitoring/resource_usage_fetcher_unix.go | 5 ----- .../src/client/internal/monitoring/resource_usage_monitor.go | 3 --- fleetspeak/src/server/mysql/clientstore.go | 4 ---- 4 files changed, 17 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 8aeee9db..9cdbc0af 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -21,7 +21,6 @@ import ( "os/exec" "time" - "github.com/prometheus/common/log" "github.com/shirou/gopsutil/process" ) @@ -90,10 +89,6 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro if err != nil { return nil, err } - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") - log.Info("Value of int64(ioCounters.ReadBytes):") - log.Info(int64(ioCounters.ReadBytes)) - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") return &ResourceUsage{ Timestamp: timestamp, UserCPUMillis: times.User * 1e3, diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go index ab17ce2b..632f60c0 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go @@ -26,7 +26,6 @@ import ( "strings" "time" - "github.com/prometheus/common/log" "github.com/shirou/gopsutil/process" ) @@ -143,10 +142,6 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro if err != nil { return nil, err } - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") - log.Info("Value of int64(ioCounters.ReadBytes):") - log.Info(int64(ioCounters.ReadBytes)) - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") return &ResourceUsage{ Timestamp: timestamp, UserCPUMillis: float64((utime + cutime) * 10), // Assume rate of 100 ticks/second diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 85dbab56..5a28fabe 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -49,9 +49,6 @@ const ( // We don't get memory usage data from finished commands. The commandFinished // bool argument makes this function skip memory usage aggregation. func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage, commandFinished bool) error { - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") - log.Info("Beginning of AggregateResourceUsage()") - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") if numRUCalls < 2 { return errors.New("number of resource-usage calls should be at least 2 (for rate computation)") } diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 653706e3..47b808aa 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -340,10 +340,6 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien if err != nil { return fmt.Errorf("failed to parse data timestamp: %v", err) } - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") - log.Info("Value of int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB):") - log.Info(int32(float64(rud.ResourceUsage.MaxIoReadMib) * bytesToMIB)) - log.Info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") return d.runInTx(ctx, false, func(tx *sql.Tx) error { _, err := tx.ExecContext( ctx, From 8e394388a188ff9de22e3dd8c42bda4955830f60 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 12 Aug 2020 07:13:48 +0000 Subject: [PATCH 27/38] Changed relevant code to fit new proto fields --- .../monitoring/resource_usage_fetcher.go | 12 +++---- .../monitoring/resource_usage_fetcher_unix.go | 8 ++--- .../monitoring/resource_usage_monitor.go | 32 +++++++++---------- fleetspeak/src/server/mysql/clientstore.go | 8 ++--- fleetspeak/src/server/sqlite/clientstore.go | 8 ++--- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index 9cdbc0af..acb73d5a 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -41,10 +41,10 @@ type ResourceUsage struct { ResidentMemory int64 // Client IO data read so far, in bytes. - ClientIORead int64 + IORead int64 // Client IO data written so far, in bytes. - ClientIOWrite int64 + IOWrite int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. @@ -54,8 +54,8 @@ type ResourceUsageFetcher struct{} // information from exec.Cmd.ProcessState. NOTE that this is only possible // after the process has finished and has been waited for, and will most // probably panic otherwise. -// This function doesn't fill in ResourceUsage.ResidentMemory, ResourceUsage.ClientIORead, -// ResourceUsage.ClientIOWrite and ResourceUsage.ClientIOWrite. +// This function doesn't fill in ResourceUsage.ResidentMemory, ResourceUsage.IORead +// and ResourceUsage.IOWrite. func (f ResourceUsageFetcher) ResourceUsageFromFinishedCmd(cmd *exec.Cmd) *ResourceUsage { return &ResourceUsage{ Timestamp: time.Now(), @@ -94,8 +94,8 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro UserCPUMillis: times.User * 1e3, SystemCPUMillis: times.System * 1e3, ResidentMemory: int64(memoryInfo.RSS), - ClientIORead: int64(ioCounters.ReadBytes), - ClientIOWrite: int64(ioCounters.WriteBytes), + IORead: int64(ioCounters.ReadBytes), + IOWrite: int64(ioCounters.WriteBytes), }, nil } diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go index 632f60c0..06879d56 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go @@ -46,10 +46,10 @@ type ResourceUsage struct { ResidentMemory int64 // Client IO data read so far, in bytes. - ClientIORead int64 + IORead int64 // Client IO data written so far, in bytes. - ClientIOWrite int64 + IOWrite int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. @@ -147,8 +147,8 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro UserCPUMillis: float64((utime + cutime) * 10), // Assume rate of 100 ticks/second SystemCPUMillis: float64((stime + cstime) * 10), // Assume rate of 100 ticks/second ResidentMemory: resident * pageSize, - ClientIORead: int64(ioCounters.ReadBytes), - ClientIOWrite: int64(ioCounters.WriteBytes), + IORead: int64(ioCounters.ReadBytes), + IOWrite: int64(ioCounters.WriteBytes), }, nil } diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 5a28fabe..f69ee123 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -63,10 +63,10 @@ func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUC } aggRU.MeanResidentMemory = float64(currRU.ResidentMemory) / float64(numRUCalls) aggRU.MaxResidentMemory = currRU.ResidentMemory - aggRU.MeanIoReadMib = float64(currRU.ClientIORead) / float64(numRUCalls) - aggRU.MaxIoReadMib = currRU.ClientIORead - aggRU.MeanIoWriteMib = float64(currRU.ClientIOWrite) / float64(numRUCalls) - aggRU.MaxIoWriteMib = currRU.ClientIOWrite + aggRU.MeanIoRead = float64(currRU.IORead) / float64(numRUCalls) + aggRU.MaxIoRead = currRU.IORead + aggRU.MeanIoWrite = float64(currRU.IOWrite) / float64(numRUCalls) + aggRU.MaxIoWrite = currRU.IOWrite return nil } @@ -128,13 +128,13 @@ func aggregateMemoryResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU * } func aggregateIOResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage) error { - aggRU.MeanIoReadMib += float64(currRU.ClientIORead) / float64(numRUCalls) - if currRU.ClientIORead > aggRU.MaxIoReadMib { - aggRU.MaxIoReadMib = currRU.ClientIORead + aggRU.MeanIoRead += float64(currRU.IORead) / float64(numRUCalls) + if currRU.IORead > aggRU.MaxIoRead { + aggRU.MaxIoRead = currRU.IORead } - aggRU.MeanIoWriteMib += float64(currRU.ClientIOWrite) / float64(numRUCalls) - if currRU.ClientIOWrite > aggRU.MaxIoWriteMib { - aggRU.MaxIoWriteMib = currRU.ClientIOWrite + aggRU.MeanIoWrite += float64(currRU.IOWrite) / float64(numRUCalls) + if currRU.IOWrite > aggRU.MaxIoWrite { + aggRU.MaxIoWrite = currRU.IOWrite } return nil } @@ -159,13 +159,13 @@ func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*m aggRU.MeanResidentMemory = float64(initialRU.ResidentMemory) aggRU.MaxResidentMemory = initialRU.ResidentMemory } - if aggRU.MaxIoReadMib == 0 { - aggRU.MeanIoReadMib = float64(initialRU.ClientIORead) - aggRU.MaxIoReadMib = initialRU.ClientIORead + if aggRU.MaxIoRead == 0 { + aggRU.MeanIoRead = float64(initialRU.IORead) + aggRU.MaxIoRead = initialRU.IORead } - if aggRU.MaxIoWriteMib == 0 { - aggRU.MeanIoWriteMib = float64(initialRU.ClientIOWrite) - aggRU.MaxIoWriteMib = initialRU.ClientIOWrite + if aggRU.MaxIoWrite == 0 { + aggRU.MeanIoWrite = float64(initialRU.IOWrite) + aggRU.MaxIoWrite = initialRU.IOWrite } return &aggRU, nil diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 47b808aa..64f58d4f 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -357,10 +357,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoReadMib*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoWriteMib*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoWriteMib)*bytesToMIB)) + int32(rud.ResourceUsage.MeanIoRead*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToMIB), + int32(rud.ResourceUsage.MeanIoWrite*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToMIB)) return err }) } diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index b1bbb0b7..76d1498c 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -361,10 +361,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoReadMib*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoReadMib)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoWriteMib*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoWriteMib)*bytesToMIB)) + int32(rud.ResourceUsage.MeanIoRead*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToMIB), + int32(rud.ResourceUsage.MeanIoWrite*bytesToMIB), + int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToMIB)) return err }) } From ecd748324f17c5482bf33d0b70d55847441f7503 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 07:41:36 +0000 Subject: [PATCH 28/38] Merge leftover generated proto from main branch --- .../proto/fleetspeak_server/resource.pb.go | 197 +----------------- 1 file changed, 3 insertions(+), 194 deletions(-) diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go index 1445c12a..d372a441 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go @@ -1,24 +1,19 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -<<<<<<< HEAD -// protoc-gen-go v1.23.0-devel -// protoc v3.12.1 -// source: resource.proto -======= // protoc-gen-go v1.25.0 // protoc v3.8.0 // source: fleetspeak/src/server/proto/fleetspeak_server/resource.proto ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de package fleetspeak_server import ( + reflect "reflect" + sync "sync" + proto "github.com/golang/protobuf/proto" timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( @@ -59,23 +54,12 @@ type ClientResourceUsageRecord struct { MaxSystemCpuRate float32 `protobuf:"fixed32,9,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemoryMib int32 `protobuf:"varint,10,opt,name=mean_resident_memory_mib,json=meanResidentMemoryMib,proto3" json:"mean_resident_memory_mib,omitempty"` MaxResidentMemoryMib int32 `protobuf:"varint,11,opt,name=max_resident_memory_mib,json=maxResidentMemoryMib,proto3" json:"max_resident_memory_mib,omitempty"` -<<<<<<< HEAD - MeanIoReadMib int32 `protobuf:"varint,13,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` - MaxIoReadMib int32 `protobuf:"varint,14,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` - MeanIoWriteMib int32 `protobuf:"varint,15,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` - MaxIoWriteMib int32 `protobuf:"varint,16,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` -======= ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } func (x *ClientResourceUsageRecord) Reset() { *x = ClientResourceUsageRecord{} if protoimpl.UnsafeEnabled { -<<<<<<< HEAD - mi := &file_resource_proto_msgTypes[0] -======= mi := &file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_msgTypes[0] ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88,11 +72,7 @@ func (x *ClientResourceUsageRecord) String() string { func (*ClientResourceUsageRecord) ProtoMessage() {} func (x *ClientResourceUsageRecord) ProtoReflect() protoreflect.Message { -<<<<<<< HEAD - mi := &file_resource_proto_msgTypes[0] -======= mi := &file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_msgTypes[0] ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105,11 +85,7 @@ func (x *ClientResourceUsageRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientResourceUsageRecord.ProtoReflect.Descriptor instead. func (*ClientResourceUsageRecord) Descriptor() ([]byte, []int) { -<<<<<<< HEAD - return file_resource_proto_rawDescGZIP(), []int{0} -======= return file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDescGZIP(), []int{0} ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } func (x *ClientResourceUsageRecord) GetScope() string { @@ -157,186 +133,45 @@ func (x *ClientResourceUsageRecord) GetProcessTerminated() bool { func (x *ClientResourceUsageRecord) GetMeanUserCpuRate() float32 { if x != nil { return x.MeanUserCpuRate -<<<<<<< HEAD - } - return 0 -} - -func (x *ClientResourceUsageRecord) GetMaxUserCpuRate() float32 { - if x != nil { - return x.MaxUserCpuRate - } - return 0 -} - -func (x *ClientResourceUsageRecord) GetMeanSystemCpuRate() float32 { - if x != nil { - return x.MeanSystemCpuRate -======= ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } return 0 } -<<<<<<< HEAD -func (x *ClientResourceUsageRecord) GetMaxSystemCpuRate() float32 { - if x != nil { - return x.MaxSystemCpuRate -======= func (x *ClientResourceUsageRecord) GetMaxUserCpuRate() float32 { if x != nil { return x.MaxUserCpuRate ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } return 0 } -<<<<<<< HEAD -func (x *ClientResourceUsageRecord) GetMeanResidentMemoryMib() int32 { - if x != nil { - return x.MeanResidentMemoryMib -======= func (x *ClientResourceUsageRecord) GetMeanSystemCpuRate() float32 { if x != nil { return x.MeanSystemCpuRate ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } return 0 } -<<<<<<< HEAD -func (x *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { - if x != nil { - return x.MaxResidentMemoryMib -======= func (x *ClientResourceUsageRecord) GetMaxSystemCpuRate() float32 { if x != nil { return x.MaxSystemCpuRate ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } return 0 } -<<<<<<< HEAD -func (x *ClientResourceUsageRecord) GetMeanIoReadMib() int32 { - if x != nil { - return x.MeanIoReadMib -======= func (x *ClientResourceUsageRecord) GetMeanResidentMemoryMib() int32 { if x != nil { return x.MeanResidentMemoryMib ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } return 0 } -<<<<<<< HEAD -func (x *ClientResourceUsageRecord) GetMaxIoReadMib() int32 { - if x != nil { - return x.MaxIoReadMib -======= func (x *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { if x != nil { return x.MaxResidentMemoryMib ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de - } - return 0 -} - -<<<<<<< HEAD -func (x *ClientResourceUsageRecord) GetMeanIoWriteMib() int32 { - if x != nil { - return x.MeanIoWriteMib } return 0 } -func (x *ClientResourceUsageRecord) GetMaxIoWriteMib() int32 { - if x != nil { - return x.MaxIoWriteMib - } - return 0 -} - -var File_resource_proto protoreflect.FileDescriptor - -var file_resource_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x11, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x06, 0x0a, 0x19, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x54, 0x69, 0x6d, 0x65, 0x12, 0x45, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x45, 0x0a, 0x10, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x65, - 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, - 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, - 0x64, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, - 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x6d, - 0x65, 0x61, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x29, - 0x0a, 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, - 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x55, 0x73, - 0x65, 0x72, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x6d, 0x65, 0x61, - 0x6e, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, - 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x53, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x2d, 0x0a, 0x13, 0x6d, 0x61, - 0x78, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, - 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x43, 0x70, 0x75, 0x52, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6d, 0x65, 0x61, - 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, - 0x79, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x6d, 0x65, 0x61, - 0x6e, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x4d, - 0x69, 0x62, 0x12, 0x35, 0x0a, 0x17, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x65, 0x61, - 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0d, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, - 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, - 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, - 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, - 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, - 0x65, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x77, - 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, - 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_resource_proto_rawDescOnce sync.Once - file_resource_proto_rawDescData = file_resource_proto_rawDesc -) - -func file_resource_proto_rawDescGZIP() []byte { - file_resource_proto_rawDescOnce.Do(func() { - file_resource_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_proto_rawDescData) - }) - return file_resource_proto_rawDescData -} - -var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_resource_proto_goTypes = []interface{}{ - (*ClientResourceUsageRecord)(nil), // 0: fleetspeak.server.ClientResourceUsageRecord - (*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp -} -var file_resource_proto_depIdxs = []int32{ -======= var File_fleetspeak_src_server_proto_fleetspeak_server_resource_proto protoreflect.FileDescriptor var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = []byte{ @@ -407,7 +242,6 @@ var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_goTypes = (*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp } var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_depIdxs = []int32{ ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de 1, // 0: fleetspeak.server.ClientResourceUsageRecord.process_start_time:type_name -> google.protobuf.Timestamp 1, // 1: fleetspeak.server.ClientResourceUsageRecord.client_timestamp:type_name -> google.protobuf.Timestamp 1, // 2: fleetspeak.server.ClientResourceUsageRecord.server_timestamp:type_name -> google.protobuf.Timestamp @@ -418,15 +252,6 @@ var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_depIdxs = 0, // [0:3] is the sub-list for field type_name } -<<<<<<< HEAD -func init() { file_resource_proto_init() } -func file_resource_proto_init() { - if File_resource_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { -======= func init() { file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_init() } func file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_init() { if File_fleetspeak_src_server_proto_fleetspeak_server_resource_proto != nil { @@ -434,7 +259,6 @@ func file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_init() { } if !protoimpl.UnsafeEnabled { file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de switch v := v.(*ClientResourceUsageRecord); i { case 0: return &v.state @@ -451,26 +275,12 @@ func file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), -<<<<<<< HEAD - RawDescriptor: file_resource_proto_rawDesc, -======= RawDescriptor: file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc, ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, -<<<<<<< HEAD - GoTypes: file_resource_proto_goTypes, - DependencyIndexes: file_resource_proto_depIdxs, - MessageInfos: file_resource_proto_msgTypes, - }.Build() - File_resource_proto = out.File - file_resource_proto_rawDesc = nil - file_resource_proto_goTypes = nil - file_resource_proto_depIdxs = nil -======= GoTypes: file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_goTypes, DependencyIndexes: file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_depIdxs, MessageInfos: file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_msgTypes, @@ -479,5 +289,4 @@ func file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_init() { file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = nil file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_goTypes = nil file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_depIdxs = nil ->>>>>>> 4209f6985bdc5e4dcec5601cddd6c148920f84de } From 416b7bf5fcf8e70093d91b647639d5ff16bbff55 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 07:47:52 +0000 Subject: [PATCH 29/38] Recompiled protos with new fields --- .../fleetspeak_monitoring/resource.pb.go | 145 +++++++++++------- .../proto/fleetspeak_server/resource.pb.go | 52 ++++++- 2 files changed, 139 insertions(+), 58 deletions(-) diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go index 6f3eb4da..06d9dd65 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go @@ -7,13 +7,12 @@ package fleetspeak_monitoring import ( - reflect "reflect" - sync "sync" - proto "github.com/golang/protobuf/proto" timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -90,6 +89,10 @@ type AggregatedResourceUsage struct { MaxSystemCpuRate float64 `protobuf:"fixed64,4,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemory float64 `protobuf:"fixed64,5,opt,name=mean_resident_memory,json=meanResidentMemory,proto3" json:"mean_resident_memory,omitempty"` MaxResidentMemory int64 `protobuf:"varint,6,opt,name=max_resident_memory,json=maxResidentMemory,proto3" json:"max_resident_memory,omitempty"` + MeanIoRead float64 `protobuf:"fixed64,7,opt,name=mean_io_read,json=meanIoRead,proto3" json:"mean_io_read,omitempty"` + MaxIoRead int64 `protobuf:"varint,8,opt,name=max_io_read,json=maxIoRead,proto3" json:"max_io_read,omitempty"` + MeanIoWrite float64 `protobuf:"fixed64,9,opt,name=mean_io_write,json=meanIoWrite,proto3" json:"mean_io_write,omitempty"` + MaxIoWrite int64 `protobuf:"varint,10,opt,name=max_io_write,json=maxIoWrite,proto3" json:"max_io_write,omitempty"` } func (x *AggregatedResourceUsage) Reset() { @@ -166,6 +169,34 @@ func (x *AggregatedResourceUsage) GetMaxResidentMemory() int64 { return 0 } +func (x *AggregatedResourceUsage) GetMeanIoRead() float64 { + if x != nil { + return x.MeanIoRead + } + return 0 +} + +func (x *AggregatedResourceUsage) GetMaxIoRead() int64 { + if x != nil { + return x.MaxIoRead + } + return 0 +} + +func (x *AggregatedResourceUsage) GetMeanIoWrite() float64 { + if x != nil { + return x.MeanIoWrite + } + return 0 +} + +func (x *AggregatedResourceUsage) GetMaxIoWrite() int64 { + if x != nil { + return x.MaxIoWrite + } + return 0 +} + // A fleetspeak.Message with message type "ResourceUsage" is sent regularly by // the system and daemon services to the server, to report the performance of // processes. @@ -385,7 +416,7 @@ var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDes 0x74, 0x6f, 0x12, 0x15, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x02, 0x0a, 0x17, 0x41, + 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x03, 0x0a, 0x17, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, @@ -405,55 +436,63 @@ var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDes 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, - 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, - 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, - 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x64, 0x61, 0x74, 0x61, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, - 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, - 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, - 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x65, 0x72, 0x6d, 0x69, - 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, 0x72, 0x6f, - 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x22, 0xee, - 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, - 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, - 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x77, 0x68, - 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x57, 0x68, 0x65, 0x6e, - 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, - 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, - 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, - 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, + 0x61, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, + 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, + 0x61, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, + 0x69, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x61, 0x6e, 0x49, + 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, + 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x61, + 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, + 0x64, 0x61, 0x74, 0x61, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, + 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, + 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, + 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, + 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x22, 0xee, 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, + 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x77, 0x68, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, + 0x6c, 0x6c, 0x65, 0x64, 0x57, 0x68, 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, + 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, + 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, + 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, + 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, + 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go index d372a441..38e2074c 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go @@ -7,13 +7,12 @@ package fleetspeak_server import ( - reflect "reflect" - sync "sync" - proto "github.com/golang/protobuf/proto" timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -54,6 +53,10 @@ type ClientResourceUsageRecord struct { MaxSystemCpuRate float32 `protobuf:"fixed32,9,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemoryMib int32 `protobuf:"varint,10,opt,name=mean_resident_memory_mib,json=meanResidentMemoryMib,proto3" json:"mean_resident_memory_mib,omitempty"` MaxResidentMemoryMib int32 `protobuf:"varint,11,opt,name=max_resident_memory_mib,json=maxResidentMemoryMib,proto3" json:"max_resident_memory_mib,omitempty"` + MeanIoReadMib int32 `protobuf:"varint,13,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` + MaxIoReadMib int32 `protobuf:"varint,14,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` + MeanIoWriteMib int32 `protobuf:"varint,15,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` + MaxIoWriteMib int32 `protobuf:"varint,16,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` } func (x *ClientResourceUsageRecord) Reset() { @@ -172,6 +175,34 @@ func (x *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { return 0 } +func (x *ClientResourceUsageRecord) GetMeanIoReadMib() int32 { + if x != nil { + return x.MeanIoReadMib + } + return 0 +} + +func (x *ClientResourceUsageRecord) GetMaxIoReadMib() int32 { + if x != nil { + return x.MaxIoReadMib + } + return 0 +} + +func (x *ClientResourceUsageRecord) GetMeanIoWriteMib() int32 { + if x != nil { + return x.MeanIoWriteMib + } + return 0 +} + +func (x *ClientResourceUsageRecord) GetMaxIoWriteMib() int32 { + if x != nil { + return x.MaxIoWriteMib + } + return 0 +} + var File_fleetspeak_src_server_proto_fleetspeak_server_resource_proto protoreflect.FileDescriptor var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = []byte{ @@ -182,7 +213,7 @@ var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xf2, 0x04, 0x0a, 0x19, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x74, 0x6f, 0x22, 0x96, 0x06, 0x0a, 0x19, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, @@ -221,7 +252,18 @@ var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = 0x12, 0x35, 0x0a, 0x17, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x4d, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x6f, 0x72, 0x79, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x5f, + 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, + 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, + 0x6d, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, + 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, + 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, + 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, + 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, + 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( From 8439bacb809e2b7b9d40db917ade60cf30b6bbb5 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 08:05:48 +0000 Subject: [PATCH 30/38] Fixed SQL syntax --- fleetspeak/src/server/mysql/clientstore.go | 2 +- fleetspeak/src/server/sqlite/clientstore.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 833bb110..0525ee44 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -386,7 +386,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib, "+ - "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib, "+ + "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib "+ "FROM client_resource_usage_records WHERE client_id=? "+ "AND server_timestamp >= ? AND server_timestamp < ?", id.Bytes(), diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index 6fcdb6ed..63f26c04 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -390,8 +390,8 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "SELECT "+ "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ - "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib "+ - "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib, "+ + "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib, "+ + "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib "+ "FROM client_resource_usage_records WHERE client_id=? "+ "AND server_timestamp >= ? AND server_timestamp < ?", id.String(), From abe9c5f51d95b66c4fd8497af51f64bf9eb52d1b Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 08:37:15 +0000 Subject: [PATCH 31/38] Added tests for new RUD fields --- fleetspeak/src/server/dbtesting/clientstore_suite.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fleetspeak/src/server/dbtesting/clientstore_suite.go b/fleetspeak/src/server/dbtesting/clientstore_suite.go index 8c4db5da..0634847a 100644 --- a/fleetspeak/src/server/dbtesting/clientstore_suite.go +++ b/fleetspeak/src/server/dbtesting/clientstore_suite.go @@ -360,6 +360,8 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { } meanRAM, maxRAM := 190, 200 + meanIoReadData, maxIoReadData := 300, 310 + meanIoWriteData, maxIoWriteData := 400, 410 rud := mpb.ResourceUsageData{ Scope: "test-scope", Pid: 1234, @@ -373,6 +375,10 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { MaxSystemCpuRate: 80.0, MeanResidentMemory: float64(meanRAM) * 1024 * 1024, MaxResidentMemory: int64(maxRAM) * 1024 * 1024, + MeanIoRead: float64(meanIoReadData) * 1024 * 1024, + MaxIoRead: int64(maxIoReadData) * 1024 * 1024, + MeanIoWrite: float64(meanIoWriteData) * 1024 * 1024, + MaxIoWrite: int64(maxIoWriteData) * 1024 * 1024, }, } @@ -414,6 +420,10 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { MaxSystemCpuRate: 80.0, MeanResidentMemoryMib: int32(meanRAM), MaxResidentMemoryMib: int32(maxRAM), + MeanIoReadMib: int32(meanIoReadData), + MaxIoReadMib: int32(maxIoReadData), + MeanIoWriteMib: int32(meanIoWriteData), + MaxIoWriteMib: int32(maxIoWriteData), } if got, want := record, expected; !proto.Equal(got, want) { From 86b61248d546c3a835aad3a96ca0f932c123704a Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 11:59:41 +0000 Subject: [PATCH 32/38] Changed variable names IORead to IOReadBytes and IOWrite to IOWriteBytes. --- .../monitoring/resource_usage_fetcher.go | 12 ++++---- .../monitoring/resource_usage_fetcher_unix.go | 12 ++++---- .../monitoring/resource_usage_monitor.go | 28 +++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go index acb73d5a..4f128141 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher.go @@ -40,11 +40,11 @@ type ResourceUsage struct { // Resident set size for a process, in bytes. ResidentMemory int64 - // Client IO data read so far, in bytes. - IORead int64 + // Client IO data read so far. + IOReadBytes int64 - // Client IO data written so far, in bytes. - IOWrite int64 + // Client IO data written so far. + IOWriteBytes int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. @@ -94,8 +94,8 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro UserCPUMillis: times.User * 1e3, SystemCPUMillis: times.System * 1e3, ResidentMemory: int64(memoryInfo.RSS), - IORead: int64(ioCounters.ReadBytes), - IOWrite: int64(ioCounters.WriteBytes), + IOReadBytes: int64(ioCounters.ReadBytes), + IOWriteBytes: int64(ioCounters.WriteBytes), }, nil } diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go index 06879d56..05235009 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_fetcher_unix.go @@ -45,11 +45,11 @@ type ResourceUsage struct { // Resident set size for a process. ResidentMemory int64 - // Client IO data read so far, in bytes. - IORead int64 + // Client IO data read so far. + IOReadBytes int64 - // Client IO data written so far, in bytes. - IOWrite int64 + // Client IO data written so far. + IOWriteBytes int64 } // ResourceUsageFetcher obtains resource-usage data for a process from the OS. @@ -147,8 +147,8 @@ func (f ResourceUsageFetcher) ResourceUsageForPID(pid int) (*ResourceUsage, erro UserCPUMillis: float64((utime + cutime) * 10), // Assume rate of 100 ticks/second SystemCPUMillis: float64((stime + cstime) * 10), // Assume rate of 100 ticks/second ResidentMemory: resident * pageSize, - IORead: int64(ioCounters.ReadBytes), - IOWrite: int64(ioCounters.WriteBytes), + IOReadBytes: int64(ioCounters.ReadBytes), + IOWriteBytes: int64(ioCounters.WriteBytes), }, nil } diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index f69ee123..94b6069b 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -63,10 +63,10 @@ func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUC } aggRU.MeanResidentMemory = float64(currRU.ResidentMemory) / float64(numRUCalls) aggRU.MaxResidentMemory = currRU.ResidentMemory - aggRU.MeanIoRead = float64(currRU.IORead) / float64(numRUCalls) - aggRU.MaxIoRead = currRU.IORead - aggRU.MeanIoWrite = float64(currRU.IOWrite) / float64(numRUCalls) - aggRU.MaxIoWrite = currRU.IOWrite + aggRU.MeanIoRead = float64(currRU.IOReadBytes) / float64(numRUCalls) + aggRU.MaxIoRead = currRU.IOReadBytes + aggRU.MeanIoWrite = float64(currRU.IOWriteBytes) / float64(numRUCalls) + aggRU.MaxIoWrite = currRU.IOWriteBytes return nil } @@ -128,13 +128,13 @@ func aggregateMemoryResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU * } func aggregateIOResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage) error { - aggRU.MeanIoRead += float64(currRU.IORead) / float64(numRUCalls) - if currRU.IORead > aggRU.MaxIoRead { - aggRU.MaxIoRead = currRU.IORead + aggRU.MeanIoRead += float64(currRU.IOReadBytes) / float64(numRUCalls) + if currRU.IOReadBytes > aggRU.MaxIoRead { + aggRU.MaxIoRead = currRU.IOReadBytes } - aggRU.MeanIoWrite += float64(currRU.IOWrite) / float64(numRUCalls) - if currRU.IOWrite > aggRU.MaxIoWrite { - aggRU.MaxIoWrite = currRU.IOWrite + aggRU.MeanIoWrite += float64(currRU.IOWriteBytes) / float64(numRUCalls) + if currRU.IOWriteBytes > aggRU.MaxIoWrite { + aggRU.MaxIoWrite = currRU.IOWriteBytes } return nil } @@ -160,12 +160,12 @@ func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*m aggRU.MaxResidentMemory = initialRU.ResidentMemory } if aggRU.MaxIoRead == 0 { - aggRU.MeanIoRead = float64(initialRU.IORead) - aggRU.MaxIoRead = initialRU.IORead + aggRU.MeanIoRead = float64(initialRU.IOReadBytes) + aggRU.MaxIoRead = initialRU.IOReadBytes } if aggRU.MaxIoWrite == 0 { - aggRU.MeanIoWrite = float64(initialRU.IOWrite) - aggRU.MaxIoWrite = initialRU.IOWrite + aggRU.MeanIoWrite = float64(initialRU.IOWriteBytes) + aggRU.MaxIoWrite = initialRU.IOWriteBytes } return &aggRU, nil From a3f362983377a509f6d3180ba135ea4e5cb4c5fb Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 12:27:55 +0000 Subject: [PATCH 33/38] Added tests for IOReadBytes and IOWriteBytes --- .../internal/monitoring/resource_usage_monitor_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go index efbd8118..3d879358 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go @@ -75,12 +75,16 @@ func TestResourceUsageMonitor(t *testing.T) { UserCPUMillis: 13.0, SystemCPUMillis: 5.0, ResidentMemory: 10000, + IOReadBytes: 40000, + IOWriteBytes: 50000, } fakeRU1 := ResourceUsage{ Timestamp: start.Add(10 * time.Millisecond), UserCPUMillis: 27.0, SystemCPUMillis: 9.0, ResidentMemory: 30000, + IOReadBytes: 80000, + IOWriteBytes: 100000, } ruf := fakeResourceUsageFetcher{} ruf.setResourceUsageData([]ResourceUsage{fakeRU0, fakeRU1}) @@ -123,6 +127,10 @@ func TestResourceUsageMonitor(t *testing.T) { MaxSystemCpuRate: 400.0, MeanResidentMemory: 20000.0, MaxResidentMemory: 30000, + MeanIoRead: 60000.0, + MaxIoRead: 80000, + MeanIoWrite: 75000.0, + MaxIoWrite: 100000, }, DebugStatus: fmt.Sprintf("Fake Debug Status %d", protosReceived), DataTimestamp: got.DataTimestamp, From 784f31cd359474d79846897932927007dd5fcf43 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 12:34:56 +0000 Subject: [PATCH 34/38] Changed new aggregated RUD fields to KiB All the newly added aggregated RUD fields, MeanIoRead, MaxIoRead, MeanIoWrite, MaxIoWrite, were in MiB (similar to Mean/MaxResidentMemory). Those are now changed to KiB instead of MiB. --- fleetspeak/src/server/dbtesting/clientstore_suite.go | 8 ++++---- fleetspeak/src/server/mysql/clientstore.go | 9 +++++---- fleetspeak/src/server/sqlite/clientstore.go | 9 +++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/fleetspeak/src/server/dbtesting/clientstore_suite.go b/fleetspeak/src/server/dbtesting/clientstore_suite.go index 0634847a..5054dc74 100644 --- a/fleetspeak/src/server/dbtesting/clientstore_suite.go +++ b/fleetspeak/src/server/dbtesting/clientstore_suite.go @@ -375,10 +375,10 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { MaxSystemCpuRate: 80.0, MeanResidentMemory: float64(meanRAM) * 1024 * 1024, MaxResidentMemory: int64(maxRAM) * 1024 * 1024, - MeanIoRead: float64(meanIoReadData) * 1024 * 1024, - MaxIoRead: int64(maxIoReadData) * 1024 * 1024, - MeanIoWrite: float64(meanIoWriteData) * 1024 * 1024, - MaxIoWrite: int64(maxIoWriteData) * 1024 * 1024, + MeanIoRead: float64(meanIoReadData) * 1024, + MaxIoRead: int64(maxIoReadData) * 1024, + MeanIoWrite: float64(meanIoWriteData) * 1024, + MaxIoWrite: int64(maxIoWriteData) * 1024, }, } diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 0525ee44..0863ce32 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -35,6 +35,7 @@ import ( ) const ( + bytesToKIB = 1.0 / float64(1<<10) bytesToMIB = 1.0 / float64(1<<20) ) @@ -357,10 +358,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoRead*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoWrite*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToMIB)) + int32(rud.ResourceUsage.MeanIoRead*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToKIB), + int32(rud.ResourceUsage.MeanIoWrite*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToKIB)) return err }) } diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index 63f26c04..0407615a 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -34,6 +34,7 @@ import ( ) const ( + bytesToKIB = 1.0 / float64(1<<10) bytesToMIB = 1.0 / float64(1<<20) ) @@ -361,10 +362,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoRead*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoWrite*bytesToMIB), - int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToMIB)) + int32(rud.ResourceUsage.MeanIoRead*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToKIB), + int32(rud.ResourceUsage.MeanIoWrite*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToKIB)) return err }) } From 7380f3d34b809fc295b0e2305c49a7d8df7c2ab6 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 12:54:28 +0000 Subject: [PATCH 35/38] Variable names changes --- .../monitoring/resource_usage_monitor.go | 32 ++-- .../monitoring/resource_usage_monitor_test.go | 8 +- .../fleetspeak_monitoring/resource.pb.go | 141 +++++++++--------- .../fleetspeak_monitoring/resource.proto | 8 +- .../src/server/dbtesting/clientstore_suite.go | 16 +- fleetspeak/src/server/mysql/clientstore.go | 12 +- fleetspeak/src/server/mysql/mysql.go | 8 +- .../proto/fleetspeak_server/resource.pb.go | 40 ++--- .../proto/fleetspeak_server/resource.proto | 8 +- fleetspeak/src/server/sqlite/clientstore.go | 12 +- fleetspeak/src/server/sqlite/sqlite.go | 8 +- 11 files changed, 148 insertions(+), 145 deletions(-) diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go index 94b6069b..d122b97a 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor.go @@ -63,10 +63,10 @@ func AggregateResourceUsage(prevRU *ResourceUsage, currRU *ResourceUsage, numRUC } aggRU.MeanResidentMemory = float64(currRU.ResidentMemory) / float64(numRUCalls) aggRU.MaxResidentMemory = currRU.ResidentMemory - aggRU.MeanIoRead = float64(currRU.IOReadBytes) / float64(numRUCalls) - aggRU.MaxIoRead = currRU.IOReadBytes - aggRU.MeanIoWrite = float64(currRU.IOWriteBytes) / float64(numRUCalls) - aggRU.MaxIoWrite = currRU.IOWriteBytes + aggRU.MeanIoReadBytes = float64(currRU.IOReadBytes) / float64(numRUCalls) + aggRU.MaxIoReadBytes = currRU.IOReadBytes + aggRU.MeanIoWriteBytes = float64(currRU.IOWriteBytes) / float64(numRUCalls) + aggRU.MaxIoWriteBytes = currRU.IOWriteBytes return nil } @@ -128,13 +128,13 @@ func aggregateMemoryResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU * } func aggregateIOResourceUsage(currRU *ResourceUsage, numRUCalls int, aggRU *mpb.AggregatedResourceUsage) error { - aggRU.MeanIoRead += float64(currRU.IOReadBytes) / float64(numRUCalls) - if currRU.IOReadBytes > aggRU.MaxIoRead { - aggRU.MaxIoRead = currRU.IOReadBytes + aggRU.MeanIoReadBytes += float64(currRU.IOReadBytes) / float64(numRUCalls) + if currRU.IOReadBytes > aggRU.MaxIoReadBytes { + aggRU.MaxIoReadBytes = currRU.IOReadBytes } - aggRU.MeanIoWrite += float64(currRU.IOWriteBytes) / float64(numRUCalls) - if currRU.IOWriteBytes > aggRU.MaxIoWrite { - aggRU.MaxIoWrite = currRU.IOWriteBytes + aggRU.MeanIoWriteBytes += float64(currRU.IOWriteBytes) / float64(numRUCalls) + if currRU.IOWriteBytes > aggRU.MaxIoWriteBytes { + aggRU.MaxIoWriteBytes = currRU.IOWriteBytes } return nil } @@ -159,13 +159,13 @@ func AggregateResourceUsageForFinishedCmd(initialRU, finalRU *ResourceUsage) (*m aggRU.MeanResidentMemory = float64(initialRU.ResidentMemory) aggRU.MaxResidentMemory = initialRU.ResidentMemory } - if aggRU.MaxIoRead == 0 { - aggRU.MeanIoRead = float64(initialRU.IOReadBytes) - aggRU.MaxIoRead = initialRU.IOReadBytes + if aggRU.MaxIoReadBytes == 0 { + aggRU.MeanIoReadBytes = float64(initialRU.IOReadBytes) + aggRU.MaxIoReadBytes = initialRU.IOReadBytes } - if aggRU.MaxIoWrite == 0 { - aggRU.MeanIoWrite = float64(initialRU.IOWriteBytes) - aggRU.MaxIoWrite = initialRU.IOWriteBytes + if aggRU.MaxIoWriteBytes == 0 { + aggRU.MeanIoWriteBytes = float64(initialRU.IOWriteBytes) + aggRU.MaxIoWriteBytes = initialRU.IOWriteBytes } return &aggRU, nil diff --git a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go index 3d879358..76282661 100644 --- a/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go +++ b/fleetspeak/src/client/internal/monitoring/resource_usage_monitor_test.go @@ -127,10 +127,10 @@ func TestResourceUsageMonitor(t *testing.T) { MaxSystemCpuRate: 400.0, MeanResidentMemory: 20000.0, MaxResidentMemory: 30000, - MeanIoRead: 60000.0, - MaxIoRead: 80000, - MeanIoWrite: 75000.0, - MaxIoWrite: 100000, + MeanIoReadBytes: 60000.0, + MaxIoReadBytes: 80000, + MeanIoWriteBytes: 75000.0, + MaxIoWriteBytes: 100000, }, DebugStatus: fmt.Sprintf("Fake Debug Status %d", protosReceived), DataTimestamp: got.DataTimestamp, diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go index 06d9dd65..b803dc28 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.pb.go @@ -89,10 +89,10 @@ type AggregatedResourceUsage struct { MaxSystemCpuRate float64 `protobuf:"fixed64,4,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemory float64 `protobuf:"fixed64,5,opt,name=mean_resident_memory,json=meanResidentMemory,proto3" json:"mean_resident_memory,omitempty"` MaxResidentMemory int64 `protobuf:"varint,6,opt,name=max_resident_memory,json=maxResidentMemory,proto3" json:"max_resident_memory,omitempty"` - MeanIoRead float64 `protobuf:"fixed64,7,opt,name=mean_io_read,json=meanIoRead,proto3" json:"mean_io_read,omitempty"` - MaxIoRead int64 `protobuf:"varint,8,opt,name=max_io_read,json=maxIoRead,proto3" json:"max_io_read,omitempty"` - MeanIoWrite float64 `protobuf:"fixed64,9,opt,name=mean_io_write,json=meanIoWrite,proto3" json:"mean_io_write,omitempty"` - MaxIoWrite int64 `protobuf:"varint,10,opt,name=max_io_write,json=maxIoWrite,proto3" json:"max_io_write,omitempty"` + MeanIoReadBytes float64 `protobuf:"fixed64,7,opt,name=mean_io_read_bytes,json=meanIoReadBytes,proto3" json:"mean_io_read_bytes,omitempty"` + MaxIoReadBytes int64 `protobuf:"varint,8,opt,name=max_io_read_bytes,json=maxIoReadBytes,proto3" json:"max_io_read_bytes,omitempty"` + MeanIoWriteBytes float64 `protobuf:"fixed64,9,opt,name=mean_io_write_bytes,json=meanIoWriteBytes,proto3" json:"mean_io_write_bytes,omitempty"` + MaxIoWriteBytes int64 `protobuf:"varint,10,opt,name=max_io_write_bytes,json=maxIoWriteBytes,proto3" json:"max_io_write_bytes,omitempty"` } func (x *AggregatedResourceUsage) Reset() { @@ -169,30 +169,30 @@ func (x *AggregatedResourceUsage) GetMaxResidentMemory() int64 { return 0 } -func (x *AggregatedResourceUsage) GetMeanIoRead() float64 { +func (x *AggregatedResourceUsage) GetMeanIoReadBytes() float64 { if x != nil { - return x.MeanIoRead + return x.MeanIoReadBytes } return 0 } -func (x *AggregatedResourceUsage) GetMaxIoRead() int64 { +func (x *AggregatedResourceUsage) GetMaxIoReadBytes() int64 { if x != nil { - return x.MaxIoRead + return x.MaxIoReadBytes } return 0 } -func (x *AggregatedResourceUsage) GetMeanIoWrite() float64 { +func (x *AggregatedResourceUsage) GetMeanIoWriteBytes() float64 { if x != nil { - return x.MeanIoWrite + return x.MeanIoWriteBytes } return 0 } -func (x *AggregatedResourceUsage) GetMaxIoWrite() int64 { +func (x *AggregatedResourceUsage) GetMaxIoWriteBytes() int64 { if x != nil { - return x.MaxIoWrite + return x.MaxIoWriteBytes } return 0 } @@ -416,7 +416,7 @@ var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDes 0x74, 0x6f, 0x12, 0x15, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x03, 0x0a, 0x17, 0x41, + 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe7, 0x03, 0x0a, 0x17, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, @@ -436,63 +436,66 @@ var file_fleetspeak_src_common_proto_fleetspeak_monitoring_resource_proto_rawDes 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, - 0x61, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, - 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, - 0x61, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x6d, 0x65, 0x61, 0x6e, 0x49, - 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, - 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x61, - 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, + 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x6d, 0x65, + 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, + 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, + 0x65, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x13, 0x6d, 0x65, 0x61, 0x6e, + 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x69, + 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, + 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x12, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x64, 0x61, 0x74, 0x61, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, + 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, + 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x11, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, + 0x65, 0x64, 0x22, 0xee, 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, + 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, + 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, 0x69, 0x6c, 0x6c, 0x65, + 0x64, 0x5f, 0x77, 0x68, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, - 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x61, - 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, - 0x64, 0x61, 0x74, 0x61, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x55, 0x0a, - 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, - 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, - 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, - 0x73, 0x73, 0x5f, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x54, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x61, 0x74, 0x65, 0x64, 0x22, 0xee, 0x02, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, - 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x48, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, - 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6b, - 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x77, 0x68, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, - 0x6c, 0x6c, 0x65, 0x64, 0x57, 0x68, 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, - 0x73, 0x70, 0x65, 0x61, 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, - 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x22, 0x45, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, - 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, - 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, - 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6b, 0x69, 0x6c, 0x6c, 0x65, 0x64, + 0x57, 0x68, 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x70, 0x65, 0x61, + 0x6b, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x4b, 0x69, 0x6c, + 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x06, + 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x48, 0x45, 0x41, 0x52, 0x54, + 0x42, 0x45, 0x41, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x12, 0x13, + 0x0a, 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, + 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto index c74bc7dd..58d85bbb 100644 --- a/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto +++ b/fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto @@ -14,10 +14,10 @@ message AggregatedResourceUsage { double max_system_cpu_rate = 4; double mean_resident_memory = 5; int64 max_resident_memory = 6; - double mean_io_read = 7; - int64 max_io_read = 8; - double mean_io_write = 9; - int64 max_io_write = 10; + double mean_io_read_bytes = 7; + int64 max_io_read_bytes = 8; + double mean_io_write_bytes = 9; + int64 max_io_write_bytes = 10; } // A fleetspeak.Message with message type "ResourceUsage" is sent regularly by diff --git a/fleetspeak/src/server/dbtesting/clientstore_suite.go b/fleetspeak/src/server/dbtesting/clientstore_suite.go index 5054dc74..fba3e562 100644 --- a/fleetspeak/src/server/dbtesting/clientstore_suite.go +++ b/fleetspeak/src/server/dbtesting/clientstore_suite.go @@ -375,10 +375,10 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { MaxSystemCpuRate: 80.0, MeanResidentMemory: float64(meanRAM) * 1024 * 1024, MaxResidentMemory: int64(maxRAM) * 1024 * 1024, - MeanIoRead: float64(meanIoReadData) * 1024, - MaxIoRead: int64(maxIoReadData) * 1024, - MeanIoWrite: float64(meanIoWriteData) * 1024, - MaxIoWrite: int64(maxIoWriteData) * 1024, + MeanIoReadBytes: float64(meanIoReadData) * 1024, + MaxIoReadBytes: int64(maxIoReadData) * 1024, + MeanIoWriteBytes: float64(meanIoWriteData) * 1024, + MaxIoWriteBytes: int64(maxIoWriteData) * 1024, }, } @@ -420,10 +420,10 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { MaxSystemCpuRate: 80.0, MeanResidentMemoryMib: int32(meanRAM), MaxResidentMemoryMib: int32(maxRAM), - MeanIoReadMib: int32(meanIoReadData), - MaxIoReadMib: int32(maxIoReadData), - MeanIoWriteMib: int32(meanIoWriteData), - MaxIoWriteMib: int32(maxIoWriteData), + MeanIoReadKib: int32(meanIoReadData), + MaxIoReadKib: int32(maxIoReadData), + MeanIoWriteKib: int32(meanIoWriteData), + MaxIoWriteKib: int32(maxIoWriteData), } if got, want := record, expected; !proto.Equal(got, want) { diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index 0863ce32..c7998a2c 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -358,10 +358,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoRead*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToKIB), - int32(rud.ResourceUsage.MeanIoWrite*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToKIB)) + int32(rud.ResourceUsage.MeanIoReadBytes*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoReadBytes)*bytesToKIB), + int32(rud.ResourceUsage.MeanIoWriteBytes*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoWriteBytes)*bytesToKIB)) return err }) } @@ -387,7 +387,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib, "+ - "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib "+ + "mean_io_read_kib, max_io_read_kib, mean_io_write_kib, max_io_write_kib "+ "FROM client_resource_usage_records WHERE client_id=? "+ "AND server_timestamp >= ? AND server_timestamp < ?", id.Bytes(), @@ -407,7 +407,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli &record.Scope, &record.Pid, &processStartTime, &clientTimestamp, &serverTimestamp, &record.ProcessTerminated, &record.MeanUserCpuRate, &record.MaxUserCpuRate, &record.MeanSystemCpuRate, &record.MaxSystemCpuRate, &record.MeanResidentMemoryMib, &record.MaxResidentMemoryMib, - &record.MeanIoReadMib, &record.MaxIoReadMib, &record.MeanIoWriteMib, &record.MaxIoWriteMib) + &record.MeanIoReadKib, &record.MaxIoReadKib, &record.MeanIoWriteKib, &record.MaxIoWriteKib) if err != nil { return err diff --git a/fleetspeak/src/server/mysql/mysql.go b/fleetspeak/src/server/mysql/mysql.go index 508dce07..95236927 100644 --- a/fleetspeak/src/server/mysql/mysql.go +++ b/fleetspeak/src/server/mysql/mysql.go @@ -154,10 +154,10 @@ mean_system_cpu_rate REAL, max_system_cpu_rate REAL, mean_resident_memory_mib INT4, max_resident_memory_mib INT4, -mean_io_read_mib INT4, -max_io_read_mib INT4, -mean_io_write_mib INT4, -max_io_write_mib INT4, +mean_io_read_kib INT8, +max_io_read_kib INT8, +mean_io_write_kib INT8, +max_io_write_kib INT8, FOREIGN KEY (client_id) REFERENCES clients(client_id))`, `CREATE TABLE IF NOT EXISTS messages( message_id BINARY(32) NOT NULL, diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go index 38e2074c..8b4f775c 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go @@ -53,10 +53,10 @@ type ClientResourceUsageRecord struct { MaxSystemCpuRate float32 `protobuf:"fixed32,9,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemoryMib int32 `protobuf:"varint,10,opt,name=mean_resident_memory_mib,json=meanResidentMemoryMib,proto3" json:"mean_resident_memory_mib,omitempty"` MaxResidentMemoryMib int32 `protobuf:"varint,11,opt,name=max_resident_memory_mib,json=maxResidentMemoryMib,proto3" json:"max_resident_memory_mib,omitempty"` - MeanIoReadMib int32 `protobuf:"varint,13,opt,name=mean_io_read_mib,json=meanIoReadMib,proto3" json:"mean_io_read_mib,omitempty"` - MaxIoReadMib int32 `protobuf:"varint,14,opt,name=max_io_read_mib,json=maxIoReadMib,proto3" json:"max_io_read_mib,omitempty"` - MeanIoWriteMib int32 `protobuf:"varint,15,opt,name=mean_io_write_mib,json=meanIoWriteMib,proto3" json:"mean_io_write_mib,omitempty"` - MaxIoWriteMib int32 `protobuf:"varint,16,opt,name=max_io_write_mib,json=maxIoWriteMib,proto3" json:"max_io_write_mib,omitempty"` + MeanIoReadKib int32 `protobuf:"varint,13,opt,name=mean_io_read_kib,json=meanIoReadKib,proto3" json:"mean_io_read_kib,omitempty"` + MaxIoReadKib int32 `protobuf:"varint,14,opt,name=max_io_read_kib,json=maxIoReadKib,proto3" json:"max_io_read_kib,omitempty"` + MeanIoWriteKib int32 `protobuf:"varint,15,opt,name=mean_io_write_kib,json=meanIoWriteKib,proto3" json:"mean_io_write_kib,omitempty"` + MaxIoWriteKib int32 `protobuf:"varint,16,opt,name=max_io_write_kib,json=maxIoWriteKib,proto3" json:"max_io_write_kib,omitempty"` } func (x *ClientResourceUsageRecord) Reset() { @@ -175,30 +175,30 @@ func (x *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { return 0 } -func (x *ClientResourceUsageRecord) GetMeanIoReadMib() int32 { +func (x *ClientResourceUsageRecord) GetMeanIoReadKib() int32 { if x != nil { - return x.MeanIoReadMib + return x.MeanIoReadKib } return 0 } -func (x *ClientResourceUsageRecord) GetMaxIoReadMib() int32 { +func (x *ClientResourceUsageRecord) GetMaxIoReadKib() int32 { if x != nil { - return x.MaxIoReadMib + return x.MaxIoReadKib } return 0 } -func (x *ClientResourceUsageRecord) GetMeanIoWriteMib() int32 { +func (x *ClientResourceUsageRecord) GetMeanIoWriteKib() int32 { if x != nil { - return x.MeanIoWriteMib + return x.MeanIoWriteKib } return 0 } -func (x *ClientResourceUsageRecord) GetMaxIoWriteMib() int32 { +func (x *ClientResourceUsageRecord) GetMaxIoWriteKib() int32 { if x != nil { - return x.MaxIoWriteMib + return x.MaxIoWriteKib } return 0 } @@ -253,16 +253,16 @@ var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x5f, - 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, + 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4b, 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, - 0x6d, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, - 0x52, 0x65, 0x61, 0x64, 0x4d, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, - 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, + 0x6b, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, + 0x52, 0x65, 0x61, 0x64, 0x4b, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, + 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4b, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x5f, 0x6d, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, - 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x65, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, + 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4b, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto index 7a2df106..e98f5fb9 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto @@ -34,8 +34,8 @@ message ClientResourceUsageRecord { int32 mean_resident_memory_mib = 10; int32 max_resident_memory_mib = 11; - int32 mean_io_read_mib = 13; - int32 max_io_read_mib = 14; - int32 mean_io_write_mib = 15; - int32 max_io_write_mib = 16; + int32 mean_io_read_kib = 13; + int32 max_io_read_kib = 14; + int32 mean_io_write_kib = 15; + int32 max_io_write_kib = 16; } diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index 0407615a..eb0e78ef 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -362,10 +362,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoRead*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoRead)*bytesToKIB), - int32(rud.ResourceUsage.MeanIoWrite*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoWrite)*bytesToKIB)) + int32(rud.ResourceUsage.MeanIoReadBytes*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoReadBytes)*bytesToKIB), + int32(rud.ResourceUsage.MeanIoWriteBytes*bytesToKIB), + int32(float64(rud.ResourceUsage.MaxIoWriteBytes)*bytesToKIB)) return err }) } @@ -392,7 +392,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli "scope, pid, process_start_time, client_timestamp, server_timestamp, "+ "process_terminated, mean_user_cpu_rate, max_user_cpu_rate, mean_system_cpu_rate, "+ "max_system_cpu_rate, mean_resident_memory_mib, max_resident_memory_mib, "+ - "mean_io_read_mib, max_io_read_mib, mean_io_write_mib, max_io_write_mib "+ + "mean_io_read_kib, max_io_read_kib, mean_io_write_kib, max_io_write_kib "+ "FROM client_resource_usage_records WHERE client_id=? "+ "AND server_timestamp >= ? AND server_timestamp < ?", id.String(), @@ -412,7 +412,7 @@ func (d *Datastore) FetchResourceUsageRecords(ctx context.Context, id common.Cli &record.Scope, &record.Pid, &processStartTime, &clientTimestamp, &serverTimestamp, &record.ProcessTerminated, &record.MeanUserCpuRate, &record.MaxUserCpuRate, &record.MeanSystemCpuRate, &record.MaxSystemCpuRate, &record.MeanResidentMemoryMib, &record.MaxResidentMemoryMib, - &record.MeanIoReadMib, &record.MaxIoReadMib, &record.MeanIoWriteMib, &record.MaxIoWriteMib) + &record.MeanIoReadKib, &record.MaxIoReadKib, &record.MeanIoWriteKib, &record.MaxIoWriteKib) if err != nil { return err diff --git a/fleetspeak/src/server/sqlite/sqlite.go b/fleetspeak/src/server/sqlite/sqlite.go index e6c9141b..6eebe829 100644 --- a/fleetspeak/src/server/sqlite/sqlite.go +++ b/fleetspeak/src/server/sqlite/sqlite.go @@ -135,10 +135,10 @@ mean_system_cpu_rate REAL, max_system_cpu_rate REAL, mean_resident_memory_mib INT4, max_resident_memory_mib INT4, -mean_io_read_mib INT4, -max_io_read_mib INT4, -mean_io_write_mib INT4, -max_io_write_mib INT4, +mean_io_read_kib INT8, +max_io_read_kib INT8, +mean_io_write_kib INT8, +max_io_write_kib INT8, FOREIGN KEY (client_id) REFERENCES clients(client_id))`, `CREATE TABLE IF NOT EXISTS messages( message_id TEXT(64) NOT NULL, From a569f613a7a3622b3e8a0010d4cf1b203e7468f0 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 13:01:29 +0000 Subject: [PATCH 36/38] Changed proto field types from int32 to int64 --- .../src/server/dbtesting/clientstore_suite.go | 8 +++---- .../proto/fleetspeak_server/resource.pb.go | 24 +++++++++---------- .../proto/fleetspeak_server/resource.proto | 8 +++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/fleetspeak/src/server/dbtesting/clientstore_suite.go b/fleetspeak/src/server/dbtesting/clientstore_suite.go index fba3e562..16e10372 100644 --- a/fleetspeak/src/server/dbtesting/clientstore_suite.go +++ b/fleetspeak/src/server/dbtesting/clientstore_suite.go @@ -420,10 +420,10 @@ func fetchResourceUsageRecordsTest(t *testing.T, ds db.Store) { MaxSystemCpuRate: 80.0, MeanResidentMemoryMib: int32(meanRAM), MaxResidentMemoryMib: int32(maxRAM), - MeanIoReadKib: int32(meanIoReadData), - MaxIoReadKib: int32(maxIoReadData), - MeanIoWriteKib: int32(meanIoWriteData), - MaxIoWriteKib: int32(maxIoWriteData), + MeanIoReadKib: int64(meanIoReadData), + MaxIoReadKib: int64(maxIoReadData), + MeanIoWriteKib: int64(meanIoWriteData), + MaxIoWriteKib: int64(maxIoWriteData), } if got, want := record, expected; !proto.Equal(got, want) { diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go index 8b4f775c..e7ef2b33 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.pb.go @@ -53,10 +53,10 @@ type ClientResourceUsageRecord struct { MaxSystemCpuRate float32 `protobuf:"fixed32,9,opt,name=max_system_cpu_rate,json=maxSystemCpuRate,proto3" json:"max_system_cpu_rate,omitempty"` MeanResidentMemoryMib int32 `protobuf:"varint,10,opt,name=mean_resident_memory_mib,json=meanResidentMemoryMib,proto3" json:"mean_resident_memory_mib,omitempty"` MaxResidentMemoryMib int32 `protobuf:"varint,11,opt,name=max_resident_memory_mib,json=maxResidentMemoryMib,proto3" json:"max_resident_memory_mib,omitempty"` - MeanIoReadKib int32 `protobuf:"varint,13,opt,name=mean_io_read_kib,json=meanIoReadKib,proto3" json:"mean_io_read_kib,omitempty"` - MaxIoReadKib int32 `protobuf:"varint,14,opt,name=max_io_read_kib,json=maxIoReadKib,proto3" json:"max_io_read_kib,omitempty"` - MeanIoWriteKib int32 `protobuf:"varint,15,opt,name=mean_io_write_kib,json=meanIoWriteKib,proto3" json:"mean_io_write_kib,omitempty"` - MaxIoWriteKib int32 `protobuf:"varint,16,opt,name=max_io_write_kib,json=maxIoWriteKib,proto3" json:"max_io_write_kib,omitempty"` + MeanIoReadKib int64 `protobuf:"varint,13,opt,name=mean_io_read_kib,json=meanIoReadKib,proto3" json:"mean_io_read_kib,omitempty"` + MaxIoReadKib int64 `protobuf:"varint,14,opt,name=max_io_read_kib,json=maxIoReadKib,proto3" json:"max_io_read_kib,omitempty"` + MeanIoWriteKib int64 `protobuf:"varint,15,opt,name=mean_io_write_kib,json=meanIoWriteKib,proto3" json:"mean_io_write_kib,omitempty"` + MaxIoWriteKib int64 `protobuf:"varint,16,opt,name=max_io_write_kib,json=maxIoWriteKib,proto3" json:"max_io_write_kib,omitempty"` } func (x *ClientResourceUsageRecord) Reset() { @@ -175,28 +175,28 @@ func (x *ClientResourceUsageRecord) GetMaxResidentMemoryMib() int32 { return 0 } -func (x *ClientResourceUsageRecord) GetMeanIoReadKib() int32 { +func (x *ClientResourceUsageRecord) GetMeanIoReadKib() int64 { if x != nil { return x.MeanIoReadKib } return 0 } -func (x *ClientResourceUsageRecord) GetMaxIoReadKib() int32 { +func (x *ClientResourceUsageRecord) GetMaxIoReadKib() int64 { if x != nil { return x.MaxIoReadKib } return 0 } -func (x *ClientResourceUsageRecord) GetMeanIoWriteKib() int32 { +func (x *ClientResourceUsageRecord) GetMeanIoWriteKib() int64 { if x != nil { return x.MeanIoWriteKib } return 0 } -func (x *ClientResourceUsageRecord) GetMaxIoWriteKib() int32 { +func (x *ClientResourceUsageRecord) GetMaxIoWriteKib() int64 { if x != nil { return x.MaxIoWriteKib } @@ -254,14 +254,14 @@ var file_fleetspeak_src_server_proto_fleetspeak_server_resource_proto_rawDesc = 0x05, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x4d, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4b, 0x69, 0x62, + 0x03, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4b, 0x69, 0x62, 0x12, 0x25, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, - 0x6b, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, + 0x6b, 0x69, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x4b, 0x69, 0x62, 0x12, 0x29, 0x0a, 0x11, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4b, + 0x28, 0x03, 0x52, 0x0e, 0x6d, 0x65, 0x61, 0x6e, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4b, 0x69, 0x62, 0x12, 0x27, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6f, 0x5f, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, + 0x74, 0x65, 0x5f, 0x6b, 0x69, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x6f, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4b, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto index e98f5fb9..8165dd44 100644 --- a/fleetspeak/src/server/proto/fleetspeak_server/resource.proto +++ b/fleetspeak/src/server/proto/fleetspeak_server/resource.proto @@ -34,8 +34,8 @@ message ClientResourceUsageRecord { int32 mean_resident_memory_mib = 10; int32 max_resident_memory_mib = 11; - int32 mean_io_read_kib = 13; - int32 max_io_read_kib = 14; - int32 mean_io_write_kib = 15; - int32 max_io_write_kib = 16; + int64 mean_io_read_kib = 13; + int64 max_io_read_kib = 14; + int64 mean_io_write_kib = 15; + int64 max_io_write_kib = 16; } From bbb716a2b92f8a64f2acbfc4e43f19383e804628 Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 14:47:34 +0000 Subject: [PATCH 37/38] Round up to nearest integer and use 'int64' --- fleetspeak/src/server/mysql/clientstore.go | 9 +++++---- fleetspeak/src/server/sqlite/clientstore.go | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fleetspeak/src/server/mysql/clientstore.go b/fleetspeak/src/server/mysql/clientstore.go index c7998a2c..91bd3aa1 100644 --- a/fleetspeak/src/server/mysql/clientstore.go +++ b/fleetspeak/src/server/mysql/clientstore.go @@ -19,6 +19,7 @@ import ( "database/sql" "encoding/binary" "fmt" + "math" "strconv" "time" @@ -358,10 +359,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoReadBytes*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoReadBytes)*bytesToKIB), - int32(rud.ResourceUsage.MeanIoWriteBytes*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoWriteBytes)*bytesToKIB)) + int64(math.Ceil(rud.ResourceUsage.MeanIoReadBytes*bytesToKIB)), + int64(math.Ceil(float64(rud.ResourceUsage.MaxIoReadBytes)*bytesToKIB)), + int64(math.Ceil(rud.ResourceUsage.MeanIoWriteBytes*bytesToKIB)), + int64(math.Ceil(float64(rud.ResourceUsage.MaxIoWriteBytes)*bytesToKIB))) return err }) } diff --git a/fleetspeak/src/server/sqlite/clientstore.go b/fleetspeak/src/server/sqlite/clientstore.go index eb0e78ef..dea08146 100644 --- a/fleetspeak/src/server/sqlite/clientstore.go +++ b/fleetspeak/src/server/sqlite/clientstore.go @@ -18,6 +18,7 @@ import ( "context" "database/sql" "fmt" + "math" "strconv" "time" @@ -362,10 +363,10 @@ func (d *Datastore) RecordResourceUsageData(ctx context.Context, id common.Clien rud.ResourceUsage.MaxSystemCpuRate, int32(rud.ResourceUsage.MeanResidentMemory*bytesToMIB), int32(float64(rud.ResourceUsage.MaxResidentMemory)*bytesToMIB), - int32(rud.ResourceUsage.MeanIoReadBytes*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoReadBytes)*bytesToKIB), - int32(rud.ResourceUsage.MeanIoWriteBytes*bytesToKIB), - int32(float64(rud.ResourceUsage.MaxIoWriteBytes)*bytesToKIB)) + int64(math.Ceil(rud.ResourceUsage.MeanIoReadBytes*bytesToKIB)), + int64(math.Ceil(float64(rud.ResourceUsage.MaxIoReadBytes)*bytesToKIB)), + int64(math.Ceil(rud.ResourceUsage.MeanIoWriteBytes*bytesToKIB)), + int64(math.Ceil(float64(rud.ResourceUsage.MaxIoWriteBytes)*bytesToKIB))) return err }) } From c946d31e3d9104a4065a5a6487cf9c4eb8ac1f3d Mon Sep 17 00:00:00 2001 From: Gilad Tsehori Date: Wed, 23 Sep 2020 14:53:21 +0000 Subject: [PATCH 38/38] Trigger Travis CI