Files
IT_Tool/Protos/nexusrmm/agent_service.proto

113 lines
2.4 KiB
Protocol Buffer

syntax = "proto3";
package nexusrmm;
option csharp_namespace = "NexusRMM.Protos";
option go_package = "nexusrmm.local/agent/pkg/proto";
// --- Agent Enrollment ---
message EnrollRequest {
string hostname = 1;
string os_type = 2;
string os_version = 3;
string mac_address = 4;
string ip_address = 5;
string agent_version = 6;
}
message EnrollResponse {
string agent_id = 1;
int32 heartbeat_interval = 2;
}
// --- Heartbeat / Metriken ---
message HeartbeatRequest {
string agent_id = 1;
SystemMetrics metrics = 2;
}
message SystemMetrics {
double cpu_usage_percent = 1;
double memory_usage_percent = 2;
int64 memory_total_bytes = 3;
int64 memory_available_bytes = 4;
repeated DiskInfo disks = 5;
repeated NetworkInterfaceInfo network_interfaces = 6;
double uptime_seconds = 7;
}
message DiskInfo {
string mount_point = 1;
int64 total_bytes = 2;
int64 free_bytes = 3;
string filesystem = 4;
}
message NetworkInterfaceInfo {
string name = 1;
string ip_address = 2;
string mac_address = 3;
int64 bytes_sent = 4;
int64 bytes_recv = 5;
}
message HeartbeatResponse {
repeated AgentCommand pending_commands = 1;
}
// --- Remote Commands ---
message AgentCommand {
string command_id = 1;
CommandType type = 2;
string payload = 3;
}
enum CommandType {
COMMAND_TYPE_UNSPECIFIED = 0;
COMMAND_TYPE_SHELL = 1;
COMMAND_TYPE_INSTALL_SOFTWARE = 2;
COMMAND_TYPE_UNINSTALL_SOFTWARE = 3;
COMMAND_TYPE_UPDATE_AGENT = 4;
COMMAND_TYPE_NETWORK_SCAN = 5;
}
message CommandResult {
string agent_id = 1;
string command_id = 2;
int32 exit_code = 3;
string stdout = 4;
string stderr = 5;
bool success = 6;
}
message CommandResultResponse {}
// --- Bidirektionaler Stream ---
message AgentStreamMessage {
string agent_id = 1;
oneof payload {
HeartbeatRequest heartbeat = 2;
CommandResult command_result = 3;
}
}
message ServerStreamMessage {
oneof payload {
AgentCommand command = 1;
ServerConfig config_update = 2;
}
}
message ServerConfig {
int32 heartbeat_interval = 1;
int32 metric_collection_interval = 2;
}
// --- Service Definition ---
service AgentService {
rpc Enroll(EnrollRequest) returns (EnrollResponse);
rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse);
rpc ReportCommandResult(CommandResult) returns (CommandResultResponse);
rpc AgentStream(stream AgentStreamMessage) returns (stream ServerStreamMessage);
}