source: nscp/libs/protobuf/plugin.proto

Last change on this file was 94bb8cc, checked in by Michael Medin <michael@…>, 6 weeks ago

Fixed issue with commands escaping
Changed a lot of the utf16 into utf8 as well as major API refactoring

  • Property mode set to 100644
File size: 10.9 KB
Line 
1package Plugin;
2
3option optimize_for = LITE_RUNTIME;
4
5message Common {
6
7        enum ResultCode {
8                OK              = 0;
9                WARNING = 1;
10                CRITCAL = 2;
11                UNKNOWN = 3;
12        };
13        enum DataType {
14                INT = 1;
15                STRING = 2;
16                FLOAT = 3;
17                BOOL = 4;
18                LIST = 5;
19        };
20       
21        message AnyDataType {
22                required Common.DataType type = 1;
23                optional string string_data = 2;
24                optional int64 int_data = 3;
25                optional double float_data = 4;
26                optional bool bool_data = 5;
27                repeated string list_data = 6;
28        }
29
30        message KeyValue {
31                required string key = 1;
32                required string value = 2;
33                repeated string data = 3;
34        }
35       
36
37        enum Version {
38                VERSION_1 = 1;
39        };
40
41        message Host {
42               
43                optional string id = 1;
44                optional string host = 2;
45                optional string address = 3;
46                optional string protocol = 4;
47                optional string comment = 5;
48               
49                repeated Common.KeyValue metadata = 6;
50                repeated string tags = 7;
51        };
52       
53        message Header {
54
55                required Common.Version version = 1;
56                optional Common.Version max_supported_version = 2;
57
58                optional string source_id = 3;
59                optional string sender_id = 4;
60                optional string recipient_id = 5;
61                optional string destination_id = 6;
62
63                optional int64 message_id = 16;
64
65                repeated Common.KeyValue metadata = 8;
66                repeated string tags = 9;
67
68                repeated Host hosts = 10;
69        };
70
71        message Attachment {
72               
73                optional int64 id = 1;
74                required string type = 2;
75                repeated Common.KeyValue metadata = 3;
76                repeated string tags = 4;
77                required string data = 5;
78        };
79       
80        message PerformanceData {
81                message IntValue {
82                        required int64 value = 1;
83                        optional string unit = 2;
84                        optional int64 warning = 3;
85                        optional int64 critical = 4;
86                        optional int64 minimum = 6;
87                        optional int64 maximum = 7;
88                }
89                message StringValue {
90                        required string value = 1;
91                }
92                message FloatValue {
93                        required double value = 1;
94                        optional string unit = 2;
95                        optional double warning = 3;
96                        optional double critical = 4;
97                        optional double minimum = 6;
98                        optional double maximum = 7;
99                }
100                message BoolValue {
101                        required bool value = 1;
102                        optional string unit = 2;
103                        optional bool warning = 3;
104                        optional bool critical = 4;
105                }
106                required string alias = 1;
107                required Common.DataType type = 2;
108                optional IntValue int_value = 3;
109                optional StringValue string_value = 4;
110                optional FloatValue float_value = 5;
111                optional BoolValue bool_value = 6;
112               
113                // TODO add thresholds here!
114        }
115       
116        message Status {
117       
118                enum StatusType {
119                        STATUS_OK = 0;
120                        STATUS_WARNING = 1;
121                        STATUS_ERROR = 2;
122                        STATUS_DELAYED = 3;
123                };
124       
125                required StatusType status = 1;
126                optional string message = 2;
127                optional string data = 3;
128        }
129        message ResponseData {
130                message ResponseDataCell {
131                        required Common.AnyDataType data = 1;
132                        optional string tag = 2;
133                }
134                message ResponseDataRow {
135                        repeated ResponseDataCell cells = 1;
136                }
137                required string alias = 1;
138                optional ResponseDataRow headers = 2;
139                repeated ResponseDataRow rows = 3;
140
141        }
142       
143};
144
145// // // // // // // // // // // // // // // // // // // // // // // //
146//
147// Query request/response
148// Used for querying the client this is the "normal" check_nrpe thingy
149//
150// // // // // // // // // // // // // // // // // // // // // // // //
151
152message QueryRequestMessage {
153        message Request {
154                optional int32 id = 1;
155                optional string target = 7;
156                required string command = 2;
157                optional string alias = 3;
158                repeated string arguments = 4;
159                repeated Common.Attachment attachments = 17;
160        };
161
162        required Common.Header header = 1;
163        repeated Request payload = 2;
164        repeated Common.Attachment attachments = 3;
165}
166message QueryResponseMessage {
167
168        message Response {
169
170                optional int32 id = 1;
171                optional string source = 7;
172                required string command = 2;
173                optional string alias = 3;
174                repeated string arguments = 16;
175               
176                required Common.ResultCode result = 4;
177                required string message = 5;
178                repeated Common.PerformanceData perf = 6;
179                repeated Common.Attachment attachments = 17;
180               
181        }
182
183        required Common.Header header = 1;
184        repeated Response payload = 2;
185        repeated Common.Attachment attachments = 3;
186}
187
188// // // // // // // // // // // // // // // // // // // // // // // //
189//
190// Execute command request and response
191// Used for executing commands on clients
192//
193// // // // // // // // // // // // // // // // // // // // // // // //
194
195message ExecuteRequestMessage {
196        message Request {
197                optional int32 id = 1;
198                required string command = 2;
199                repeated string arguments = 3;
200                repeated Common.Attachment attachments = 17;
201        };
202
203        required Common.Header header = 1;
204        repeated Request payload = 2;
205        repeated Common.Attachment attachments = 3;
206}
207message ExecuteResponseMessage {
208        message Response {
209                optional int32 id = 2;
210                required string command = 5;
211                repeated string arguments = 16;
212               
213                required Common.ResultCode result = 9;
214                required string message = 10;
215               
216                optional Common.ResponseData data = 11;
217                repeated Common.Attachment attachments = 17;
218               
219        }
220        required Common.Header header = 1;
221        repeated Response payload = 2;
222        repeated Common.Attachment attachments = 3;
223}
224
225// // // // // // // // // // // // // // // // // // // // // // // //
226//
227// Submit result
228// Used for submitting a passive result
229//
230// // // // // // // // // // // // // // // // // // // // // // // //
231
232message SubmitRequestMessage {
233        required Common.Header header = 1;
234        required string channel = 2;
235        repeated QueryResponseMessage.Response payload = 3;
236        repeated Common.Attachment attachments = 4;
237}
238
239message SubmitResponseMessage {
240        message Response {
241                optional int32 id = 1;
242                required string command = 2;
243                required Common.Status status = 3;
244                repeated Common.Attachment attachments = 17;
245        };
246        required Common.Header header = 1;
247        repeated Response payload = 2;
248        repeated Common.Attachment attachments = 3;
249}
250
251
252// // // // // // // // // // // // // // // // // // // // // // // //
253//
254// plugins and registration
255//
256// // // // // // // // // // // // // // // // // // // // // // // //
257message Registry {
258        enum ItemType {
259                QUERY = 1;
260                COMMAND = 2;
261                HANDLER = 3;
262                PLUGIN = 4;
263                QUERY_ALIAS = 5;
264                ROUTER = 6;
265                ALL = 99;
266        };
267        message Query {
268                optional string expression = 1;
269        };
270        message Information {
271                optional string title = 1;
272                optional string description = 2;
273
274                repeated Common.KeyValue metadata = 3;
275               
276                optional string min_version = 5;
277                optional string max_version = 6;
278               
279                optional bool advanced = 8;
280                repeated string plugin = 9;
281        };
282};
283
284message RegistryRequestMessage {
285        message Request {
286                message Registration {
287                        optional int32 plugin_id = 1;
288                        required Registry.ItemType type = 2;
289                        required string name = 3;
290                        optional Registry.Information info = 4;
291                       
292                        repeated string alias = 9;
293                };
294                message Inventory {
295                        optional string plugin = 1;
296                        repeated Registry.ItemType type = 2;
297                        optional string name = 3;
298                        optional Registry.Information info = 4;
299
300                        optional bool fetch_all = 6;
301                        optional bool fetch_information = 7;
302                };
303                optional int64 id = 1;
304                optional Registration registration = 3;
305                optional Inventory inventory = 4;
306        };
307        required Common.Header header = 1;
308        repeated Request payload = 2;
309};
310message RegistryResponseMessage {
311        message Response {
312                message Registration {
313                        optional int32 item_id = 1;
314                };
315                message Inventory {
316                        repeated string plugin = 1;
317                        required Registry.ItemType type = 2;
318                        required string name = 3;
319                        optional Registry.Information info = 4;
320                };
321                optional int64 id = 1;
322                required Common.Status result = 2;
323
324                optional Registration registration = 3;
325                repeated Inventory inventory = 4;
326        };
327
328        required Common.Header header = 1;
329        repeated Response payload = 2;
330};
331
332// // // // // // // // // // // // // // // // // // // // // // // //
333//
334// Settings commands
335// Used for accessing the settings store
336//
337// // // // // // // // // // // // // // // // // // // // // // // //
338message Settings {
339        message Node {
340                required string path = 1;
341                optional string key = 2;
342        };
343        message Query {
344                optional string expression = 1;
345        };
346        message Information {
347                optional string title = 1;
348                optional string description = 2;
349                optional Common.AnyDataType default_value = 3;
350                optional string min_version = 4;
351                optional string max_version = 5;
352                optional bool advanced = 6;
353                optional string sample = 7;
354                repeated string plugin = 9;
355        };
356        enum Command {
357                LOAD    = 1;
358                SAVE    = 2;
359                RELOAD  = 3;
360        };
361};
362
363message SettingsRequestMessage {
364        message Request {
365                message Registration {
366                        optional Settings.Node node = 1;
367                        optional Settings.Information info = 2;
368                };
369                message Query {
370                        optional Settings.Node node = 1;
371                        optional Settings.Query query = 4;
372                        optional bool recursive = 2;
373                        optional Common.DataType type = 3;
374                        optional Common.AnyDataType default_value = 5;
375                };
376                message Update {
377                        optional Settings.Node node = 1;
378                        optional Common.AnyDataType value = 2;
379                };
380                message Inventory {
381                        optional Settings.Node node = 1;
382                        optional Settings.Query query = 10;
383                        optional bool recursive_fetch = 2;
384                        optional bool fetch_keys = 3;
385                        optional bool fetch_paths = 4;
386                        optional bool descriptions = 5;
387                };
388                message Control {
389                        required Settings.Command command = 1;
390                        optional string context = 2;
391                };
392                optional int64 id = 1;
393                required int32 plugin_id = 3;
394               
395                optional Registration registration = 10;
396                optional Query query = 11;
397                optional Update update = 12;
398                optional Inventory inventory = 13;
399                optional Control control = 14;
400        };
401        required Common.Header header = 1;
402        repeated Request payload = 2;
403};
404message SettingsResponseMessage {
405        message Response {
406                message Registration {
407                };
408                message Query {
409                        required Settings.Node node = 1;
410                        required Common.AnyDataType value = 2;
411                };
412                message Update {
413                };
414                message Inventory {
415                        required Settings.Node node = 1;
416                        required Settings.Information info = 2;
417                };
418                message Control {
419                };
420                optional int64 id = 1;
421                required Common.Status result = 2;
422               
423                optional Registration registration = 10;
424                optional Query query = 11;
425                optional Update update = 12;
426                repeated Inventory inventory = 13;
427                optional Control control = 14;
428        };
429
430        required Common.Header header = 1;
431        repeated Response payload = 2;
432};
433
434
435// // // // // // // // // // // // // // // // // // // // // // // //
436//
437// Log Entry
438// Used for sending errors and log entries to a logging module
439// (this is internal errors, not syslog or eventlog)
440//
441// // // // // // // // // // // // // // // // // // // // // // // //
442
443message LogEntry {
444        message Entry {
445                enum Level {
446                        LOG_DEBUG       = 500;
447                        LOG_INFO        = 150;
448                        LOG_WARNING     =  50;
449                        LOG_ERROR       =  10;
450                        LOG_CRITICAL    =   1;
451                };
452                required Level  level   = 1;
453                optional string sender  = 2;
454                optional string file    = 3;
455                optional int32  line    = 4;
456                optional string message = 5;
457                optional int32  date    = 6;
458        };
459
460        repeated Entry entry = 1;
461}
Note: See TracBrowser for help on using the repository browser.