Skip to content

InfluxDB example

Daria Kharlan edited this page Nov 29, 2019 · 2 revisions

Input data

source data

This is what we have in our InfluxDb instance.

Pipeline configuration

> agent pipeline create
Choose source config (influx_source) [influx_source]:
Choose destination (http) [http]:
Pipeline ID (must be unique): influx_cpu
Measurement name: cpu
Value columns names: usage_active usage_idle
Target type (counter, gauge) [gauge]:
Dimensions: cpu host zone
Created pipeline influx_cpu
  • Measurement name: cpu - here we type our measurement name (like a table) from which we want to select data
  • Value columns names: usage_active usage_idle - these are our value fields (we can have type multiple values here), they can only be numeric
  • Dimensions: cpu host zone - these are tag fields, they can only be of string type

From this input the query to InfluxDB is formed: SELECT "cpu"::tag,"host"::tag,"zone"::tag,"usage_active"::field,"usage_idle"::field FROM "cpu" WHERE "time" > {last_timestamp} LIMIT {limit}. Agent makes this query and transforms data it's received to Anodot metrics

Output

[
  {
    "timestamp": 1555319249,
    "properties": {
      "target_type": "gauge",
      "cpu": "cpu-total-usage",
      "host": "msk-air-trn4",
      "zone": "GF",
      "measurement_category": "cpu",
      "what": "usage_active"
    },
    "value": 0.94
  },
  {
    "timestamp": 1555319249,
    "properties": {
      "target_type": "gauge",
      "cpu": "cpu-total-usage",
      "host": "msk-air-trn4",
      "zone": "GF",
      "measurement_category": "cpu",
      "what": "usage_idle"
    },
    "value": 30.77
  },
  {
    "timestamp": 1555319249,
    "properties": {
      "target_type": "gauge",
      "cpu": "cpu-total-usage",
      "host": "msk-air-trn0",
      "zone": "GEO",
      "measurement_category": "cpu",
      "what": "usage_active"
    },
    "value": 0.2
  },
  {
    "timestamp": 1555319249,
    "properties": {
      "target_type": "gauge",
      "cpu": "cpu-total-usage",
      "host": "msk-air-trn0",
      "zone": "GEO",
      "measurement_category": "cpu",
      "what": "usage_idle"
    },
    "value": 92.6
  }
]

This is example of an output which is sent to Anodot after running a pipeline with configuration above. Full file

Clone this wiki locally