The Icinga 2 API release is near – and so is OSMC where we will have demo setups with us. Users keep asking about how to already play and test-drive the Icinga 2 REST API, the answer is fairly simple:
- Read the snapshot docs (we update them frequently, so make sure to check for changes)
- Install Vagrant, Docker or fetch the snapshot packages directly
The benefit of using the Docker Container or the Vagrant Boxes – you’ll get everything pre-installed and pre-configured already to play with.
docker run -d -ti --name icinga2-api -p 4080:80 -p 4665:5665 icinga/icinga2
The container initialisation takes ~1 minute.
Example for Docker on OSX (change the IP address to your localhost):
curl -k -s -u root:icinga 'https://192.168.99.100:4665/v1/objects/hosts' | python -m json.tool
The container sources are located here, if you prefer to build it locally.
Both boxes icinga2x and icinga2x-cluster come with pre-configured Icinga 2 API.
git clone https://github.com/Icinga/icinga-vagrant.git cd icinga-vagrant/icinga2x vagrant up
curl -k -s -u root:icinga 'https://192.168.33.5:5665/v1/objects/hosts' | python -m json.tool
In case you have everything up and running (Packages, Vagrant or Docker) clone the Dashing demo and edit the icinga2 job API credentials here.
git clone https://github.com/Icinga/dashing-icinga2 cd dashing-icinga2
The following example uses the Docker IP address on OSX and the mapped port to 4665.
vim jobs/icinga2.rb $api_url_base = "https://192.168.99.100:4665/v1" $api_username = "dashing" $api_password = "icinga2ondashingr0xx"