forked from elastic/elastic-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_v2.proto
361 lines (305 loc) · 10.6 KB
/
control_v2.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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
// 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/v2/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;
// (Optional) Overrides predefined behavior for agent package verification.
//
// If provided Elastic Agent package is not checked for signature during upgrade.
bool skipVerify = 3;
// (Optional) Overrides predefined behavior for agent package verification.
//
// If provided Elastic Agent package is checked against these pgp keys as well.
repeated string pgpBytes = 4;
// (Optional) Overrides predefined behavior for agent package verification.
//
// If provided Elastic Agent package embedded PGP key is not checked for signature during upgrade.
bool skipDefaultPgp = 5;
}
// 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;
// Current running PID.
int32 pid = 6;
}
// StateResponse is the current state of Elastic Agent.
// Next unused id: 8
message StateResponse {
// Overall information of Elastic Agent.
StateAgentInfo info = 1;
// Overall state + message of Elastic Agent, aggregating errors in other
// states and components
State state = 2;
string message = 3;
// Fleet state: healthy / "Connected" if the last RPC call to Fleet
// succeeded, otherwise failed with the associated error string.
State fleetState = 5;
string fleetMessage = 6;
// State of each component in Elastic Agent.
repeated ComponentState components = 4;
// Upgrade details
UpgradeDetails upgrade_details = 7;
}
// UpgradeDetails captures the details of an ongoing Agent upgrade.
message UpgradeDetails {
// Version the Agent is being upgraded to.
string target_version = 1;
// Current state of the upgrade process.
string state = 2;
// Fleet Action ID that initiated the upgrade, if in managed mode.
string action_id = 3;
// Metadata about the upgrade process.
UpgradeDetailsMetadata metadata = 4;
}
// UpgradeDetailsMetadata has additional information about an Agent's
// ongoing upgrade.
message UpgradeDetailsMetadata {
// If the upgrade is a scheduled upgrade, the timestamp of when the
// upgrade is expected to start.
google.protobuf.Timestamp scheduled_at = 1;
// If the upgrade is in the UPG_DOWNLOADING state, the percentage of
// the Elastic Agent artifact that has already been downloaded, to
// serve as an indicator of download progress.
float download_percent = 2;
// If the upgrade has failed, what upgrade state failed.
string failed_state = 3;
// Any error encountered during the upgrade process.
string error_msg = 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 {
repeated AdditionalDiagnosticRequest additional_metrics = 1;
}
// DiagnosticAgentRequestAdditional is an enum of additional diagnostic metrics that can be requested from Elastic Agent.
enum AdditionalDiagnosticRequest {
CPU = 0;
}
// DiagnosticComponentsRequest is the message to request diagnostics from individual components.
message DiagnosticComponentsRequest {
repeated DiagnosticComponentRequest components = 1;
repeated AdditionalDiagnosticRequest additional_metrics = 2;
}
// DiagnosticComponentRequest specifies the component to send a diagnostic request to.
message DiagnosticComponentRequest {
// ID of the component.
string component_id = 1;
}
// 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;
}
// DiagnosticComponentResponse is the response diagnostic information for a component-level diagnostic request
message DiagnosticComponentResponse {
// ID of the component.
string component_id = 1;
// 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;
}
// ConfigureRequest sends a new configuration for the running Elastic Agent to use.
message ConfigureRequest {
// Config to use.
string config = 1;
}
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);
// Streams the current state of the Elastic Agent to the client.
//
// Client will continue to get updated StateResponse when any state
// of the Elastic Agent has changed.
rpc StateWatch(Empty) returns (stream 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 (stream DiagnosticUnitResponse);
// Gather diagnostic information for the running components.
rpc DiagnosticComponents(DiagnosticComponentsRequest) returns (stream DiagnosticComponentResponse);
// Configure adjusts the running Elastic Agent configuration with the configuration
// provided over the RPC.
//
// This is only allowed if the Elastic Agent is spawned in TESTING_MODE. Calling this
// on any Elastic Agent that is not in TESTING_MODE will result in an error being
// returned and nothing occurring.
rpc Configure(ConfigureRequest) returns (Empty);
}