# Cloudinventory

***

## Requirements (self-hosted)

| GLPI Version | Minimum PHP | Recommended |
| ------------ | ----------- | ----------- |
| 10.0.11      | 8.1         | 8.3         |
| 11.0.x       | 8.2         | 8.4         |

{% hint style="info" %}
A [GLPI Network BASIC](https://services.glpi-network.com/#offers) subscription (or higher) is required. This plugin is also available for all GLPI Network [Cloud instances](https://glpi-network.cloud).
{% endhint %}

***

## Install the plugin

* Go to the marketplace. Download and install the **CloudInventory** plugin.

<div align="left"><figure><img src="/files/26OqNmlQNy4d9e0q6aRj" alt="images/install_plugin.png"><figcaption></figcaption></figure></div>

***

## To know

Currently supported providers and resource types are:

* **OVHcloud**

  > * Instances Public Cloud
  > * VPS (Serveurs Privés Virtuels)
  > * Dedicated servers (Bare Metal)
* **Scaleway**

  > * Instances Compute (Machines Virtuelles)
  > * Servers Bare Metal
  > * Instances Apple Silicon
* **Amazon Web Services (AWS)**

  > * Instances EC2 (Elastic Compute Cloud)
* **Microsoft Azure**

  > * Virtual Machines
* **Google Cloud Platform (GCP)**

  > * Google Compute Engine (Machines Virtuelles)
* **Alibaba Cloud**

  > * Elastic Compute Service (ECS)

***

## Providers credentials

Each provider can be configured individually via the plugin interface. Configuration typically includes:

* API access credentials (keys, secrets)
* Region, project, or subscription settings

### OVH

#### Create credentials

* To obtain credential, click the following link:
  * For Europe <https://eu.api.ovh.com/createToken/>
  * For North America <https://ca.api.ovh.com/createToken/>
  * For the United States <https://api.us.ovhcloud.com/createToken/>
* Sign in with your account

<div align="left"><figure><img src="/files/MgFH2t4utucNdoD50cK7" alt="" width="338"><figcaption></figcaption></figure></div>

To access the `Create API Keys` form

<div align="left"><figure><img src="/files/LuNytbpwseu15ppbK81O" alt="" width="375"><figcaption></figcaption></figure></div>

* Fill in the following information :
  * An `Application name` (mandatory)
  * An `Application description` (optionnal)
  * A `validity` period.
  * The `Rights` to restrict the use of the application to certain APIs

    GLPI only needs the `GET` right on `*` (to authorise all OVHcloud APIs)
* After submitting, `OVH` will give you :
  * `Application Key`
  * `Application Secret`
  * `Consumer Key`

#### Setup GLPI

Go to **`Adminsitration`** > **`Cloud inventory`** > **`+Add`**

<figure><img src="/files/E2zfnyAXtBrqe3R8MIoS" alt=""><figcaption></figcaption></figure>

### Amazon

#### Create credentials

Check the documentation on identifier management : [AWS identifier documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)

Or simply follow these instructions:

* Go on the IAM page and sign in with your account : [IAM](https://us-east-1.console.aws.amazon.com/iamv2/home#/home)
* Go on User tab : [User tab](https://us-east-1.console.aws.amazon.com/iamv2/home#/users)
* Check this page : [Security credential page](https://us-east-1.console.aws.amazon.com/iamv2/home#/users/details/USER?section=security_credentials)

After validating the form, `Amazon` will give you the following information :

* `Application Key`
* `Application Secret`

#### Setup GLPI

Go to **`Adminsitration`** > **`Cloud inventory`** > **`+Add`**&#x20;

<figure><img src="/files/9jifwVmbJTncdrmZxyAR" alt=""><figcaption></figcaption></figure>

### Scaleway

#### Create credentials

Check the documentation on identifier management : [How to create API Key](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/)

Or simply follow these instructions:

* Go to Scaleway console and sign in with your account : <https://console.scaleway.com/login>
* Click **Identity and Access Management (IAM)** from the top-right of your [Organization Dashboard](https://console.scaleway.com/organization)
* Click on the **API Keys** tab.
* Click on **Generate an API key**.
* Choose the **owner** of the API key (**IAM user** or **IAM application**).
* Enter a description (optional) and an expiry date for the API key.
* Select whether the API key will be used for Object Storage → choose **No**

After validating the form, `Scaleway` will give you the following information

* `Access Key`
* `Secret key`

#### Setup GLPI

Go to **`Adminsitration`** > **`Cloud inventory`** > **`+Add`**

<figure><img src="/files/bKgbaVtfE7PBNB8zlxAJ" alt=""><figcaption></figcaption></figure>

### Google

#### Create credentials

Check the documentation on identifier management : [How to manage your key](https://cloud.google.com/anthos/run/docs/securing/service-accounts?hl=fr)

Or simply follow these instructions:

* Go to the [Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts?hl=fr&_ga=2.193077034.605580056.1710501828-763263516.1710237390) page in **Google Cloud Console**
* Select the **Project** on which your **Virtual machine** was created
* Create a new **Service Account**

<figure><img src="/files/SHxP1ZLPrupLl8Dxcevj" alt=""><figcaption></figcaption></figure>

* Fill in the required information, then click on `Done`

<div align="left"><figure><img src="/files/EeuIumq2NrlnimyhCDyz" alt="" width="442"><figcaption></figcaption></figure></div>

* Select your account on the list

<figure><img src="/files/k7EVUXjVB1hbScB0iQKe" alt=""><figcaption></figcaption></figure>

* Choose JSON type

<figure><img src="/files/NL5X946PZi1uFq4JMv50" alt=""><figcaption></figcaption></figure>

Now your key file has been downloaded to your computer

#### Setup GLPI

Go to **`Adminsitration`** > **`Cloud inventory`** > **`+Add`**

<figure><img src="/files/K4CEJipYhmZ1yP3elKeN" alt=""><figcaption></figcaption></figure>

### Alibaba

#### Create credentials

Check the documentation on identifier management : [Alibaba Cloud keys documentation](https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair)

Or simply follow these instructions:

* Log on to the [RAM console](https://ram.console.aliyun.com/?spm=a2c63.p38356.0.0.4f8b4688KexBmn) and sign in with your Alibaba Cloud account.
* Move the pointer over the profile picture in the upper-right corner of the page that appears and click **AccessKey Management**.
* In the Note message, read the security tips and click **Use Current AccessKey Pair**.

<div align="left"><figure><img src="/files/IThqAgg0Eq3Ge9710qQq" alt=""><figcaption></figcaption></figure></div>

* On the **AccessKey Pair** page, click **Create AccessKey**.
* In the Create AccessKey message, view the **AccessKey ID** and **AccessKey secret**.

  *You can click Download CSV File to download the \*\*AccessKey\** pair or click **Copy** to copy the **AccessKey** pair.\*
* Finally select I have saved the **AccessKey Secret**.

#### Setup GLPI

Go to **`Adminsitration`** > **`Cloud inventory`** > **`+Add`**

<figure><img src="/files/iEuQaI57ah4MJ3itgOZB" alt=""><figcaption></figcaption></figure>

### Entra

#### Create credentials

How to get your `Tenant ID` and `Client ID`

* Go to your Tenant and register a new application

<figure><img src="/files/xoI7YorBok87wLIFmALw" alt=""><figcaption></figcaption></figure>

* Go to Overview to get `Tenant ID` and `Client ID`

<figure><img src="/files/ncMtH1XiBIUCH229S10x" alt=""><figcaption></figcaption></figure>

* Go to `Certificates and secrets`
* Add `New client secret`
* Define `expires`
* Then saved

<figure><img src="/files/PEUrtUDHFoJtrHIxGz87" alt=""><figcaption></figcaption></figure>

The `Secret` value will be displayed (4)

{% hint style="warning" %}
Client secret value cannot be viewed, except for immediately after creation. Be sure to save the secret when created before leaving the page
{% endhint %}

* Go to **`Subscription`** > **`Access Control (IAM)`** > **`Add Role Assignment`**

<figure><img src="/files/RtEGBlgXqHHjwb9DMOsr" alt=""><figcaption></figcaption></figure>

* Search for `Microsoft.ClassicCompute`
* Select `Reader`
* Then `next`

<figure><img src="/files/JQnjS0nvqnflOLIV51UY" alt=""><figcaption></figcaption></figure>

* Select `cloudinventory` (application) previously created
* Then click on `Review + assign`

<figure><img src="/files/Vyg9EQWoqmEbgyqg6HNy" alt=""><figcaption></figcaption></figure>

#### Setup GLPI

Go to **`Adminsitration`** > **`Cloud inventory`** > **`+Add`**

<figure><img src="/files/iSbhqLuOjg4hc0lYJ3LL" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In some cases, `global Endoints` are available.

If you have more than one zone, or if you don't know where your machines are located, `global Endoints` are available:

* `Test all endpoints` groups all the `endpoints`
* `Only Europe endpoints` groups `endpoints` located in `Europe`
* etc.

This means that synchronisation will take longer.
{% endhint %}

***

## Right

The plugin offers complete rights management.

Go to `Administration` > `Profiles` > `Cloud Inventory`

* **Provider**
  * Read
  * Update
  * Delete
  * Purge
  * Run discovery
* **CloudInstance**
  * Update
  * Sync
  * Get date from API
  * Purge
* **Dashboard**
  * See dashbaord

<figure><img src="/files/xYMhCpioYrkQ2dSEaxRH" alt="images/right.png"><figcaption></figcaption></figure>

***

## Discovery

Now that our provider has been created into GLPI, we can start working on the cloud inventory.

* For each provider you can manually trigger synchronisation here :

<figure><img src="/files/jJdZvFmayADH575gIk5O" alt="images/view_discovery.png"><figcaption></figcaption></figure>

* You will be able to visualize the progress of the discovery.

<figure><img src="/files/LBQvlIaYiXvtPn7oxeAO" alt="images/run_discovery.png"><figcaption></figcaption></figure>

* Or simply configure related automatic actions (you can filter by provider name (e.g. OVH)) (see see [CronTask](https://glpi-plugins.readthedocs.io/en/latest/cloudinventory/crontask.html))

<figure><img src="/files/wCknxAay9nkakyLIFw65" alt="images/automatic_discovery.png"><figcaption></figcaption></figure>

***

## Cloud Instance

Each cloud asset found is registered in the plugin in a `CloudInstance` object

* You can find the list of `CloudInstance` here

<figure><img src="/files/OU2Z2N9UUR7okHRV8zoF" alt="images/view_instances.png"><figcaption></figcaption></figure>

* Or from the provider (and dedicated tab)

<figure><img src="/files/L17vYPe8Hq2DW5CS2xsc" alt="images/view_provider_instances.png"><figcaption></figcaption></figure>

{% hint style="info" %}
The `refresh` action lets you manually execute synchronisation for a CloudInstance
{% endhint %}

{% hint style="info" %}
The status of the related *CronTask* is displayed (see [CronTask](#crontask)) A button allows you to `activate` or `deactivate` it

<img src="/files/izfnvP5TN3BVoay2hVlg" alt="" data-size="original">
{% endhint %}

* Click on `CloudInstance` link to get more information :

<figure><img src="/files/qKEyGj0TQ3u5go19dQjI" alt="images/instance_details.png"><figcaption></figcaption></figure>

{% hint style="warning" %}
Synchronised `Cloud Instances` are automatically assigned to the same `entity` as the `Provider` from which they originate.
{% endhint %}

* **GLPI Computer**
  * Related GLPI Computer found
  * Reconciliation type for this *CloudInstance* (name or MAC)

{% hint style="info" %}
**Unknown GLPI computer**

There are several reasons for this :

* The computer does not yet exist in GLPI (you can then install the GLPI agent to bring it up and then restart the discovery of cloud instances to make the link).

* Reconciliation (using the MAC or the name of the cloud instance) couldn't find a computer.

* Check that the MAC address or name exists in GLPI

* You can manually select the corresponding computer (Don't forget to lock the computer to prevent the next discovery from overwriting your selection.)

* Contact us to improve the reconciliation method
  {% endhint %}

* **Provider**
  * provider name (link to GLPI provider form)
  * Button to synchronize this instance now

* **Cloud Instance**
  * Instance name
  * Instance display name
  * Instance ID
  * Project ID
  * Projcet name
  * Model
  * State
  * Location
  * Datacenter

* **Backups**
  * Has backup ?
  * Backup state
  * List of backups
  * Scheduled

A final section, `API data`, gives you direct access to the `API` information for related `Cloud Instance`.

<figure><img src="/files/WHTNAghtvMwSRCObUIAp" alt="images/instance_api.png"><figcaption></figcaption></figure>

***

## Crontask

For each provider and each instance type, a dedicated automatic task enables regular synchronisation between the data from the APIs and the data from GLPI.

<figure><img src="/files/YjHfKzxiD7COh8VFB5lo" alt="images/crontask.png"><figcaption></figcaption></figure>

***

## Search

The plugin adds new criteria to computer search engine.

From the list of computers it is possible to filter the result on data from related `CloudInstance` (if `CloudInstance` is linked to it).

<figure><img src="/files/q6HarqmfmNtknKgexWwe" alt="images/search.png"><figcaption></figcaption></figure>

***

## Dashboard

The `CloudInventory` plugin offers a dashboard to display a summary of `CloudInstance`

<figure><img src="/files/Xu6zqdomeuWj0PI4xUcQ" alt="images/dashboard.png"><figcaption></figcaption></figure>

***

## Rules asset

The plugin adds new criteria to the `Business Rules for asset`

<figure><img src="/files/thx35p82Hwp0qpI8Yn9I" alt="images/rules_asset.png"><figcaption></figcaption></figure>

Each time a computer is updated (manually or dynamically), if it is linked to a `CloudInstance`, the engine will receive the following data (when available)

* `CloudInventory - Instance ID`
* `CloudInventory - Instance Display name`
* `CloudInventory - Instance Name`
* `CloudInventory - Project Name`
* `CloudInventory - Has backup`
* `CloudInventory - State`
* `CloudInventory - Location`
* `CloudInventory - Datacenter`
* `CloudInventory - Instance type`

***

## Log

If debug mode is enabled for a dedicated provider

<figure><img src="/files/iH1PXQL7W5TKMltLjJlH" alt="images/log.png"><figcaption></figcaption></figure>

A new log file will be automatically created and will contain various information following execution of the synchronisation

Ex : for `Ovh` provider and `VPS` synchronisation a file named `ovh-{{instance-type}}-{{provider_name}}-error.log` will be created in the `glpi/files/_log/` folder and will contain the errors encountered during its execution

***

## FAQ

If you have any questions about using the plugin, please consult our FAQ

<a href="/spaces/SvoJ3lioglS2UZLcWWyP/pages/Yo7GOU75V7qua3cBkZTp" class="button secondary">Go to FAQ</a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.glpi-project.org/doc-plugins/plugin-glpi-network/cloudinventory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
