fluent-plugin-azuremonitormetrics

Input plugin for Azure Monitor Metrics.


Keywords
azure, azure-monitor-metrics, fluentd, metrics
License
MIT
Install
gem install fluent-plugin-azuremonitormetrics -v 0.0.4

Documentation

fluent-plugin-azuremonitormetric, a plugin for Fluentd

Overview

Azure Monitor Metrics input plugin.

This plugin gets the monitor metrics from Azure Monitor API to fluentd.

Installation

To use this plugin, you need to have Azure Service Principal.
Create an Azure Service Principal through Azure CLI or Azure portal.

Install from RubyGems:

$ gem install fluent-plugin-azuremonitormetrics

Configuration

<source>
  @type         azuremonitormetrics
  tag           azuremonitormetrics
  tenant_id     [Azure_Tenant_ID]
  client_id     [Azure_Client_Id]
  client_secret [Azure_Client_Secret]

  timespan          [timespan in second] (default: 300)
  interval          [time grain of the query: string] (default: PT1M)
  resource_uri      [the identifier of the resource]
  aggregation       [list of aggregation types] (example: Average,count)
  top               [Max number of records to retrive]
  orderby           [The aggregation to use for sorting] (example: "sum asc")
  filter            [filter to reduce metric data] (example A eq 'a1' and B eq '*')
  result_type       [reduces the set of data collected]
  metrics           [The name of the metrics to retrive, sperated by commas] (example: Network Out,Percentage CPU)
  api_version       [api version]   (default: "2016-09-01")
</source>

Documentation for all the parameters can found here
This plugin is porting from fluent-plugin-cloudwatch

Start fluentd:

$ fluentd -c ./fluentd.conf

output data format

Example of Average and Count aggregations on Percentage CPU and Network Out metrics, on timespan of 5 minutes and 5 minute grain:

2017-10-22 14:25:28 azuremonitormetrics [
   {
      "data":[
         {
            "timeStamp":"2017-11-23T14:30:00Z",
            "count":200.0,
            "average":1115.29
         }
      ],
      "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Compute/virtualMachines/mymachine/providers/Microsoft.Insights/metrics/Network Out",
      "name":{
         "value":"Network Out",
         "localizedValue":"Network Out"
      },
      "type":"Microsoft.Insights/metrics",
      "unit":"Bytes"
   },
   {
      "data":[
         {
            "timeStamp":"2017-11-23T14:30:00Z",
            "count":40.0,
            "average":0.732
         }
      ],
      "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Compute/virtualMachines/mymachine/providers/Microsoft.Insights/metrics/Percentage CPU",
      "name":{
         "value":"Percentage CPU",
         "localizedValue":"Percentage CPU"
      },
      "type":"Microsoft.Insights/metrics",
      "unit":"Percent"
   }
]

Test

Run tests:

$ rake test

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request