Skip to content

Commit

Permalink
Docs: Add API examples for creating services and check commands
Browse files Browse the repository at this point in the history
fixes #11350
  • Loading branch information
Michael Friedrich committed Mar 11, 2016
1 parent 9e49838 commit a63db28
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/9-icinga2-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a63db28

Please sign in to comment.