Configuration settings
To configure the PI AF extractor, you must edit the configuration file. The file is in YAML format, and the sample configuration file contains all valid options with default values.
You can leave many fields empty to let the extractor use the default values. The configuration file separates the settings by component, and you can remove an entire component to disable it or use the default values.
Sample configuration files
In the extractor installation folder, the /config
subfolder contains sample complete and minimal configuration files. The values wrapped in ${}
are replaced with environment variables with that name. For example ${COGNITE_PROJECT}
will be replaced with the value of the environment variable called COGNITE_PROJECT
.
The configuration file also contains the global parameter version
, which holds the version of the configuration schema used in the configuration file. This document describes version 1 of the configuration schema.
Not that it is not recommended to use the config.example.yml
as a basis for configuration files. This file contains all configuration options, which is both hard to read, and may cause issues. It is intended as a reference showing how each option is configured, not as a basis. Use config.minimal.yml
instead.
You must name the configuration file config.yml.
You can set up extraction pipelines to use versioned extractor configuration files stored in the cloud.
Before you start
- Optionally, copy one of the sample files in the
config
directory and rename it toconfig.yml
. - The
config.minimal.yml
file doesn't include a metrics section. Copy this section from the example below if the extractor is required to send metrics to a Prometheus Pushgateway. - Set up an extraction pipeline and note the external ID.
Minimal YAML configuration file
version: 1
pi:
# Required, host for the PI server
host: "${PI_HOST}"
# Windows username on the PI server
username: "${PI_USERNAME}"
# Windows password on the PI server
password: "${PI_PASSWORD}"
destination:
# Change these to make sure you get the data somewhere unique in Raw
database: piaf
elements-table: elements
cognite:
# The project to connect to in the API, uses the environment variable COGNITE_PROJECT.
project: "${COGNITE_PROJECT}"
# This is for microsoft as IdP, to use a different provider,
# set implementation: Basic, and use token-url instead of tenant.
# See the example config for the full list of options.
idp-authentication:
# Directory tenant
tenant: ${COGNITE_TENANT_ID}
# Application Id
client-id: ${COGNITE_CLIENT_ID}
# Client secret
secret: ${COGNITE_CLIENT_SECRET}
# List of resource scopes, ex:
# scopes:
# - scopeA
# - scopeB
scopes:
- ${COGNITE_SCOPE}
logger:
console:
level: "information"
file:
level: "debug"
path: "logs/log.txt"
Intervals
In most places where time intervals are required, you can use a CDF-like syntax of [N][timeunit]
, for example 10m
for 10 minutes or 1h
for 1 hour. timeunit
is one of d
, h
, m
, s
, ms
. You can also use a cron expression in some places.
Using values from Azure Key Vault
The PI AF extractor also supports loading values from Azure Key Vault. To load a configuration value from Azure Key Vault, use the !keyvault
tag followed by the name of the secret you want to load. For example, to load the value of the my-secret-name
secret in Key Vault into a password
parameter, configure your extractor like this:
password: !keyvault my-secret-name
To use Key Vault, you also need to include the azure-keyvault
section in your configuration, with the following parameters:
Parameter | Description |
---|---|
keyvault-name | Name of Key Vault to load secrets from |
authentication-method | How to authenticate to Azure. Either default or client-secret . For default , the extractor will look at the user running the extractor, and look for pre-configured Azure logins from tools like the Azure CLI. For client-secret , the extractor will authenticate with a configured client ID/secret pair. |
client-id | Required for using the client-secret authentication method. The client ID to use when authenticating to Azure. |
secret | Required for using the client-secret authentication method. The client secret to use when authenticating to Azure. |
tenant-id | Required for using the client-secret authentication method. The tenant ID of the Key Vault in Azure. |
Example:
azure-keyvault:
keyvault-name: my-keyvault-name
authentication-method: client-secret
tenant-id: 6f3f324e-5bfc-4f12-9abe-22ac56e2e648
client-id: 6b4cc73e-ee58-4b61-ba43-83c4ba639be6
secret: 1234abcd
Configure the PI AF extractor
PI AF Extractor configuration
Parameter | Type | Description |
---|---|---|
version | integer | Version of the config file, the extractor specifies which config file versions are accepted in each version of the extractor. |
pi | object | Include the pi section to configure the connection to the PI AF system. |
cognite | object | Configure connection to Cognite Data Fusion (CDF) |
extraction | object | Include the extraction section to configure how to extract data from PI AF. |
destination | object | Include the destination section to configure the destination for the extracted data. Currently this is only the CDF staging area (RAW). |
metrics | object | Configuration for publishing metrics. |
logger | object | Configuration for logging to console or file. Log entries are either Fatal , Error , Warning , Information , Debug , or Verbose , in order of decreasing priority. The extractor will log any messages at an equal or higher log level than the configured level for each sink. |
pi
Global parameter.
Include the pi
section to configure the connection to the PI AF system.
This is how the PI AF extractor selects a system:
- If you configure
system-name
, the extractor selects the system by name from the preconfigured list of PI system on the machine the extractor runs on. - If you configure
host
, the extractor selects a PI system running on the PI server's host. - If you don't configure either of these parameters, the extractor selects the default system on the machine the extractor runs on. If there is no default system, the extractor selects the first system from the preconfigured PI system list on the machine the extractor runs on.
Parameter | Type | Description |
---|---|---|
host | string | Insert the base URL of the PI server's host. If you don't enter any value, you must configure a PI system in the installed SDK on the machine the extractor runs on. |
username | string | Required. Insert the Windows username on the PI server. |
password | string | Required. Insert the Windows password on the PI server. |
system-name | string | Enter the name of the PI system you want to use. This is used instead of host to select a PI system. |
database-name | string | Enter the name of the PI database you want to use. The default value is the default database configured on the machine the extractor runs on or the first database in the list of no default database in configured. |
cognite
Global parameter.
Configure connection to Cognite Data Fusion (CDF)
Parameter | Type | Description |
---|---|---|
project | string | CDF project to connect to. |
idp-authentication | object | The idp-authentication section enables the extractor to authenticate to CDF using an external identity provider (IdP), such as Microsoft Entra ID (formerly Azure Active Directory).See OAuth 2.0 client credentials flow |
host | string | Insert the base URL of the CDF project. Default value is https://api.cognitedata.com . |
cdf-retries | object | Configure automatic retries on requests to CDF. |
cdf-chunking | object | Configure chunking of data on requests to CDF. Note that increasing these may cause requests to fail due to limits in the API itself |
cdf-throttling | object | Configure the maximum number of parallel requests for different CDF resources. |
sdk-logging | object | Configure logging of requests from the SDK |
nan-replacement | either number or null | Replacement for NaN values when writing to CDF. If left out, NaN values are skipped. |
extraction-pipeline | object | Configure an associated extraction pipeline |
certificates | object | Configure special handling of SSL certificates. This should never be considered a permanent solution to certificate problems |