How to use the influx.FieldType function in influx

To help you get started, we’ve selected a few influx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CommonGarden / Grow-IoT / imports / api / influx / influx.js View on Github external
}

console.log('Influx URL: ' + INFLUX_URL);

if (INFLUX_URL) {
  // See: https://www.npmjs.com/package/influx
  // See: https://docs.influxdata.com/influxdb/v1.2/concepts/schema_and_data_layout/
  const influx = new Influx.InfluxDB({
    host: INFLUX_URL,
    database: 'events',
    schema: [
      {
        measurement: 'events',
        fields: {
          value: Influx.FieldType.FLOAT,
          message: Influx.FieldType.STRING,
        },
        tags: [
          'thing', 'environment', 'type'
        ]
      }
    ]
  });

  influx.getDatabaseNames()
    .then(names => {
      if (!names.includes('events')) {
        return influx.createDatabase('events');
      }
    })
    .catch(err => {
      console.error(err);
github stefanwalther / speedy / docker / speedy / src / index.js View on Github external
SPEEDY_DB_NAME: process.env.INFLUXDB_DB,
  SPEEDY_DB_PORT: process.env.INFLUXDB_HTTP_BIND_ADDRESS || 8086,
  SPEEDY_INTERVAL: process.env.SPEEDY_INTERVAL || '* * * * *',
  SPEEDY_MAX_TIME: process.env.SPEEDY_MAX_TIME || 5000
};

const influx = new Influx.InfluxDB({
  host: settings.SPEEDY_DB_HOST,
  database: settings.SPEEDY_DB_NAME,
  schema: [
    {
      measurement: 'speed_test',
      fields: {
        download: Influx.FieldType.INTEGER,
        upload: Influx.FieldType.INTEGER,
        originalUpload: Influx.FieldType.INTEGER,
        originalDownload: Influx.FieldType.INTEGER,
        executionTime: Influx.FieldType.FLOAT
      },
      tags: [
        'interval',
        'isp',
        'host'
      ]
    }
  ]
});

console.log('speedy settings:', settings);

// run it every minute
schedule.scheduleJob(settings.SPEEDY_INTERVAL, () => {
github ptarmiganlabs / butler-sos / src / globals.js View on Github external
allocated: Influx.FieldType.INTEGER,
        free: Influx.FieldType.INTEGER,
      },
      tags: tagValues,
    },
    {
      measurement: 'apps',
      fields: {
        active_docs_count: Influx.FieldType.INTEGER,
        loaded_docs_count: Influx.FieldType.INTEGER,
        in_memory_docs_count: Influx.FieldType.INTEGER,
        active_docs: Influx.FieldType.STRING,
        loaded_docs: Influx.FieldType.STRING,
        in_memory_docs: Influx.FieldType.STRING,
        calls: Influx.FieldType.INTEGER,
        selections: Influx.FieldType.INTEGER,
      },
      tags: tagValues,
    },
    {
      measurement: 'cpu',
      fields: {
        total: Influx.FieldType.INTEGER,
      },
      tags: tagValues,
    },
    {
      measurement: 'session',
      fields: {
        active: Influx.FieldType.INTEGER,
        total: Influx.FieldType.INTEGER,
      },
github openintegrationhub / openintegrationhub / services / reports-analytics / src / measurement / default.js View on Github external
const Influx = require('influx');

module.exports = {
    measurement: 'default',
    fields: {
        keyDefault: Influx.FieldType.STRING,
    },
    tags: [
        'event_name',
        'service_name',
    ],
};
github twalther / lighthouse-influxdb-grafana / docker / app.js View on Github external
fields: {
			score: schemaItem.score,
			value: Influx.FieldType.FLOAT
		},
		tags: [
			'environment',
			'uri',
			'name'
		]
	};
});

schema.push({
	measurement: 'score',
	fields: {
		score: Influx.FieldType.INTEGER,
		value: Influx.FieldType.FLOAT
	},
	tags: [
		'environment',
		'uri',
		'name'
	]
});

const influx = new Influx.InfluxDB({
	host: 'localhost',
	database: 'lighthouse',
	schema: schema
});

function launchChromeAndRunLighthouse(url, flags = {}, config = null) {
github SvenSommer / darksky2influxdb / importForecast.js View on Github external
{
            measurement: 'forecast',
            tags: ['source'],
            fields: {
                precipIntensity: Influx.FieldType.FLOAT,
                precipProbability: Influx.FieldType.FLOAT,
                temperature: Influx.FieldType.FLOAT,
                apparent_temperature: Influx.FieldType.FLOAT,
                dew_point: Influx.FieldType.FLOAT,
                humidity: Influx.FieldType.FLOAT,
                wind_speed: Influx.FieldType.FLOAT,
                wind_bearing: Influx.FieldType.FLOAT,
                cloud_cover: Influx.FieldType.FLOAT,
                sun_cover: Influx.FieldType.FLOAT,
                pressure: Influx.FieldType.FLOAT,
                ozone: Influx.FieldType.FLOAT,
                daytime: Influx.FieldType.BOOLEAN,
                daytime_show: Influx.FieldType.FLOAT,
                nightime_show: Influx.FieldType.FLOAT

            }
        }
    ]
})

