From a63db2805e0da55a7f2845328c8fc19cfc342795 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 10 Mar 2016 10:58:41 +0100 Subject: [PATCH] Docs: Add API examples for creating services and check commands fixes #11350 --- doc/9-icinga2-api.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/9-icinga2-api.md b/doc/9-icinga2-api.md index 42c9d3077..0a8cc3588 100644 --- a/doc/9-icinga2-api.md +++ b/doc/9-icinga2-api.md @@ -557,6 +557,16 @@ which is required for host objects: ] } +Service objects must be created using their full name ("hostname!servicename") referencing an existing host object: + + $ curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/services/localhost!realtime-load' \ + -d '{ "templates": [ "generic-service" ], "attrs": { "check_command": "load", "check_interval": 1,"retry_interval": 1 } }' + + +Example for a new CheckCommand object: + + $ curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/checkcommands/mytest' \ + -d '{ "templates": [ "plugin-check-command" ], "attrs": { "command": [ "/usr/local/sbin/check_http" ], "arguments": { "-I": "$mytest_iparam$" } } }' ### Modifying Objects