Giter Site home page Giter Site logo

j-sokol / azure-resourcegraph-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webdevops/azure-resourcegraph-exporter

0.0 0.0 0.0 398 KB

Prometheus exporter for Azure ResourceGraph queries

License: MIT License

Dockerfile 2.41% Makefile 5.19% Go 48.18% HTML 44.21%

azure-resourcegraph-exporter's Introduction

Azure ResourceGraph exporter

license DockerHub Quay.io Artifact Hub

Prometheus exporter for Azure ResourceGraph queries with configurable fields and transformations.

Usage

Usage:
  azure-resourcegraph-exporter [OPTIONS]

Application Options:
      --debug               debug mode [$DEBUG]
  -v, --verbose             verbose mode [$VERBOSE]
      --log.json            Switch log output to json format [$LOG_JSON]
      --azure-environment=  Azure environment name (default: AZUREPUBLICCLOUD) [$AZURE_ENVIRONMENT]
      --azure-subscription= Azure subscription ID [$AZURE_SUBSCRIPTION_ID]
  -c, --config=             Config path [$CONFIG]
      --bind=               Server address (default: :8080) [$SERVER_BIND]

Help Options:
  -h, --help                Show this help message

for Azure API authentication (using ENV vars) see https://docs.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication

Configuration file

HTTP Endpoints

Endpoint Description
/metrics Default prometheus golang metrics
/probe Execute resourcegraph queries without set module name
/probe?module=xzy Execute resourcegraph queries for module xzy
/probe?module=xzy&cache=2m Execute resourcegraph queries for module xzy and enable caching for 2 minutes

Global metrics

Metric Description
azure_resourcegraph_query_time Summary metric about query execution time (incl. all subqueries)
azure_resourcegraph_query_results Number of results from query
azure_resourcegraph_query_requests Count of requests (eg paged subqueries) per query

AzureTracing metrics

(with 22.2.0 and later)

Azuretracing metrics collects latency and latency from azure-sdk-for-go and creates metrics and is controllable using environment variables (eg. setting buckets, disabling metrics or disable autoreset).

Metric Description
azurerm_api_ratelimit Azure ratelimit metrics (only on /metrics, resets after query due to limited validity)
azurerm_api_request_* Azure request count and latency as histogram

Settings

Environment variable Example Description
METRIC_AZURERM_API_REQUEST_BUCKETS 1, 2.5, 5, 10, 30, 60, 90, 120 Sets buckets for azurerm_api_request histogram metric
METRIC_AZURERM_API_REQUEST_ENABLE false Enables/disables azurerm_api_request_* metric
METRIC_AZURERM_API_REQUEST_LABELS apiEndpoint, method, statusCode Controls labels of azurerm_api_request_* metric
METRIC_AZURERM_API_RATELIMIT_ENABLE false Enables/disables azurerm_api_ratelimit metric
METRIC_AZURERM_API_RATELIMIT_AUTORESET false Enables/disables azurerm_api_ratelimit autoreset after fetch
azurerm_api_request label Status Description
apiEndpoint enabled by default hostname of endpoint (max 3 parts)
routingRegion enabled by default detected region for API call, either routing region from Azure Management API or Azure resource location
subscriptionID enabled by default detected subscriptionID
tenantID enabled by default detected tenantID (extracted from jwt auth token)
resourceProvider enabled by default detected Azure Management API provider
method enabled by default HTTP method
statusCode enabled by default HTTP status code

Example

Config file:

queries:
  - metric: azure_resourcestype_count
    query: |-
      Resources
      | summarize count() by type
    fields:
      - name: count_
        type: value

Metrics:

# HELP azure_resourcestype_count azure_resourcestype_count
# TYPE azure_resourcestype_count gauge
azure_resourcestype_count{type="microsoft.compute/virtualmachinescalesets"} 2
azure_resourcestype_count{type="microsoft.containerservice/managedclusters"} 1
azure_resourcestype_count{type="microsoft.keyvault/vaults"} 2
azure_resourcestype_count{type="microsoft.managedidentity/userassignedidentities"} 2
azure_resourcestype_count{type="microsoft.network/networksecuritygroups"} 1
azure_resourcestype_count{type="microsoft.network/networkwatchers"} 2
azure_resourcestype_count{type="microsoft.network/routetables"} 3
azure_resourcestype_count{type="microsoft.network/virtualnetworks"} 2
azure_resourcestype_count{type="microsoft.storage/storageaccounts"} 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.