· 6 years ago · Nov 14, 2019, 02:24 PM
1swagger: "2.0"
2info:
3 description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
4 version: "1.0.0"
5 title: "Nagios Swagger REST API"
6 termsOfService: "http://swagger.io/terms/"
7 contact:
8 email: "apiteam@swagger.io"
9 license:
10 name: "Apache 2.0"
11 url: "http://www.apache.org/licenses/LICENSE-2.0.html"
12host: "icts.kuleuven.be"
13basePath: "/nagiosapi-test/v0"
14tags:
15- name: "device"
16 description: "Een al dan niet pingbaar toestel dat gemonitord dient te worden"
17 externalDocs:
18 description: "Find out more"
19 url: "http://nagios.com"
20- name: "devicetemplate"
21 description: "De categorie van te monitoren devices waartoe een device kan behoren (IPv4, IPv6, virtual,..)"
22 externalDocs:
23 description: "Find out more"
24 url: "http://nagios.com"
25- name: "devicegroup"
26 description: "De arbitrair gedefinieerde group van devices waartoe een device kan behoren"
27 externalDocs:
28 description: "Find out more"
29 url: "http://nagios.com"
30- name: "contactgroup"
31 description: "De group die bepaalt op welke manier voor een Device of Service wordt ge'alert"
32 externalDocs:
33 description: "Find out more"
34 url: "http://nagios.com"
35- name: "service"
36 description: "Een service die gemonitord dient te worden"
37 externalDocs:
38 description: "Find out more"
39 url: "http://nagios.com"
40schemes:
41- "https"
42paths:
43 /device:
44 post:
45 tags:
46 - "device"
47 summary: "Add a new device to Nagios config"
48 description: "DEVICE_NAME | DEVICE_TEMPLATE_NAME (default = IPv4) | CONTACTGROUP_NAME (default = no_notifications) | DEVICE_GROUP_NAME (default = UNASSIGNED)"
49 operationId: "addDevice"
50 consumes:
51 - "application/json"
52 produces:
53 - "application/json"
54 parameters:
55 - in: "body"
56 name: "body"
57 description: "Device object that needs to be added to Nagios config"
58 required: true
59 schema:
60 $ref: "#/definitions/Device"
61 responses:
62 200:
63 description: "Succesfull operation"
64 schema:
65 $ref: "#/definitions/Device"
66 404:
67 description: "device template, contactgroup or device group not found"
68 405:
69 description: "Invalid input, device already exists"
70 schema:
71 $ref: "#/definitions/Device"
72 security:
73 - nagios_auth:
74 - "write:devices"
75 - "read:devices"
76 put:
77 tags:
78 - "device"
79 summary: "Update an existing device"
80 description: ""
81 operationId: "updateDevice"
82 consumes:
83 - "application/json"
84 produces:
85 - "application/json"
86 parameters:
87 - in: "body"
88 name: "body"
89 description: "Device object that already exists in Nagios config and needs to be updated"
90 required: true
91 schema:
92 $ref: "#/definitions/Device"
93 responses:
94 400:
95 description: "Invalid ID supplied"
96 404:
97 description: "Device not found"
98 405:
99 description: "Validation exception"
100 security:
101 - nagios_auth:
102 - "write:devices"
103 - "read:devices"
104 /device/findByProperty:
105 get:
106 tags:
107 - "device"
108 summary: "Finds Devices by property"
109 description: "Multiple property values (key/value pairs?) can be provided with comma separated strings"
110 operationId: "findDevicesByProperty"
111 produces:
112 - "application/json"
113 parameters:
114 - name: "property"
115 in: "query"
116 description: "Key value pairs that need to be considered for filter"
117 required: true
118 type: "array"
119 items:
120 type: "string"
121 enum:
122 - "devicegroup"
123 - "team"
124 - "contactgroup"
125 default: "available"
126 collectionFormat: "multi"
127 responses:
128 200:
129 description: "successful operation"
130 schema:
131 type: "array"
132 items:
133 $ref: "#/definitions/Device"
134 400:
135 description: "Invalid status value"
136 security:
137 - nagios_auth:
138 - "write:devices"
139 - "read:devices"
140 /device/findByTags:
141 get:
142 tags:
143 - "device"
144 summary: "Finds Devices by tags"
145 description: "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."
146 operationId: "findDevicesByTags"
147 produces:
148 - "application/json"
149 parameters:
150 - name: "tags"
151 in: "query"
152 description: "Tags to filter by"
153 required: true
154 type: "array"
155 items:
156 type: "string"
157 collectionFormat: "multi"
158 responses:
159 200:
160 description: "successful operation"
161 schema:
162 type: "array"
163 items:
164 $ref: "#/definitions/Device"
165 400:
166 description: "Invalid tag value"
167 security:
168 - nagios_auth:
169 - "write:devices"
170 - "read:devices"
171 /device/{deviceId}:
172 get:
173 tags:
174 - "device"
175 summary: "Find device by ID"
176 description: "Returns a single device"
177 operationId: "getDeviceById"
178 produces:
179 - "application/json"
180 parameters:
181 - name: "deviceId"
182 in: "path"
183 description: "ID of device to return"
184 required: true
185 type: "integer"
186 format: "int64"
187 responses:
188 200:
189 description: "successful operation"
190 schema:
191 $ref: "#/definitions/Device"
192 400:
193 description: "Invalid ID supplied"
194 404:
195 description: "Device not found"
196 security:
197 - api_key: []
198 post:
199 tags:
200 - "device"
201 summary: "Updates a device in the store with form data"
202 description: ""
203 operationId: "updateDeviceWithForm"
204 consumes:
205 - "application/x-www-form-urlencoded"
206 produces:
207 - "application/json"
208 parameters:
209 - name: "deviceId"
210 in: "path"
211 description: "ID of device that needs to be updated"
212 required: true
213 type: "integer"
214 format: "int64"
215 - name: "name"
216 in: "formData"
217 description: "Updated name of the device"
218 required: false
219 type: "string"
220 - name: "status"
221 in: "formData"
222 description: "Updated status of the device"
223 required: false
224 type: "string"
225 responses:
226 405:
227 description: "Invalid input"
228 security:
229 - nagios_auth:
230 - "write:devices"
231 - "read:devices"
232 delete:
233 tags:
234 - "device"
235 summary: "Deletes a device"
236 description: ""
237 operationId: "deleteDevice"
238 produces:
239 - "application/json"
240 parameters:
241 - name: "api_key"
242 in: "header"
243 required: false
244 type: "string"
245 - name: "deviceId"
246 in: "path"
247 description: "Device id to delete"
248 required: true
249 type: "integer"
250 format: "int64"
251 responses:
252 400:
253 description: "Invalid ID supplied"
254 404:
255 description: "Device not found"
256 security:
257 - nagios_auth:
258 - "write:devices"
259 - "read:devices"
260
261 /devicetemplate/findByProperty:
262 get:
263 tags:
264 - "devicetemplate"
265 summary: "Finds DeviceTemplates by property"
266 description: "Multiple property values (key/value pairs?) can be provided with comma separated strings"
267 operationId: "findDeviceTemplatesByProperty"
268 produces:
269 - "application/json"
270 parameters:
271 - name: "property"
272 in: "query"
273 description: "Key value pairs that need to be considered for filter"
274 required: true
275 type: "array"
276 items:
277 type: "string"
278 default: "available"
279 collectionFormat: "multi"
280 responses:
281 200:
282 description: "successful operation"
283 schema:
284 type: "array"
285 items:
286 $ref: "#/definitions/DeviceTemplate"
287 400:
288 description: "Invalid status value"
289 security:
290 - nagios_auth:
291 - "write:devices"
292 - "read:devices"
293 /contactgroup/findByProperty:
294 get:
295 tags:
296 - "contactgroup"
297 summary: "Finds ContactGroups by property"
298 description: "Multiple property values (key/value pairs?) can be provided with comma separated strings"
299 operationId: "findContactGroupsByProperty"
300 produces:
301 - "application/json"
302 parameters:
303 - name: "property"
304 in: "query"
305 description: "Key value pairs that need to be considered for filter"
306 required: true
307 type: "array"
308 items:
309 type: "string"
310 default: "available"
311 collectionFormat: "multi"
312 responses:
313 200:
314 description: "successful operation"
315 schema:
316 type: "array"
317 items:
318 $ref: "#/definitions/ContactGroup"
319 400:
320 description: "Invalid status value"
321 security:
322 - nagios_auth:
323 - "write:devices"
324 - "read:devices"
325 /devicegroup/findByProperty:
326 get:
327 tags:
328 - "devicegroup"
329 summary: "Finds DeviceGroups by property"
330 description: "Multiple property values (key/value pairs?) can be provided with comma separated strings"
331 operationId: "findDeviceGroupsByProperty"
332 produces:
333 - "application/json"
334 parameters:
335 - name: "property"
336 in: "query"
337 description: "Key value pairs that need to be considered for filter"
338 required: true
339 type: "array"
340 items:
341 type: "string"
342 default: "available"
343 collectionFormat: "multi"
344 responses:
345 200:
346 description: "successful operation"
347 schema:
348 type: "array"
349 items:
350 $ref: "#/definitions/DeviceGroup"
351 400:
352 description: "Invalid status value"
353 security:
354 - nagios_auth:
355 - "write:devices"
356 - "read:devices"
357 /service:
358 post:
359 tags:
360 - "service"
361 summary: "Add a new service to Nagios config"
362 description: ""
363 operationId: "addService"
364 consumes:
365 - "application/json"
366 produces:
367 - "application/json"
368 parameters:
369 - in: "body"
370 name: "body"
371 description: "Service object that needs to be added to Nagios config"
372 required: true
373 schema:
374 $ref: "#/definitions/Service"
375 responses:
376 405:
377 description: "Invalid input"
378 security:
379 - nagios_auth:
380 - "write:devices"
381 - "read:devices"
382 put:
383 tags:
384 - "service"
385 summary: "Update an existing service"
386 description: ""
387 operationId: "updateService"
388 consumes:
389 - "application/json"
390 produces:
391 - "application/json"
392 parameters:
393 - in: "body"
394 name: "body"
395 description: "Service object that already exists in Nagios config and needs to be updated"
396 required: true
397 schema:
398 $ref: "#/definitions/Service"
399 responses:
400 400:
401 description: "Invalid ID supplied"
402 404:
403 description: "Device not found"
404 405:
405 description: "Validation exception"
406 security:
407 - nagios_auth:
408 - "write:devices"
409 - "read:devices"
410 /service/findByProperty:
411 get:
412 tags:
413 - "service"
414 summary: "Finds Service by property"
415 description: "Multiple property values (key/value pairs?) can be provided with comma separated strings"
416 operationId: "findServicesByProperty"
417 produces:
418 - "application/json"
419 parameters:
420 - name: "property"
421 in: "query"
422 description: "Key value pairs that need to be considered for filter"
423 required: true
424 type: "array"
425 items:
426 type: "string"
427 enum:
428 - "devicegroup"
429 - "team"
430 - "contactgroup"
431 default: "available"
432 collectionFormat: "multi"
433 responses:
434 200:
435 description: "successful operation"
436 schema:
437 type: "array"
438 items:
439 $ref: "#/definitions/Service"
440 400:
441 description: "Invalid status value"
442 security:
443 - nagios_auth:
444 - "write:devices"
445 - "read:devices"
446 /service/findByTags:
447 get:
448 tags:
449 - "service"
450 summary: "Finds services by tags"
451 description: "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."
452 operationId: "findServicesByTags"
453 produces:
454 - "application/json"
455 parameters:
456 - name: "tags"
457 in: "query"
458 description: "Tags to filter by"
459 required: true
460 type: "array"
461 items:
462 type: "string"
463 collectionFormat: "multi"
464 responses:
465 200:
466 description: "successful operation"
467 schema:
468 type: "array"
469 items:
470 $ref: "#/definitions/Service"
471 400:
472 description: "Invalid tag value"
473 security:
474 - nagios_auth:
475 - "write:devices"
476 - "read:devices"
477 /service/{serviceId}:
478 get:
479 tags:
480 - "service"
481 summary: "Find service by ID"
482 description: "Returns a single service"
483 operationId: "getServiceById"
484 produces:
485 - "application/json"
486 parameters:
487 - name: "serviceId"
488 in: "path"
489 description: "ID of service to return"
490 required: true
491 type: "integer"
492 format: "int64"
493 responses:
494 200:
495 description: "successful operation"
496 schema:
497 $ref: "#/definitions/Service"
498 400:
499 description: "Invalid ID supplied"
500 404:
501 description: "Service not found"
502 security:
503 - api_key: []
504 post:
505 tags:
506 - "service"
507 summary: "Updates a service in the store with form data"
508 description: ""
509 operationId: "updateServiceWithForm"
510 consumes:
511 - "application/x-www-form-urlencoded"
512 produces:
513 - "application/json"
514 parameters:
515 - name: "serviceId"
516 in: "path"
517 description: "ID of service that needs to be updated"
518 required: true
519 type: "integer"
520 format: "int64"
521 - name: "name"
522 in: "formData"
523 description: "Updated name of the service"
524 required: false
525 type: "string"
526 - name: "status"
527 in: "formData"
528 description: "Updated status of the serivce"
529 required: false
530 type: "string"
531 responses:
532 405:
533 description: "Invalid input"
534 security:
535 - nagios_auth:
536 - "write:devices"
537 - "read:devices"
538 delete:
539 tags:
540 - "service"
541 summary: "Deletes a service"
542 description: ""
543 operationId: "deleteService"
544 produces:
545 - "application/json"
546 parameters:
547 - name: "api_key"
548 in: "header"
549 required: false
550 type: "string"
551 - name: "serviceId"
552 in: "path"
553 description: "Service id to delete"
554 required: true
555 type: "integer"
556 format: "int64"
557 responses:
558 400:
559 description: "Invalid ID supplied"
560 404:
561 description: "Service not found"
562 security:
563 - nagios_auth:
564 - "write:devices"
565 - "read:devices"
566
567securityDefinitions:
568 nagios_auth:
569 type: "oauth2"
570 authorizationUrl: "http://petstore.swagger.io/oauth/dialog"
571 flow: "implicit"
572 scopes:
573 write:devices: "modify pets in your account"
574 read:devices: "read your pets"
575 api_key:
576 type: "apiKey"
577 name: "api_key"
578 in: "header"
579definitions:
580 Category:
581 type: "object"
582 properties:
583 id:
584 type: "integer"
585 format: "int64"
586 name:
587 type: "string"
588 xml:
589 name: "Category"
590 Tag:
591 type: "object"
592 properties:
593 id:
594 type: "integer"
595 format: "int64"
596 name:
597 type: "string"
598 Device:
599 type: "object"
600 required:
601 - "name"
602 - "device_template_name"
603 - "contactgroup_name"
604 properties:
605 id:
606 type: "integer"
607 format: "int64"
608 name:
609 type: "string"
610 example: "icts-p-dcmon-1.icts.kuleuven.be"
611 device_template:
612 type: "string"
613 example: "template-device-generic-IPv4"
614 address:
615 type: "string"
616 example: "10.112.79.9"
617 contactgroup:
618 type: "string"
619 example: "contactgroup-no_notifications"
620 devicegroup:
621 type: "string"
622 example: "device_group-ceif_dc"
623 DeviceTemplate:
624 type: "object"
625 required:
626 - "name"
627 properties:
628 id:
629 type: "integer"
630 format: "int64"
631 category:
632 $ref: "#/definitions/Category"
633 name:
634 type: "string"
635 example: "template-generic-IPv4-device"
636 Service:
637 type: "object"
638 required:
639 - "name" # service_description
640 - "service_template_name" # service_template
641 - "device_name" # device
642 properties:
643 id:
644 type: "integer"
645 format: "int64"
646 name:
647 type: "string"
648 example: "SSH"
649 service_template_name:
650 type: "string"
651 example: "template-service-ssh"
652 device_name:
653 type: "string"
654 example: "icts-p-dcmon-1.icts.kuleuven.be"
655 ServiceTemplate:
656 type: "object"
657 required:
658 - "name"
659 properties:
660 id:
661 type: "integer"
662 format: "int64"
663 name:
664 type: "string"
665 example: "template-service-ssh"
666 ContactGroup:
667 type: "object"
668 required:
669 - "name"
670 properties:
671 id:
672 type: "integer"
673 format: "int64"
674 contact:
675 $ref: "#/definitions/Contact"
676 name:
677 type: "string"
678 example: "contactgroup-ceif_dc"
679 contacts:
680 type: "array"
681 xml:
682 name: "contact"
683 wrapped: true
684 items:
685 $ref: "#/definitions/Contact"
686 Contact:
687 type: "object"
688 required:
689 - "name"
690 properties:
691 id:
692 type: "integer"
693 format: "int64"
694 contact_template:
695 $ref: "#/definitions/ContactTemplate"
696 name:
697 type: "string"
698 example: "contact-datacenter-mail"
699 pager:
700 type: "string"
701 example: "ceif_dc"
702 email:
703 type: "string"
704 example: "datacenter@icts.kuleuven.be"
705 ContactTemplate:
706 type: "object"
707 required:
708 - "name"
709 properties:
710 id:
711 type: "integer"
712 format: "int64"
713 name:
714 type: "string"
715 example: "template-contact-mail"
716 DeviceGroup:
717 type: "object"
718 required:
719 - "name"
720 properties:
721 id:
722 type: "integer"
723 format: "int64"
724 name:
725 type: "string"
726 example: "devicegroup-ceif_dc"
727 devices:
728 type: "array"
729 items:
730 $ref: "#/definitions/Device"
731 ApiResponse:
732 type: "object"
733 properties:
734 code:
735 type: "integer"
736 format: "int32"
737 type:
738 type: "string"
739 message:
740 type: "string"
741externalDocs:
742 description: "Find out more about Swagger"
743 url: "http://swagger.io"