salt.modules.influxdbmod

InfluxDB - A distributed time series database

Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB version 0.9+)

depends
  • influxdb Python module (>= 3.0.0)

configuration

This module accepts connection configuration details either as parameters or as configuration settings in /etc/salt/minion on the relevant minions:

influxdb.host: 'localhost'
influxdb.port: 8086
influxdb.user: 'root'
influxdb.password: 'root'

This data can also be passed into pillar. Options passed into opts will overwrite options passed into pillar.

Most functions in this module allow you to override or provide some or all of these settings via keyword arguments:

salt '*' influxdb.foo_function influxdb_user='influxadmin' influxdb_password='s3cr1t'

would override user and password while still using the defaults for host and port.

salt.modules.influxdbmod.alter_retention_policy(database, name, duration, replication, default=False, **client_args)

Modify an existing retention policy.

name

Name of the retention policy to modify.

database

Name of the database for which the retention policy was defined.

duration

New duration of given retention policy.

Durations such as 1h, 90m, 12h, 7d, and 4w, are all supported and mean 1 hour, 90 minutes, 12 hours, 7 day, and 4 weeks, respectively. For infinite retention – meaning the data will never be deleted – use 'INF' for duration. The minimum retention period is 1 hour.

replication

New replication of given retention policy.

This determines how many independent copies of each data point are stored in a cluster.

defaultFalse

Whether or not to set the modified policy as default.

CLI Example:

salt '*' influxdb.alter_retention_policy metrics default 1d 1

salt.modules.influxdbmod.continuous_query_exists(database, name, **client_args)

Check if continuous query with given name exists on the database.

database

Name of the database for which the continuous query was defined.

name

Name of the continuous query to check.

CLI Example:

salt '*' influxdb.continuous_query_exists metrics default

salt.modules.influxdbmod.create_continuous_query(database, name, query, resample_time=None, coverage_period=None, **client_args)

Create a continuous query.

database

Name of the database for which the continuous query will be created on.

name

Name of the continuous query to create.

query

The continuous query string.

resample_timeNone

Duration between continuous query resampling.

coverage_periodNone

Duration specifying time period per sample.

CLI Example:

salt '*' influxdb.create_continuous_query mydb cq_month 'SELECT mean(*) INTO mydb.a_month.:MEASUREMENT FROM mydb.a_week./.*/ GROUP BY time(5m), *'

salt.modules.influxdbmod.create_db(name, **client_args)

Create a database.

name

Name of the database to create.

CLI Example:

salt '*' influxdb.create_db <name>

salt.modules.influxdbmod.create_retention_policy(database, name, duration, replication, default=False, **client_args)

Create a retention policy.

database

Name of the database for which the retention policy will be created.

name

Name of the new retention policy.

duration

Duration of the new retention policy.

Durations such as 1h, 90m, 12h, 7d, and 4w, are all supported and mean 1 hour, 90 minutes, 12 hours, 7 day, and 4 weeks, respectively. For infinite retention – meaning the data will never be deleted – use 'INF' for duration. The minimum retention period is 1 hour.

replication

Replication factor of the retention policy.

This determines how many independent copies of each data point are stored in a cluster.

defaultFalse

Whether or not the policy as default will be set as default.

CLI Example:

salt '*' influxdb.create_retention_policy metrics default 1d 1

salt.modules.influxdbmod.create_user(name, passwd, admin=False, **client_args)

Create a user.

name

Name of the user to create.

passwd

Password of the new user.

adminFalse

Whether the user should have cluster administration privileges or not.

CLI Example:

salt '*' influxdb.create_user <name> <password>
salt '*' influxdb.create_user <name> <password> admin=True

salt.modules.influxdbmod.db_exists(name, **client_args)

Checks if a database exists in InfluxDB.

name

Name of the database to check.

CLI Example:

salt '*' influxdb.db_exists <name>

salt.modules.influxdbmod.drop_continuous_query(database, name, **client_args)

Drop a continuous query.

