forked from elastic/elastic-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
control.proto
248 lines (215 loc) · 6.65 KB
/
control.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
syntax = "proto3";
package cproto;
option cc_enable_arenas = true;
option go_package = "internal/pkg/agent/control/cproto";
import "google/protobuf/timestamp.proto";
// State codes for the current state.
enum State {
STARTING = 0;
CONFIGURING = 1;
HEALTHY = 2;
DEGRADED = 3;
FAILED = 4;
STOPPING = 5;
STOPPED = 6;
UPGRADING = 7;
ROLLBACK = 8;
}
// Unit Type running inside a component.
enum UnitType {
INPUT = 0;
OUTPUT = 1;
}
// Action status codes for restart and upgrade response.
enum ActionStatus {
// Action was successful.
SUCCESS = 0;
// Action failed.
FAILURE = 1;
}
// pprof endpoint that can be requested.
enum PprofOption {
ALLOCS = 0;
BLOCK = 1;
CMDLINE = 2;
GOROUTINE = 3;
HEAP = 4;
MUTEX = 5;
PROFILE = 6;
THREADCREATE = 7;
TRACE = 8;
}
// Empty message.
message Empty {
}
// Version response message.
message VersionResponse {
// Current running version.
string version = 1;
// Current running commit.
string commit = 2;
// Current running build time.
string buildTime = 3;
// Current running version is a snapshot.
bool snapshot = 4;
}
message RestartResponse {
// Response status.
ActionStatus status = 1;
// Error message when it fails to trigger restart.
string error = 2;
}
// Upgrade request message.
message UpgradeRequest {
// (Optional) Version to upgrade to.
//
// If not provided Elastic Agent will auto discover the latest version in the same major
// to upgrade to. If wanting to upgrade to a new major that major must be present in the
// this version field.
string version = 1;
// (Optional) Use a different source URI then configured.
//
// If provided the upgrade process will use the provided sourceURI instead of the configured
// sourceURI in the configuration.
string sourceURI = 2;
}
// A upgrade response message.
message UpgradeResponse {
// Response status.
ActionStatus status = 1;
// Version that is being upgraded to.
string version = 2;
// Error message when it fails to trigger upgrade.
string error = 3;
}
message ComponentUnitState {
// Type of unit in the component.
UnitType unit_type = 1;
// ID of the unit in the component.
string unit_id = 2;
// Current state.
State state = 3;
// Current state message.
string message = 4;
// Current state payload.
string payload = 5;
}
// Version information reported by the component to Elastic Agent.
message ComponentVersionInfo {
// Name of the component.
string name = 1;
// Version of the component.
string version = 2;
// Extra meta information about the version.
map<string, string> meta = 3;
}
// Current state of a running component by Elastic Agent.
message ComponentState {
// Unique component ID.
string id = 1;
// Component name.
string name = 2;
// Current state.
State state = 3;
// Current state message.
string message = 4;
// Current units running in the component.
repeated ComponentUnitState units = 5;
// Current version information for the running component.
ComponentVersionInfo version_info = 6;
}
message StateAgentInfo {
// Current ID of the Agent.
string id = 1;
// Current running version.
string version = 2;
// Current running commit.
string commit = 3;
// Current running build time.
string buildTime = 4;
// Current running version is a snapshot.
bool snapshot = 5;
}
// StateResponse is the current state of Elastic Agent.
message StateResponse {
// Overall information of Elastic Agent.
StateAgentInfo info = 1;
// Overall state of Elastic Agent.
State state = 2;
// Overall status message of Elastic Agent.
string message = 3;
// Status of each component in Elastic Agent.
repeated ComponentState components = 4;
}
// DiagnosticFileResult is a file result from a diagnostic result.
message DiagnosticFileResult {
// Human readable name of the diagnostic result content.
string name = 1;
// Filename to use to store the diagnostic to the disk.
string filename = 2;
// Human readable description of the information this diagnostic provides.
string description = 3;
// Content-Type of the resulting content.
string content_type = 4;
// Actual file content.
bytes content = 5;
// Timestamp the content was generated at.
google.protobuf.Timestamp generated = 6;
}
// DiagnosticAgentRequest is request to gather diagnostic information about the Elastic Agent.
message DiagnosticAgentRequest {
}
// DiagnosticAgentResponse is response to gathered diagnostic information about the Elastic Agent.
message DiagnosticAgentResponse {
// Diagnostic results for the agent.
repeated DiagnosticFileResult results = 1;
}
// DiagnosticUnitRequest specifies a specific unit to gather diagnostics from.
message DiagnosticUnitRequest {
// ID of the component.
string component_id = 1;
// Type of unit.
UnitType unit_type = 2;
// ID of the unit.
string unit_id = 3;
}
// DiagnosticUnitsRequest allows a diagnostic request to specify the units to target.
message DiagnosticUnitsRequest {
// Specific units to target. (If no units are given then a result for all units is provided).
repeated DiagnosticUnitRequest units = 1;
}
// DiagnosticUnitResponse is diagnostic information about a specific unit.
message DiagnosticUnitResponse {
// ID of the component.
string component_id = 1;
// Type of unit.
UnitType unit_type = 2;
// ID of the unit.
string unit_id = 3;
// Error message for the failure fetching diagnostic information for this unit.
string error = 4;
// Diagnostic results for the unit.
repeated DiagnosticFileResult results = 5;
}
// DiagnosticUnitsResponse is response to gathered units diagnostic information.
message DiagnosticUnitsResponse {
// Diagnostics results per unit.
repeated DiagnosticUnitResponse units = 2;
}
service ElasticAgentControl {
// Fetches the currently running version of the Elastic Agent.
rpc Version(Empty) returns (VersionResponse);
// Fetches the currently states of the Elastic Agent.
rpc State(Empty) returns (StateResponse);
// Restart restarts the current running Elastic Agent.
rpc Restart(Empty) returns (RestartResponse);
// Upgrade starts the upgrade process of Elastic Agent.
rpc Upgrade(UpgradeRequest) returns (UpgradeResponse);
// Gather diagnostic information for the running Elastic Agent.
rpc DiagnosticAgent(DiagnosticAgentRequest) returns (DiagnosticAgentResponse);
// Gather diagnostic information for the running units.
rpc DiagnosticUnits(DiagnosticUnitsRequest) returns (DiagnosticUnitsResponse);
}