azure-resources-exporter
Warning, this exporter is still a work in progress
Prometheus exporter exposing Azure resources API results as metrics.
This exporter does not export metrics from Azure Monitor API, use azure_metrics_exporter for that.
Getting Started
Azure account requirements
This exporter call Azure API from an existing subscription with these requirements:
- An application must be registered (e.g., Azure Active Directory -> App registrations -> New application registration)
Prerequisites
To run this project, you will need a working Go environment.
Installing
go get -u github.com/FXinnovation/azure-resources-exporter
Building
Build the sources with
make build
Run the binary
./azure-resources-exporter
The exporter expects these environment variables to configure the Azure API
connection.
Environment Variable |
Description |
AZURE_SUBSCRIPTION_ID |
Found under properties in the Azure portal for your application/service |
AZURE_TENANT_ID |
Found under Azure Active Directory > Properties and listed as Directory ID |
AZURE_CLIENT_ID |
Also listed as Application Id , is obtained by registering an application under 'Azure Active Directory' |
AZURE_CLIENT_SECRET |
Is generated by selecting your application/service under Azure Active Directory, selecting 'keys', and generating a new key |
By default, the exporter optional config file is expected in config/config.yml
.
Use -h flag to list available options.
Testing
Running unit tests
make test
Configuration
No configuration is supported yet in config/config.yml
(WIP)
Docker image
You can build a docker image using:
make docker
The resulting image is named fxinnovation/azure-resources-exporter:<git-branch>
.
It exposes port 9259 and expects an optional config in /opt/azure-resources-exporter/config.yml
.
To configure it, you must pass the envionment variable, and you can bind-mount a config from your host:
docker run -p 9259:9259 -v /path/on/host/config/config.yml:/opt/azure-resources-exporter/config/config.yml -e AZURE_SUBSCRIPTION_ID="my_subscription_id" -e AZURE_TENANT_ID="my_tenant_id" -e AZURE_CLIENT_ID="my_client_id" -e AZURE_CLIENT_SECRET="my_client_secret" fxinnovation/azure-resources-exporter:<git-branch>
Exposed metrics
Metric |
Description |
azure_tag_info |
Tags of the Azure resource |
virtual_machine_instance_up |
Running status of the virtual machine instance |
virtual_network_gateway_connection_up |
Connections status of the virtual network gateway |
app_service_plan_up |
Status of the app service plan |
web_app_up |
Status of the web app |
sql_server_up |
Status of the SQL server |
sql_database_up |
Status of the SQL database |
application_gateway_up |
Operational state of the application gateway |
automation_account_up |
State of the automation account |
service_fabric_cluster_up |
State of the service fabric cluster |
event_grid_topic_up |
Provisionning state of the event grid topic |
traffic_manager_profile_up |
Status of the traffic manager profile |
traffic_manager_profile_endpoint_up |
Status of the traffic manager profile endpoint |
recovery_services_vault_backup_item_vm_health_status |
Health status of the VM backup, as enum on health_status label |
recovery_services_vault_backup_item_vm_last_backup_status |
Last backup status of the VM backup, as enum on last_backup_status label |
recovery_services_vault_backup_item_vm_last_backup_time_seconds |
Unix/epoch time of the last VM backup |
Contributing
Refer to CONTRIBUTING.md.
License
Apache License 2.0, see LICENSE.