an influxdb gateway, takes json as input

Usage no npm install needed!

<script type="module">
  import influxGateway from '';



Build Status NPM version Code Climate

InfluxDB had a json protocol but it will be deprecated, this service helps you to write json into influxDB.

How to deploy

Firstly, install:

$ npm install influx-gateway -g

Then command igw or influx-gateway will be available.

Now we need a configuration file for influx-gateway, you can see the example by running:

$ igw genconfig

Create a config file, and then we can run the server:

$ igw -c [configfile]


Config is quite straight forward. The only tricky part is: if your influxdb requires authentication, you should include the username and password in the influx_url.


Influx-gateway does not provide authentication, you can put a proxy in front of igw. For example, an nginx instance with basic auth check enabled.


  • GET /ping

Ping will check the influxdb connectivity.

  • POST /event

This API would transform json input into influx db's line protocol message. See Here for more information about line-protocol.

Example payload:

  "_name": "cpu",
  "__f1": 1,
  "tag1": "v1",
  "tag2": "v2"

_name must be specified as the measurement name, type must be string, regex: /^[a-zA-Z0-9][\w-\.\/]*$/

Field name starts with __[a-zA-Z0-9], and remaining part use the same rule as measurement name.

Field value can be number, boolean or string.

Fields are optional, if no fields in the payload, igw will add count=1i automatically.

Tag name and tag value also should follow the measurement name regex.

Tags are also optional.

  • POST /query

This API accepts influxdb query and returns json result. Query must start with SELECT.

Example payload:

  "q": "SELECT value FROM cpu_load_short WHERE region='us-west'",

Example result:

  "latency": 230,
  "series": [
      "name": "cpu_load_short",
      "columns": [
      "values": [


2016-02-24 0.1.5 Add query latency in response.

2016-02-23 0.1.4 Add query api.

2015-10-13 0.1.3 Upgrade dependencies.

2015-10-11 0.1.2 1st working version.