Adds a health checking endpoint on the GRPC server. This is a stream that changes whenever a health status update occurs. Reviewed-on: https://git.nikos.gg/prymn/prymn/pulls/5 Co-authored-by: Nikos Papadakis <nikos@papadakis.xyz> Co-committed-by: Nikos Papadakis <nikos@papadakis.xyz>
71 lines
1.4 KiB
Protocol Buffer
71 lines
1.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
package prymn;
|
|
|
|
message SystemHealth {
|
|
// Comma-separated statuses
|
|
string status = 1;
|
|
}
|
|
|
|
message TaskHealth {
|
|
string status = 1;
|
|
string message = 2;
|
|
string started_on = 3;
|
|
int32 progress = 4;
|
|
}
|
|
|
|
message HealthResponse {
|
|
string version = 1;
|
|
SystemHealth system = 2;
|
|
map<string, TaskHealth> tasks = 3;
|
|
}
|
|
|
|
message SysInfoResponse {
|
|
message Cpu {
|
|
uint64 freq_mhz = 1;
|
|
float usage = 2;
|
|
}
|
|
|
|
message Disk {
|
|
string name = 1;
|
|
uint64 total_bytes = 2;
|
|
uint64 avail_bytes = 3;
|
|
string mount_point = 4;
|
|
}
|
|
|
|
uint64 uptime = 1;
|
|
string hostname = 2;
|
|
string os = 3;
|
|
uint64 mem_total_bytes = 4;
|
|
uint64 mem_avail_bytes = 5;
|
|
uint64 swap_total_bytes = 6;
|
|
uint64 swap_free_bytes = 7;
|
|
repeated Cpu cpus = 8;
|
|
repeated Disk disks = 9;
|
|
}
|
|
|
|
message ExecRequest {
|
|
string program = 1;
|
|
repeated string args = 2;
|
|
}
|
|
|
|
message ExecResponse {
|
|
message Output {
|
|
string stdout = 1;
|
|
string stderr = 2;
|
|
}
|
|
|
|
oneof response {
|
|
Output output = 1;
|
|
int32 exit_code = 2;
|
|
string error = 3;
|
|
}
|
|
}
|
|
|
|
service Agent {
|
|
rpc Health(google.protobuf.Empty) returns (stream HealthResponse);
|
|
rpc GetSysInfo(google.protobuf.Empty) returns (SysInfoResponse);
|
|
rpc Exec(ExecRequest) returns (stream ExecResponse);
|
|
}
|