influxdb

Interface with InfluxDB 0.9-1.x

Important

You can optionally specify default connection parameters via the general influxdb setup.

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'

This overrides user and password while still using the defaults for host and port.

saltext.influxdb.modules.influxdbmod.list_dbs(**client_args)[source]

List all InfluxDB databases.

CLI Example:

salt '*' influxdb.list_dbs
saltext.influxdb.modules.influxdbmod.db_exists(name, **client_args)[source]

Checks if a database exists in InfluxDB.

name

Name of the database to check.

CLI Example:

salt '*' influxdb.db_exists <name>
saltext.influxdb.modules.influxdbmod.create_db(name, **client_args)[source]

Create a database.

name

Name of the database to create.

CLI Example:

salt '*' influxdb.create_db <name>
saltext.influxdb.modules.influxdbmod.drop_db(name, **client_args)[source]

Drop a database.

name

Name of the database to drop.

CLI Example:

salt '*' influxdb.drop_db <name>
saltext.influxdb.modules.influxdbmod.list_users(**client_args)[source]

List all users.

CLI Example:

salt '*' influxdb.list_users
saltext.influxdb.modules.influxdbmod.user_exists(name, **client_args)[source]

Check if a user exists.

name

Name of the user to check.

CLI Example:

salt '*' influxdb.user_exists <name>
saltext.influxdb.modules.influxdbmod.user_info(name, **client_args)[source]

Get information about given user.

name

Name of the user for which to get information.

CLI Example:

salt '*' influxdb.user_info <name>
saltext.influxdb.modules.influxdbmod.create_user(name, passwd, admin=False, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.set_user_password(name, passwd, **client_args)[source]

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>
saltext.influxdb.modules.influxdbmod.grant_admin_privileges(name, **client_args)[source]

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>
saltext.influxdb.modules.influxdbmod.revoke_admin_privileges(name, **client_args)[source]

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>
saltext.influxdb.modules.influxdbmod.remove_user(name, **client_args)[source]

Remove a user.

name

Name of the user to remove

CLI Example:

salt '*' influxdb.remove_user <name>
saltext.influxdb.modules.influxdbmod.get_retention_policy(database, name, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.retention_policy_exists(database, name, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.drop_retention_policy(database, name, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.create_retention_policy(database, name, duration, replication, default=False, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.alter_retention_policy(database, name, duration, replication, default=False, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.list_privileges(name, **client_args)[source]

List privileges from a user.

name

Name of the user from whom privileges will be listed.

CLI Example:

salt '*' influxdb.list_privileges <name>
saltext.influxdb.modules.influxdbmod.grant_privilege(database, privilege, username, **client_args)[source]

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.

CLI Example:

salt '*' influxdb.grant_privilege db read user
saltext.influxdb.modules.influxdbmod.revoke_privilege(database, privilege, username, **client_args)[source]

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.

CLI Example:

salt '*' influxdb.revoke_privilege db read user
saltext.influxdb.modules.influxdbmod.continuous_query_exists(database, name, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.get_continuous_query(database, name, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.create_continuous_query(database, name, query, resample_time=None, coverage_period=None, **client_args)[source]

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), *'
saltext.influxdb.modules.influxdbmod.drop_continuous_query(database, name, **client_args)[source]

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
saltext.influxdb.modules.influxdbmod.query(database, query, **client_args)[source]

Execute a query.

database

Name of the database to query on.

query

InfluxQL query string.

CLI Example:

salt '*' influxdb.query mydb 'SELECT * FROM "foobar"'