Json Config File

The config file is organized into the below sections.

SectionPlatformsDescription
AmbientWeather ConfigAllThis section provides settings related to the AmbientWeather Network and scraping data from the cloud.
Observability ConfigAllThis section provides settings related to Metrics, Logs, and Traces for monitoring purposes.

AmbientWeather Config

AmbientWeather Local Server can also enrich additional data from the AmbientWeather Network. Some data is only calculated on the AmbientWeather cloud server and is not published by the local Console. To get this information, you need to enable enrichment in this section.

"AmbientWeather": {
  "EnrichFromAmbientWeatherNetwork": true,
  "UserApiKey": "<your api key>",
  "ApplicationKey": "<your application key>",
  "PollingFrequencySeconds": 60
}
FieldRequiredDefaultDescription
EnrichFromAmbientWeatherNetworknofalseWhether or not to scrape the cloud and enrich additional metrics. Learn more.
UserApiKeyyes (if enrichment is enabled)nullYour AmbientWeather User API key.
ApplicationKeyyes (if enrichment is enabled)nullYour AmbientWeather Application key.
PollingFrequencySecondsno60How frequently, in seconds, to scrape data from the AmbientWeather Network.

User Api Key

You will have to generate a new Api key (also referred to as a Device Key) for AmbientWeather Local Server to use. To generate this key:

  1. Login to your AmbientWeather.net account settings
  2. Near the bottom of your Account Settings page, look for the API Keys section
  3. Click Create API Key
  4. Give your new a key a friendly name in the Label column and save
  5. This will be your User API Key

Application Key

You will have to generate a new Application key for AmbientWeather Local Server to use. To generate this key:

  1. Login to your AmbientWeather.net account settings
  2. Near the bottom of your Account Settings page, look for the API Keys section
  3. Near the bottom of this section, look for

    Developers: An Application Key is also required for each application that you develop. Click here to create one.

  4. Click on the link in that message
  5. Type anything in the provided text box, then click Create Application Key
  6. Give your new a key a friendly name in the Label column and save
  7. This will be your Application Key

Observability Config

AmbientWeather Local Server supports publishing OpenTelemetry Metrics, Logs, and Trace. This section provides settings related to those pillars.

The Observability config section contains three main sub-sections:

  1. Metrics - Metrics
  2. Traces - Traces
  3. Serilog - Logs
"Observability": {

    "Metrics": {
      "Enabled": false
    },

    "Traces": {
      "Enabled": false,
      "AgentHost": "localhost",
      "AgentPort": 6831
    },

    "Serilog": {
      "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
      "MinimumLevel": "Information",
      "WriteTo": [
        { "Name": "Console" },
        {
          "Name": "File",
          "Args": {
            "path": "./output/log.txt",
            "rollingInterval": "Day",
            "retainedFileCountLimit": 7
          }
        }
      ]
    }
  }

Metrics Config

"Metrics": {
      "Enabled": false
    }
FieldRequiredDefaultDescription
EnablednofalseWhether or not to expose metrics. Metrics will be available at http://localhost:8080/metrics

If you are using Docker, ensure you have exposed the port from your container.

Example Prometheus scraper config

- job_name: 'ambientweather'
    scrape_interval: 60s
    static_configs:
      - targets: [<ambientWeatherLocalServerIPaddress>:<ambientWeatherLocalServerPort>]
    tls_config:
      insecure_skip_verify: true

Traces Config

"Traces": {
      "Enabled": false,
      "AgentHost": "localhost",
      "AgentPort": 6831
    }
FieldRequiredDefaultDescription
EnablednofalseWhether or not to generate traces.
AgentHostyes - if Enalbed=truenullThe host address for your trace collector.
AgentPortyes - if Enabled=truenullThe port for your trace collector.

Serilog Config

"Serilog": {
      "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Grafana.Loki" ],
      "MinimumLevel": {
        "Default": "Information",
        "Override": {
          "Microsoft": "Error",
          "System": "Error"
        }
      },
      "WriteTo": [
        { "Name": "Console" },
        {
          "Name": "File",
          "Args": {
            "path": "./output/log.txt",
            "rollingInterval": "Day",
            "retainedFileCountLimit": 7
          }
        },
        {
          "Name": "GrafanaLoki",
          "Args": {
            "uri": "http://192.168.1.95:3100",
            "textFormatter": "Serilog.Sinks.Grafana.Loki.LokiJsonTextFormatter, Serilog.Sinks.Grafana.Loki",
            "labels": [
              {
                "key": "app",
                "value": "p2g"
              }
            ]
          }
        }]
}
FieldRequiredDefaultDescription
UsingnonullA list of sinks you would like use. The valid sinks are listed in the example above.
MinimumLevelnonullThe minimum level to write. [Verbose, Debug, Information, Warning, Error, Fatal]
WriteTononullAdditional config for various sinks you are writing to.

More detailed information about configuring Logging can be found on the Serilog Config Repo.