JavaScript

Warning! This page documents an old version of InfluxDB, which is no longer actively developed. InfluxDB v1.3 is the most recent stable version of InfluxDB.

The InfluxDB javascript library lives on GitHub

You can get the most recent version here:

<script type="text/javascript" src="http://get.influxdb.org/influxdb-latest.js"

Initialization

First, create a new InfluxDB object by connecting to a running instance.

influxdb = new InfluxDB({
  "host" :"localhost",
  "port" :"8086",
  "username" :"root",
  "password" :"root",
  "database" :"test"
});

Available Functions

createDatabase(databaseName)

This will allow you to create a new database. This function is restricted to cluster admins.

deleteDatabase(databaseName)

This will allow you to delete a database. This function is restricted to cluster admins.

writePoint(seriesName, values)

This will allow you to write a point to a time series. The content of values should be an associative array, where the keys are the column names.

readPoint(fieldNames, seriesNames)

This will allow you to read a point from a time series. The query will be constructed in the form of:

SELECT [fieldNames] FROM [seriesNames];