2018-05-15 08:15:40 +08:00
# HTTP Output Plugin
2022-04-21 23:45:47 +08:00
This plugin sends metrics in a HTTP message encoded using one of the output data
formats. For data_formats that support batching, metrics are sent in batch
format by default.
2018-05-15 08:15:40 +08:00
2022-10-27 03:58:36 +08:00
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
In addition to the plugin-specific configuration settings, plugins support
additional global and plugin configuration settings. These settings are used to
modify metrics, tags, and field or create aliases and configure ordering, etc.
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md
2021-11-25 02:47:33 +08:00
## Configuration
2018-05-15 08:15:40 +08:00
2022-05-25 22:48:59 +08:00
```toml @sample .conf
2018-05-15 08:11:44 +08:00
# A plugin that can transmit metrics over HTTP
2018-05-15 08:15:40 +08:00
[[outputs.http]]
2018-05-15 08:11:44 +08:00
## URL is the address to send metrics to
2019-06-15 02:29:58 +08:00
url = "http://127.0.0.1:8080/telegraf"
2018-05-15 08:11:44 +08:00
## Timeout for HTTP message
# timeout = "5s"
## HTTP method, one of: "POST" or "PUT"
# method = "POST"
## HTTP Basic Auth credentials
# username = "username"
# password = "pa$$word"
2018-09-07 01:54:05 +08:00
## OAuth2 Client Credentials Grant
# client_id = "clientid"
# client_secret = "secret"
# token_url = "https://indentityprovider/oauth2/v1/token"
# scopes = ["urn:opc:idm:__myscopes__"]
2022-05-25 07:33:02 +08:00
## Goole API Auth
# google_application_credentials = "/etc/telegraf/example_secret.json"
2018-05-15 08:11:44 +08:00
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
2021-07-14 05:58:49 +08:00
## Optional Cookie authentication
# cookie_auth_url = "https://localhost/authMe"
# cookie_auth_method = "POST"
# cookie_auth_username = "username"
# cookie_auth_password = "pa$$word"
2022-01-12 06:31:28 +08:00
# cookie_auth_headers = '{"Content-Type": "application/json", "X-MY-HEADER":"hello"}'
2021-07-14 05:58:49 +08:00
# cookie_auth_body = '{"username": "user", "password": "pa$$word", "authenticate": "me"}'
## cookie_auth_renewal not set or set to "0" will auth once and never renew the cookie
# cookie_auth_renewal = "5m"
2018-05-15 08:15:40 +08:00
## Data format to output.
## Each data format has it's own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
2018-05-15 08:11:44 +08:00
# data_format = "influx"
2018-09-07 01:54:05 +08:00
2021-10-29 22:05:28 +08:00
## Use batch serialization format (default) instead of line based format.
## Batch format is more efficient and should be used unless line based
## format is really needed.
# use_batch_format = true
2019-06-15 02:29:58 +08:00
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "identity"
2018-06-04 09:31:47 +08:00
## Additional HTTP headers
# [outputs.http.headers]
# # Should be set manually to "application/json" for json data_format
# Content-Type = "text/plain; charset=utf-8"
2020-12-31 02:59:58 +08:00
2022-04-28 04:24:27 +08:00
## MaxIdleConns controls the maximum number of idle (keep-alive)
## connections across all hosts. Zero means no limit.
# max_idle_conn = 0
## MaxIdleConnsPerHost, if non-zero, controls the maximum idle
## (keep-alive) connections to keep per-host. If zero,
## DefaultMaxIdleConnsPerHost is used(2).
# max_idle_conn_per_host = 2
2020-12-31 02:59:58 +08:00
## Idle (keep-alive) connection timeout.
## Maximum amount of time before idle connection is closed.
## Zero means no limit.
# idle_conn_timeout = 0
2021-12-11 04:06:33 +08:00
## Amazon Region
#region = "us-east-1"
## Amazon Credentials
## Credentials are loaded in the following order
## 1) Web identity provider credentials via STS if role_arn and web_identity_token_file are specified
## 2) Assumed credentials via STS if role_arn is specified
## 3) explicit credentials from 'access_key' and 'secret_key'
## 4) shared profile from 'profile'
## 5) environment variables
## 6) shared credentials file
## 7) EC2 Instance Profile
#access_key = ""
#secret_key = ""
#token = ""
#role_arn = ""
#web_identity_token_file = ""
#role_session_name = ""
#profile = ""
#shared_credential_file = ""
2021-12-21 01:16:23 +08:00
## Optional list of statuscodes (< 200 or > 300) upon which requests should not be retried
# non_retryable_statuscodes = [409, 413]
2018-05-15 08:15:40 +08:00
```
2021-07-14 05:58:49 +08:00
2022-05-25 07:33:02 +08:00
### Google API Auth
The `google_application_credentials` setting is used with Google Cloud APIs. It specifies the json key file. To learn about creating Google service accounts, consult Google's
[oauth2 service account documentation][create_service_account]. An example use case is a metrics proxy deployed to
Cloud Run. In this example, the service account must have the "run.routes.invoke" permission.
[create_service_account]: https://cloud.google.com/docs/authentication/production#create_service_account
2021-11-25 02:47:33 +08:00
### Optional Cookie Authentication Settings
2021-07-14 05:58:49 +08:00
2022-04-21 23:45:47 +08:00
The optional Cookie Authentication Settings will retrieve a cookie from the
given authorization endpoint, and use it in subsequent API requests. This is
useful for services that do not provide OAuth or Basic Auth authentication,
e.g. the [Tesla Powerwall API][powerwall], which uses a Cookie Auth Body to
retrieve an authorization cookie. The Cookie Auth Renewal interval will renew
the authorization by retrieving a new cookie at the given interval.
[powerwall]: https://www.tesla.com/support/energy/powerwall/own/monitoring-from-home-network