database

Name of the database for which the continuous query will be drop from.

name

Name of the continuous query to drop.

CLI Example:

salt '*' influxdb.drop_continuous_query mydb my_cq

salt.modules.influxdbmod.drop_db(name, **client_args)

Drop a database.

name

Name of the database to drop.

CLI Example:

salt '*' influxdb.drop_db <name>

salt.modules.influxdbmod.drop_retention_policy(database, name, **client_args)

Drop a retention policy.

database

Name of the database for which the retention policy will be dropped.

name

Name of the retention policy to drop.

CLI Example:

salt '*' influxdb.drop_retention_policy mydb mypr

salt.modules.influxdbmod.get_continuous_query(database, name, **client_args)

Get an existing continuous query.

database

Name of the database for which the continuous query was defined.

name

Name of the continuous query to get.

CLI Example:

salt '*' influxdb.get_continuous_query mydb cq_month

salt.modules.influxdbmod.get_retention_policy(database, name, **client_args)

Get an existing retention policy.

database

Name of the database for which the retention policy was defined.

name

Name of the retention policy.

CLI Example:

salt '*' influxdb.get_retention_policy metrics default

salt.modules.influxdbmod.grant_admin_privileges(name, **client_args)

Grant cluster administration privileges to a user.

name

Name of the user to whom admin privileges will be granted.

CLI Example:

salt '*' influxdb.grant_admin_privileges <name>

salt.modules.influxdbmod.grant_privilege(database, privilege, username, **client_args)

Grant a privilege on a database to a user.

database

Name of the database to grant the privilege on.

privilege

Privilege to grant. Can be one of 'read', 'write' or 'all'.

username

Name of the user to grant the privilege to.

salt.modules.influxdbmod.list_dbs(**client_args)

List all InfluxDB databases.

CLI Example:

salt '*' influxdb.list_dbs

salt.modules.influxdbmod.list_privileges(name, **client_args)

List privileges from a user.

name

Name of the user from whom privileges will be listed.

CLI Example:

salt '*' influxdb.list_privileges <name>

salt.modules.influxdbmod.list_users(**client_args)

List all users.

CLI Example:

salt '*' influxdb.list_users

salt.modules.influxdbmod.query(database, query, **client_args)

Execute a query.

database

Name of the database to query on.

query

InfluxQL query string.

salt.modules.influxdbmod.remove_user(name, **client_args)

Remove a user.

name

Name of the user to remove

CLI Example:

salt '*' influxdb.remove_user <name>

salt.modules.influxdbmod.retention_policy_exists(database, name, **client_args)

Check if retention policy with given name exists.

database

Name of the database for which the retention policy was defined.

name

Name of the retention policy to check.

CLI Example:

salt '*' influxdb.retention_policy_exists metrics default

salt.modules.influxdbmod.revoke_admin_privileges(name, **client_args)

Revoke cluster administration privileges from a user.

name

Name of the user from whom admin privileges will be revoked.

CLI Example:

salt '*' influxdb.revoke_admin_privileges <name>

salt.modules.influxdbmod.revoke_privilege(database, privilege, username, **client_args)

Revoke a privilege on a database from a user.

database

Name of the database to grant the privilege on.

privilege

Privilege to grant. Can be one of 'read', 'write' or 'all'.

username

Name of the user to grant the privilege to.

salt.modules.influxdbmod.set_user_password(name, passwd, **client_args)

Change password of a user.

name

Name of the user for whom to set the password.

passwd

New password of the user.

CLI Example:

salt '*' influxdb.set_user_password <name> <password>

salt.modules.influxdbmod.user_exists(name, **client_args)

Check if a user exists.

name

Name of the user to check.

CLI Example:

salt '*' influxdb.user_exists <name>

salt.modules.influxdbmod.user_info(name, **client_args)

Get information about given user.

name

Name of the user for which to get information.

CLI Example:

salt '*' influxdb.user_info <name>

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.influxdbmod.html