# Example

TIP

Balerter supports yaml and hcl formats for the configuration file.

# Details

# Names

You must use unique names for each item within sections with repeated items.

A correct example:

  • HCL
  • Yaml
datasources {
    clickhouse "db1" {
        // ...
    }
    clickhouse "db2" {
        // ...
    }
    postgres "db1" {
        // ...
    }
    postgres "db2" {
        // ...
    }
}

# Secrets

You can use secrets in the configuration file for masking private information.

Read more

# Example

An example of the configuration file with all options

  • HCL
  • Yaml
scripts {
  updateInterval = 5000
  folder "scripts"{
    path = "/opt/scripts"
    mask = "*.lua" 
  }
  file "demo1" {
    filename = "/path/to/demo.lua"
  }
}

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"
    }
  }
}


channels {
  slack "slack-notification" {
    token = "SLACK-APPLICATION-TOKEN"
    channel = "notification"
    ignore = false
  }
  telegram "tg1" {
    token = "TELEGRAM-BOT-TOKEN"
    chatId = 100500
    timeout = 5000
    proxy {
      address = "10.20.30.40:5060"
      auth {
        username = "username"
        password = "password"
      }
    }
    ignore = false
  }
  syslog "default" {
    tag = "balerter"
    network = "tcp"
    address = "127.0.0.1:10515"
    priority = "EMERG|DAEMON"
    ignore = false
  }
  notify "default" {
    icons {
      success = "/path/to/logo-success.png"
      error = "/path/to/logo-error.png"
      warning = "/path/to/logo-warning.png"
    }
    ignore = false
  }
  email "default" {
    from = "[email protected]"
    to = "[email protected]"
    cc = "[email protected]"
    host = "bar.com"
    port = 1234
    username = "user"
    password = "secret"
    secure = "ssl"
    timeout = 10
    ignore = false
  }
  discord "default" {
    token = "ABCD"
    channelId = 1234
    ignore = false
  }
  webhook "wh1" {
    settings {
      url = "http://domain.com"
      method = "POST"
      auth {
        type = "basic"
        login = "user"
        password = "secret"
      }
      payload {
        queryParams {
          foo = "bar"
        }
        body = "body content"
      }
      timeout = 5000
      headers {
        X-Foo = "Bar"
      }
    }
    ignore = false
  }
  
  alertmanager "am1" {
    settings {
      // webhook settings
    }
    ignore = false
  }

  alertmanager_receiver "am2" {
    settings {
      // webhook settings
    }
    ignore = false
  }
  
  twilioVoice "tw1" {
    sid = "ABCD"
    token = "ABCD"
    from = "+11111111111"
    to = "+11111111111"
    twiml = "<Response><Say>{TEXT}</Say></Response>"
    ignore = false
    timeout = 5000
  }
}

storagesCore {
  sqlite "mySqliteStorage" {
    path = "/path/to/file"
    timeout = 1000
    tableKV {
      table = "kv"
      fields = {
        key = "key"
        value = "value"
      }
    }
    tableAlerts {
      table = "alerts"
      fields {
        name = "id"
        level = "level"
        count = "count"
        createdAt = "created_at"
        updatedAt = "updated_at"
      }
    }
  }
  
  postgres "pg1" {
    host = "domain.com"
    port = 5432
    username = "username"
    password = "password"
    database = "database"
    sslMode = "verify-full"
    sslCertPath = "/path/to/cert.crt"
    timeout = 3000
    tableKV = {} // same as sqlite above
    tableAlerts = {} // same as sqlite above
  }
}

storagesUpload {
  s3 "dev" {
    region = "us-east1"
    key = "SOME_KEY"
    secret = "SOME_SECRET"
    endpoint = "SOME_ENDPOINT"
    bucket = "SOME_BUCKET" 
  }
}

api {
  address = "127.0.0.1:2000"
  serviceAddress = "127.0.0.1:2001"
}

storageAlert = "memory"
storageKV = "sqlite.mySqliteStorage"
luaModulesPath = "./?.lua;./modules/?.lua;./modules/?/init.lua;/modules/?.lua;/modules/?/init.lua"

system {
  jobWorkersCount = 32
  cronLocation = 'UTC'
}
Last Updated: 10/6/2021, 4:54:48 PM