InfluxDB - A distributed time series database
Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB version 0.9+)
influxdb Python module (>= 3.0.0)
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
.
Modify an existing retention policy.
Name of the retention policy to modify.
Name of the database for which the retention policy was defined.
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.
New replication of given retention policy.
This determines how many independent copies of each data point are stored in a cluster.
Whether or not to set the modified policy as default.
CLI Example:
salt '*' influxdb.alter_retention_policy metrics default 1d 1
Check if continuous query with given name exists on the database.
Name of the database for which the continuous query was defined.
Name of the continuous query to check.
CLI Example:
salt '*' influxdb.continuous_query_exists metrics default
Create a continuous query.
Name of the database for which the continuous query will be created on.
Name of the continuous query to create.
The continuous query string.
Duration between continuous query resampling.
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), *'
Create a database.
Name of the database to create.
CLI Example:
salt '*' influxdb.create_db <name>
Create a retention policy.
Name of the database for which the retention policy will be created.
Name of the new retention policy.
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 factor of the retention policy.
This determines how many independent copies of each data point are stored in a cluster.
Whether or not the policy as default will be set as default.
CLI Example:
salt '*' influxdb.create_retention_policy metrics default 1d 1
Create a user.
Name of the user to create.
Password of the new user.
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
Checks if a database exists in InfluxDB.
Name of the database to check.
CLI Example:
salt '*' influxdb.db_exists <name>
Drop a continuous query.
Name of the database for which the continuous query will be drop from.
Name of the continuous query to drop.
CLI Example:
salt '*' influxdb.drop_continuous_query mydb my_cq
Drop a database.
Name of the database to drop.
CLI Example:
salt '*' influxdb.drop_db <name>
Drop a retention policy.
Name of the database for which the retention policy will be dropped.
Name of the retention policy to drop.
CLI Example:
salt '*' influxdb.drop_retention_policy mydb mypr
Get an existing continuous query.
Name of the database for which the continuous query was defined.
Name of the continuous query to get.
CLI Example:
salt '*' influxdb.get_continuous_query mydb cq_month
Get an existing retention policy.
Name of the database for which the retention policy was defined.
Name of the retention policy.
CLI Example:
salt '*' influxdb.get_retention_policy metrics default
Grant cluster administration privileges to a user.
Name of the user to whom admin privileges will be granted.
CLI Example:
salt '*' influxdb.grant_admin_privileges <name>
Grant a privilege on a database to a user.
Name of the database to grant the privilege on.
Privilege to grant. Can be one of 'read', 'write' or 'all'.
Name of the user to grant the privilege to.
List all InfluxDB databases.
CLI Example:
salt '*' influxdb.list_dbs
List privileges from a user.
Name of the user from whom privileges will be listed.
CLI Example:
salt '*' influxdb.list_privileges <name>
List all users.
CLI Example:
salt '*' influxdb.list_users
Execute a query.
Name of the database to query on.
InfluxQL query string.
Remove a user.
Name of the user to remove
CLI Example:
salt '*' influxdb.remove_user <name>
Check if retention policy with given name exists.
Name of the database for which the retention policy was defined.
Name of the retention policy to check.
CLI Example:
salt '*' influxdb.retention_policy_exists metrics default
Revoke cluster administration privileges from a user.
Name of the user from whom admin privileges will be revoked.
CLI Example:
salt '*' influxdb.revoke_admin_privileges <name>
Revoke a privilege on a database from a user.
Name of the database to grant the privilege on.
Privilege to grant. Can be one of 'read', 'write' or 'all'.
Name of the user to grant the privilege to.
Change password of a user.
Name of the user for whom to set the password.
New password of the user.
CLI Example:
salt '*' influxdb.set_user_password <name> <password>
Check if a user exists.
Name of the user to check.
CLI Example:
salt '*' influxdb.user_exists <name>
Get information about given user.
Name of the user for which to get information.
CLI Example:
salt '*' influxdb.user_info <name>