const darksky = new DarkSky(darkskyConfig.key);

var getForecast = function () {
    darksky.forecast(darkskyConfig.latitude, darkskyConfig.longitude, {
        exclude: ['minutely', 'currently', 'alerts', 'flags'],
        units: darkskyConfig.units,
        lang: darkskyConfig.language,
github sufish / IotHub_Server / services / influxdb_service.js View on Github external
host: process.env.INFLUXDB,
    database: 'iothub',
    schema: [
        {
            measurement: 'device_connections',
            fields: {
                connected: Influx.FieldType.BOOLEAN
            },
            tags: [
                'product_name', 'device_name'
            ]
        },
        {
            measurement: 'connection_count',
            fields: {
                count: Influx.FieldType.INTEGER
            },
            tags: ["node_name"]
        }
    ]
})

class InfluxDBService {
    static writeConnectionData({productName, deviceName, connected, ts}) {
        var timestamp = ts == null ? Math.floor(Date.now() / 1000) : ts
        influx.writePoints([
            {
                measurement: 'device_connections',
                tags: {product_name: productName, device_name: deviceName},
                fields: {connected: connected},
                timestamp: timestamp
            }
github ZhiXiao-Lin / nestify / server / src / config / index.ts View on Github external
username: 'nestify',
        password: '123456',
        dropSchema: false,
        synchronize: false,
        logging: false,
        entities: [resolve('./**/*.entity.ts')]
    },

    influx: {
        host: '127.0.0.1',
        database: 'nestify',
        schema: [
            {
                measurement: 'system_status',
                fields: {
                    cpu: Influx.FieldType.FLOAT,
                    memory: Influx.FieldType.INTEGER,
                    ppid: Influx.FieldType.INTEGER,
                    pid: Influx.FieldType.INTEGER,
                    ctime: Influx.FieldType.INTEGER,
                    elapsed: Influx.FieldType.INTEGER,
                    timestamp: Influx.FieldType.INTEGER
                },
                tags: ['status']
            }
        ]
    },

    qiniu: {
        accessKey: 'YyxyEPUcKk2vDpjKkCwZQaAC_uaUaxX1eqd26hL6',
        secretKey: 'gCpsZaPRn8YqWbKzMsVgcEBsQk63Aev9qX2VN_eV',
        domain: 'http://img.nestify.cn',
github SvenSommer / darksky2influxdb / importForecast.js View on Github external
if (!darkskyConfig.key) {
    throw new Error('DarkSky key should be provided')
}

const influx = new Influx.InfluxDB({
    host: influxConfig.host,
    database: influxConfig.database,
    username: influxConfig.username,
    password: influxConfig.password,
    schema: [
        {
            measurement: 'forecast',
            tags: ['source'],
            fields: {
                precipIntensity: Influx.FieldType.FLOAT,
                precipProbability: Influx.FieldType.FLOAT,
                temperature: Influx.FieldType.FLOAT,
                apparent_temperature: Influx.FieldType.FLOAT,
                dew_point: Influx.FieldType.FLOAT,
                humidity: Influx.FieldType.FLOAT,
                wind_speed: Influx.FieldType.FLOAT,
                wind_bearing: Influx.FieldType.FLOAT,
                cloud_cover: Influx.FieldType.FLOAT,
                sun_cover: Influx.FieldType.FLOAT,
                pressure: Influx.FieldType.FLOAT,
                ozone: Influx.FieldType.FLOAT,
                daytime: Influx.FieldType.BOOLEAN,
                daytime_show: Influx.FieldType.FLOAT,
                nightime_show: Influx.FieldType.FLOAT

            }
github ZhiXiao-Lin / nestify / server / src / config / index.ts View on Github external
},

    influx: {
        host: '127.0.0.1',
        database: 'nestify',
        schema: [
            {
                measurement: 'system_status',
                fields: {
                    cpu: Influx.FieldType.FLOAT,
                    memory: Influx.FieldType.INTEGER,
                    ppid: Influx.FieldType.INTEGER,
                    pid: Influx.FieldType.INTEGER,
                    ctime: Influx.FieldType.INTEGER,
                    elapsed: Influx.FieldType.INTEGER,
                    timestamp: Influx.FieldType.INTEGER
                },
                tags: ['status']
            }
        ]
    },

    qiniu: {
        accessKey: 'YyxyEPUcKk2vDpjKkCwZQaAC_uaUaxX1eqd26hL6',
        secretKey: 'gCpsZaPRn8YqWbKzMsVgcEBsQk63Aev9qX2VN_eV',
        domain: 'http://img.nestify.cn',
        policy: {
            scope: 'nestify',
            expires: 7200,
            returnBody:
                '{"key":"$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)"}'
        }

influx

InfluxDB Client

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Popular influx functions