source: nscp/libs/protobuf/plugin.proto @ a90ef7c

0.4.2
Last change on this file since a90ef7c was a90ef7c, checked in by Michael Medin <michael@…>, 10 months ago
  • Initial merge of 0.4.1 into 0.4.2
  • Property mode set to 100644
File size: 10.7 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                ALL = 99;
264        };
265        message Query {
266                optional string expression = 1;
267        };
268        message Information {
269                optional string title = 1;
270                optional string description = 2;
271               
272                optional string min_version = 5;
273                optional string max_version = 6;
274               
275                optional bool advanced = 8;
276                repeated string plugin = 9;
277        };
278};
279
280message RegistryRequestMessage {
281        message Request {
282                enum ActionType {
283                        REGISTRATION = 1;
284                        INVENTORY = 2;
285                };
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                required ActionType type = 2;
305                optional Registration registration = 3;
306                optional Inventory inventory = 4;
307        };
308        required Common.Header header = 1;
309        repeated Request payload = 2;
310};
311message RegistryResponseMessage {
312        message Response {
313                enum ActionType {
314                        INVENTORY = 2;
315                };
316                message Inventory {
317                        repeated string plugin = 1;
318                        required Registry.ItemType type = 2;
319                        required string name = 3;
320                        optional Registry.Information info = 4;
321                };
322                optional int64 id = 1;
323                required Common.Status result = 2;
324                required ActionType type = 3;
325               
326                repeated Inventory inventory = 4;
327        };
328
329        required Common.Header header = 1;
330        repeated Response payload = 2;
331};
332
333// // // // // // // // // // // // // // // // // // // // // // // //
334//
335// Settings commands
336// Used for accessing the settings store
337//
338// // // // // // // // // // // // // // // // // // // // // // // //
339message Settings {
340        message Node {
341                required string path = 1;
342                optional string key = 2;
343        };
344        message Query {
345                optional string expression = 1;
346        };
347        message Value {
348                optional Common.AnyDataType value = 1;
349                optional Common.DataType type = 2;
350        };
351        message Information {
352                optional string title = 1;
353                optional string description = 2;
354                optional string default_value = 3;
355                optional string min_version = 4;
356                optional string max_version = 5;
357                optional bool advanced = 6;
358                optional string sample = 7;
359                repeated string plugin = 9;
360        };
361};
362
363message SettingsRequestMessage {
364        message Request {
365                enum ActionType {
366                        REGISTRATION = 1;
367                        QUERY = 2;
368                        UPDATE = 3;
369                        INVENTORY = 4;
370                };
371                message Registration {
372                        optional Settings.Node node = 1;
373                        optional Settings.Information info = 2;
374                };
375                message Query {
376                        optional Settings.Node node = 1;
377                        optional Settings.Query query = 4;
378                        optional bool recursive = 2;
379                        optional Common.DataType type = 3;
380                };
381                message Inventory {
382                        optional Settings.Node node = 1;
383                        optional Settings.Query query = 10;
384                        optional bool recursive_fetch = 2;
385                        optional bool fetch_keys = 3;
386                        optional bool fetch_paths = 4;
387                        optional bool descriptions = 5;
388                };
389                message Update {
390                        optional Settings.Node node = 1;
391                        optional Settings.Value value = 2;
392                };
393                optional int64 id = 1;
394                required ActionType type = 2;
395                required int32 plugin_id = 3;
396               
397                optional Registration registration = 10;
398                optional Query query = 11;
399                optional Update update = 12;
400                optional Inventory inventory = 13;
401        };
402        required Common.Header header = 1;
403        repeated Request payload = 2;
404};
405message SettingsResponseMessage {
406        message Response {
407                enum ActionType {
408                        QUERY = 2;
409                        INVENTORY = 4;
410                };
411                message Query {
412                        required Settings.Node node = 1;
413                        required Settings.Value value = 2;
414                };
415                message Inventory {
416                        required Settings.Node node = 1;
417                        required Settings.Information info = 2;
418                };
419                optional int64 id = 1;
420                required Common.Status result = 2;
421                required ActionType type = 3;
422               
423                repeated Query query = 4;
424                repeated Inventory inventory = 5;
425        };
426
427        required Common.Header header = 1;
428        repeated Response payload = 2;
429};
430
431
432// // // // // // // // // // // // // // // // // // // // // // // //
433//
434// Log Entry
435// Used for sending errors and log entries to a logging module
436// (this is internal errors, not syslog or eventlog)
437//
438// // // // // // // // // // // // // // // // // // // // // // // //
439
440message LogEntry {
441        message Entry {
442                enum Level {
443                        LOG_DEBUG       = 500;
444                        LOG_INFO        = 150;
445                        LOG_WARNING     =  50;
446                        LOG_ERROR       =  10;
447                        LOG_CRITICAL    =   1;
448                };
449                required Level  level   = 1;
450                optional string sender  = 2;
451                optional string file    = 3;
452                optional int32  line    = 4;
453                optional string message = 5;
454                optional int32  date    = 6;
455        };
456
457        repeated Entry entry = 1;
458}
Note: See TracBrowser for help on using the repository browser.