Prometheus exporter for the OVH API.
To generate a unique link on the OVH Api Portal with the correct OVH permissions needed for this project, run:
ovh-exporter credentialsAlternatively, you can use Go:
go run cmd/ovh-exporter/main.go credentialsOnce you have the credentials, create a ovh-exporter.env file containing the following variables:
export OVH_ENDPOINT="ovh-eu"
export OVH_APP_KEY=""
export OVH_APP_SECRET=""
export OVH_CONSUMER_KEY=""
export OVH_CLOUD_PROJECT_INSTANCE_BILLING_PROJECT_IDS=""
export OVH_CACHE_UPDATE_INTERVAL="300"
export SERVER_PORT="8080"To use the compose, add a ovh-exporter.env file at the root of your project with the variables filled in:
OVH_ENDPOINT="ovh-eu"
OVH_APP_KEY=""
OVH_APP_SECRET=""
OVH_CONSUMER_KEY=""
OVH_CLOUD_PROJECT_INSTANCE_BILLING_PROJECT_IDS=""
OVH_CACHE_UPDATE_INTERVAL="300"
SERVER_PORT="8080"The projects' id can be found in the Public Cloud tab of OVH console.
To run the exporter, execute the following command:
ovh-exporter serveIf you prefer using the compose, use:
nerdctl compose upFollow these steps to add new metrics:
- Add the required routes in
pkg/credentials/generatefor the OVH API Token. - Add the API calls in
ovhsdk/api. Create a new file for each route. - Define the models in
ovhsdk/modelsbased on the schema from the API responses. - Create the metric in
pkg/networksand write the necessary custom code. - Update the initialization functions in
pkg/network/serve.goby adding your functions toinitializeMetrics()andupdateMetrics().
Once you've added the metric, test it by running the Compose file. If needed, set up port forwarding, and then run the following command:
curl -s 0.0.0.0:<port>/metrics | grep "your_metric"Example
curl -s 0.0.0.0:8080/metrics | grep "ovh_exporter_services_savingsplans_subscribed"