Nomad
InfluxDB APM plugin
Use the influxdb APM plugin to query metrics from an
InfluxDB server. The plugin supports InfluxDB 1.x using
InfluxQL queries.
Agent configuration options
The plugin supports two authentication modes. Use HTTP basic authentication when your InfluxDB server requires a username and password.
apm "influxdb" {
driver = "influxdb"
config = {
address = "http://localhost:8086"
database = "telegraf"
username = "myuser"
password = "mypassword"
}
}
To use JWT authentication instead, provide shared_secret in place of
password. The plugin generates a new token for each request automatically.
apm "influxdb" {
driver = "influxdb"
config = {
address = "http://localhost:8086"
database = "telegraf"
username = "myuser"
shared_secret = "my-influxdb-shared-secret"
}
}
address(string: <required>)- The absolute URL of the InfluxDB server, including scheme and port. For examplehttp://localhost:8086.database(string: <required>)- The name of the InfluxDB database to query. You can also usedbas a shorthand alias. When both are set,databasetakes precedence.username(string: "")- The username for authentication. Required when usingpasswordfor HTTP basic authentication orshared_secretfor JWT authentication.password(string: "")- The password for HTTP basic authentication. Must be set together withusername. The agent returns an error on startup ifpasswordis set withoutusername.shared_secret(string: "")- The InfluxDB shared secret used to sign JWT tokens for authentication. A new token is generated for each request using HS256. The value must match theINFLUXDB_HTTP_SHARED_SECRETsetting on the InfluxDB server.shared_secretrequiresusernameto be set and cannot be used together withpassword. The agent returns an error on startup if both are set.version(string: "1")- The InfluxDB API version to use. Only version"1"is supported. The agent returns an error on startup if any other value is set.
Policy configuration options
check {
source = "influxdb"
query = "SELECT mean(usage_user) FROM cpu WHERE time >= now() - 2m"
# ...
}
The query value must be a valid InfluxQL query. The plugin does not inject
time bounds automatically, so you must include a WHERE time >= ... clause to
limit the query window.
The plugin reads the metric value from a column named value in the query
result. If no value column is present, it uses the first non-time column
instead. This means you do not need to alias the result column to value.
check {
source = "influxdb"
query = "SELECT mean(usage_user) FROM cpu WHERE time >= now() - 2m GROUP BY time(10s)"
# ...
}
When using GROUP BY time(), add fill(none) to your query to omit incomplete
trailing buckets instead of returning them as null values:
SELECT mean(usage_user) FROM cpu WHERE time >= now() - 2m GROUP BY time(10s) fill(none)