# Data Sources

In the datasources section describes data sources

# Common

  • HCL
  • Yaml
datasources {
  clickhouse "ch1" {
    host = "domain.com"
    port = 6440
    username = "username"
    password = "password"
    database = "database"
    sslCertPath = "/path/to/cert.crt"
    timeout = 3000 
  }
  prometheus "prom1" {
    url = "domain.com"
    timeout = 3000
    basicAuth {
      username = "username"
      password = "password"
    }
  }
  postgres "pg1" {
    host = "domain.com"
    port = 5432
    username = "username"
    password = "password"
    database = "database"
    sslMode = "verify-full"
    sslCertPath = "/path/to/cert.crt"
    timeout = 3000
  }
  mysql "mysql1" {
    dsn = "user:[email protected](127.0.0.1:3306)/database"
    timeout = 3000
  }
  loki "loki1" {
    url = "domain.com"
    timeout = 5000
    basicAuth {
      username = "username"
      password = "password"
    }
  }
}

# Type Clickhouse

  • HCL
  • Yaml
clickhouse "ch1" {
  host = "domain.com"
  port = 6440
  username = "username"
  password = "password"
  database = "database"
  sslCertPath = "/path/to/cert.crt"
  timeout = 3000
}

# name (string)

Required, Unique

Datasource name

This name uses for connect to datasource from scripts. For example:

local ds = require('datasource.clickhouse.ch1')

# host (string)

Required

Connection host

# port (int)

By default: 6440

Connection port

# username (string)

By default: default

Connection username

# password (string)

By default: empty string

Connection password

# database (string)

By default: default

Connection database

# sslCertPath (string)

By default: empty string

Path to SSL cert. If empty, SSL do not use

# timeout

By default: 5000

Timeout, milliseconds


# Type Prometheus

  • HCL
  • Yaml
prometheus "prom1" {
  url = "domain.com"
  timeout = 3000
  basicAuth {
    username = "username"
    password = "password"
  }
}

# name (string)

Required, Unique

Datasource name

local ds = require('datasource.prometheus.prom1')

# url (string)

Required

Request URI. API path /api/v1/... will be added

# basicAuth (string)

Username and password, if Prometheus require Basic Auth

# timeout

By default: 5000

timeout, milliseconds


# Type Postgres

  • HCL
  • Yaml
postgres "pg1" {
  host = "domain.com"
  port = 5432
  username = "username"
  password = "password"
  database = "database"
  sslMode = "verify-full"
  sslCertPath = "/path/to/cert.crt"
  timeout = 3000
}

# name (string)

Required, Unique

Datasource name

local ds = require('datasource.postgres.pg1')

# host (string)

Required

Connection host

# port (int)

By default: 5432

Connection port

# username (string)

By default: postgres

Connection username

# password (string)

By default: postgres

Connection password

# database (string)

By default: postgres

Connection database

# sslMode (string)

By default disable

SSL mode

# sslCertPath (string)

By default: empty string

Path to SSL cert

# timeout

By default: 5000

timeout, milliseconds


# Type Loki

  • HCL
  • Yaml
loki "loki1" {
  url = "domain.com"
  timeout = 5000
  basicAuth {
    username = "username"
    password = "password"
  }
}

# name (string)

Required, Unique

Datasource name

local ds = require('datasource.loki.loki1')

# url (string)

Required

Request URI. API path /api/v1/... will be added

# timeout

By default: 5000

timeout, milliseconds

# basicAuth (string)

Username and password, if Loki require Basic Auth


# Type MySQL

  • HCL
  • Yaml
mysql "mysql1" {
  dsn = "user:[email protected](127.0.0.1:3306)/database"
  timeout = 3000
}

# name (string)

Required, Unique

Datasource name

local ds = require('datasource.postgres.mysql1')

# dsn (string)

Required

DSN (Data Source Name) for connect to DB

Format: [username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]

An example: user:[email protected](127.0.0.1:3306)/db

golang packge (opens new window) for more information about DSN

# timeout

By default: 5000

timeout, milliseconds

Last Updated: 1/10/2022, 8:14:44 AM