diff --git a/src/paradigm-ehb.CommandCenter.Core/Factories/AgentClientFactory.cs b/src/paradigm-ehb.CommandCenter.Core/Factories/AgentClientFactory.cs index b191440..9b2ea81 100644 --- a/src/paradigm-ehb.CommandCenter.Core/Factories/AgentClientFactory.cs +++ b/src/paradigm-ehb.CommandCenter.Core/Factories/AgentClientFactory.cs @@ -10,8 +10,8 @@ using paradigm_ehb.CommandCenter.Core.Interfaces; using paradigm_ehb.CommandCenter.Core.Models; using paradigm_ehb.CommandCenter.Core.Services; -using Resources.V1; -using Services.V2; +using Resources.V2; +using Services.V3; namespace paradigm_ehb.CommandCenter.Core.Factories { diff --git a/src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs b/src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs index 4c5fe1d..11dec64 100644 --- a/src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs +++ b/src/paradigm-ehb.CommandCenter.Core/Models/AgentClient.cs @@ -3,8 +3,8 @@ using System; using paradigm_ehb.CommandCenter.Core.Services; using Journal.V1; -using Services.V2; -using Resources.V1; +using Services.V3; +using Resources.V2; namespace paradigm_ehb.CommandCenter.Core.Models { diff --git a/src/paradigm-ehb.CommandCenter.Core/Protos/Resources/V2/resources.proto b/src/paradigm-ehb.CommandCenter.Core/Protos/Resources/V2/resources.proto new file mode 100644 index 0000000..8508ae9 --- /dev/null +++ b/src/paradigm-ehb.CommandCenter.Core/Protos/Resources/V2/resources.proto @@ -0,0 +1,121 @@ +syntax = "proto3"; + +package resources.v2; + + +service ResourcesService { + rpc GetSystemResources(GetSystemResourcesRequest) + returns (GetSystemResourcesResponse); + rpc ProcessAction(ProcessActionRequest) + returns (ProcessActionReply); +} + +message GetSystemResourcesRequest {} + +message GetSystemResourcesResponse { + SystemResources resources = 1; +} + +/** + * + * Get a complete system snapshots + * @return Cpu, Memory, Device, Disk ( partitions ) and processes + * + * */ +message SystemResources { + Cpu cpu = 1; + Memory memory = 2; + Device device = 3; + repeated Disk disks = 4; + repeated Process processes = 5; +} + +/** + * Cpu information + * + * @return vendor, model, frequency, cores + * */ +message Cpu { + string vendor = 1; + string model = 2; + string frequency = 3; + uint32 max_core = 4; + uint64 total_time = 5; + uint64 idle_time = 6; +} + +/** + * Memory + * @return total memory on system, available memory on system + * */ +message Memory { + string total = 1; + string free = 2; +} + +/** + * Device specific information + * @return os version ( distro information ), and uptime in string format + * + * */ + +message Device { + string os_version = 1; + string uptime = 2; +} + +/** + * + * Disk information + * @disk a list of all available partitions + * + * */ + +message Disk { + repeated DiskPartition partitions = 1; +} + +/** + * Partition + * @return partition name, major, minor, blocks + * */ +message DiskPartition { + string name = 1; + uint32 major = 2; + uint32 minor = 3; + uint64 blocks = 4; +} + +enum ProcessState { + PROCESS_STATE_UNSPECIFIED = 0; + PROCESS_STATE_RUNNING = 1; + PROCESS_STATE_SLEEPING = 2; + PROCESS_STATE_DISK_SLEEPING = 3; + PROCESS_STATE_STOPPED = 4; + PROCESS_STATE_TRACING_STOPPED = 5; + PROCESS_STATE_ZOMBIE = 6; + PROCESS_STATE_DEAD = 7; + PROCESS_STATE_IDLE = 8; + PROCESS_STATE_UNDEFINED = 9; +} + +/** + * Process information + * @return pid ( process identifier ), process name, the state, todo :) + * */ +message Process { + int32 pid = 1; + string name = 2; + ProcessState state = 3; + uint64 utime = 4; + uint32 num_threads = 5; +} + +message ProcessActionRequest { + int32 pid = 1; + int32 signal = 2; +} + +message ProcessActionReply { + bool succes = 1; +} \ No newline at end of file diff --git a/src/paradigm-ehb.CommandCenter.Core/Protos/Services/V3/services.proto b/src/paradigm-ehb.CommandCenter.Core/Protos/Services/V3/services.proto new file mode 100644 index 0000000..e4822af --- /dev/null +++ b/src/paradigm-ehb.CommandCenter.Core/Protos/Services/V3/services.proto @@ -0,0 +1,122 @@ +syntax = "proto3"; + +package services.v3; + + +service HandlerService { + rpc PerformUnitAction (UnitActionRequest) returns (UnitActionReply); + rpc PerformUnitFileAction (UnitFileActionRequest) returns (UnitFileActionReply); + rpc GetAllUnits (GetUnitsRequest) returns (GetUnitsReply); + rpc GetLoadedUnits (GetUnitsRequest) returns (GetUnitsReply); + rpc GetFilteredUnits (GetUnitsFilteredRequest) returns (GetUnitsReply); + rpc GetUnitStatus (GetUnitStatusRequest) returns (GetUnitStatusReply); +} + + +message UnitActionRequest { + string unit_name = 1; + + enum UnitAction { + UNIT_ACTION_UNSPECIFIED = 0; + UNIT_ACTION_START = 1; + UNIT_ACTION_STOP = 2; + UNIT_ACTION_RESTART = 3; + } + + UnitAction action = 2; + bool force = 3; +} + +message UnitActionReply { + bytes status = 1; + bool success = 2; + string error_message = 3; +} + + +message UnitFileActionRequest { + string unit_name = 1; + + enum UnitFileAction { + UNIT_FILE_ACTION_UNSPECIFIED = 0; + UNIT_FILE_ACTION_ENABLE = 1; + UNIT_FILE_ACTION_DISABLE = 2; + } + + UnitFileAction action = 2; + bool runtime = 3; + bool force = 4; +} + +message UnitFileActionReply { + bytes status = 1; + bool success = 2; + string error_message = 3; +} + + +message LoadedUnit { + string name = 1; + string description = 2; + string load_state = 3; + string sub_state = 4; + string active_state = 5; + string dep_unit = 6; + + string object_path = 7; + + uint32 queued_job = 8; + string job_type = 9; + string job_path = 10; +} + +message Unit { + string name = 1; + string state = 2; +} + + +message GetUnitsRequest { + + enum UnitState { + UNIT_STATE_UNSPECIFIED = 0; + ENABLED = 1; + DISABLED = 2; + } + + string name = 1; + UnitState state = 2; +} + +message GetUnitsFilteredRequest { + + enum UnitFileState { + + UNIT_FILE_STATE_UNSPECIFIED = 0; + LOADED = 1; + NOT_FOUND = 2; + BAD_SETTING = 3; + ERROR = 4; + MASKED = 5; + } + + repeated UnitFileState filters = 1; + +} + +message GetUnitsReply { + repeated LoadedUnit units = 1; + bool success = 2; + string error_message = 3; +} + + +message GetUnitStatusRequest { + string unit_name = 1; +} + +message GetUnitStatusReply { + string state = 1; + bool success = 2; + string error_message = 3; +} \ No newline at end of file diff --git a/src/paradigm-ehb.CommandCenter.Core/paradigm-ehb.CommandCenter.Core.csproj b/src/paradigm-ehb.CommandCenter.Core/paradigm-ehb.CommandCenter.Core.csproj index 9c527a5..243b060 100644 --- a/src/paradigm-ehb.CommandCenter.Core/paradigm-ehb.CommandCenter.Core.csproj +++ b/src/paradigm-ehb.CommandCenter.Core/paradigm-ehb.CommandCenter.Core.csproj @@ -26,8 +26,10 @@ + + diff --git a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/ServerMainPage.xaml b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/ServerMainPage.xaml index f18a832..cb5fb04 100644 --- a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/ServerMainPage.xaml +++ b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/ServerMainPage.xaml @@ -42,14 +42,14 @@ - + + Text="Processes" Icon="ViewAll"/> diff --git a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml index 1ed8159..cbc3ec6 100644 --- a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml +++ b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml @@ -9,64 +9,85 @@ mc:Ignorable="d" NavigationCacheMode="Enabled"> - + - + + + Default + Name + Process ID + Uptime + State + - +