Download the PHP package rzuw/icinga2 without Composer
On this page you can find all versions of the php package rzuw/icinga2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package icinga2
Icinga2 Api Client for PHP
This is a simple api client for Icinga2 written in PHP. At the moment it has only read functions. In the future it will be capable of writing to Icinga2 too.
Installation
To use this client simply add it to your package requirements with composer:
Configuration for Client
The following settings should be set to make this client work.
Configuration for Icinga2 Backend
The complete configuration for API settings for an Icinga2 backend is available in Icinga2 Documentation. There will be to example for API configuration available one for Authentication with username and password, the other using a X509 certificate.
Configure API
To configure the Api settings you need to create the master certificates:
Copy the ca.crt
to your client you will need this for your future authentications.
Then add the following configuration for the API, in /etc/icinga2/features-available/api.conf
Enable the Api settings with commandline or creating a link:
Using Username and Password
In /etc/icinga2/conf.d/api-users.conf
add your new user with the given settings:
To test the settings use curl:
Using X509 Certificate
It is possible to use Icinga2 Api with certificates, to do this you need to create the needed ca certificate, a client certificate and then sign the certificate with ca. The complete documentation can be found on Icinga2 website.
In /etc/icinga2/conf.d/api-users.conf
add your new user with the given settings:
Restart the Icinga2 Daemon:
Copy your-client-cn.crt
and your-client-cn.key
to your Api client and
they can be used.
To test the clients simply use the following curl
command:
Usage
To use this client simply create an instance of Icinga2Api class and load the configuration inside.
See the test cases for more examples.
Testing
To test this client you need to have phpunit
installed. And the following
environmental variables should be set.