]> granicus.if.org Git - icinga2/commitdiff
Docs: Add API examples for creating services and check commands
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 10 Mar 2016 09:58:41 +0000 (10:58 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 11 Mar 2016 14:54:29 +0000 (15:54 +0100)
fixes #11350

doc/9-icinga2-api.md

index 42c9d3077c2d812e4a673337f89f5fd8ff1df249..0a8cc35881fefa7012f41f9cdc817a0c5ce13dd0 100644 (file)
@@ -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$" } } }'
 
 
 ### <a id="icinga2-api-config-objects-modify"></a> Modifying Objects