Giter Site home page Giter Site logo

Comments (2)

jeanfabrice avatar jeanfabrice commented on June 28, 2024

Bonjour,

Oui :)
Voici le code nodeJS que j'utilisais pour pousser les données dans influxDB, avant de passer sur Prometheus.

#!/usr/bin/env node
var commander    = require( 'commander' );
var debug        = require( 'debug' )( 'app:main' );
var async        = require( 'async' );
var package      = require( './package.json' );
var config       = require( './config.json' );
var influx       = require( 'influx' );
var flatten      = require( 'flat' );
var Livebox      = require( 'livebox-collect' );
var livebox      = new Livebox( config.hostname, config.login, config.password );

var client = influx({
  host     : config.influxdb.host || 'localhost',
  port     : config.influxdb.port || 8086,
  username : config.influxdb.user || 'user',
  password : config.influxdb.password || 'password',
  database : config.influxdb.db || 'db'
})

commander
  .version( package.version )
  .parse( process.argv );
debug( 'Parsed command-line options: %s', JSON.stringify( commander, null, 2 ));

livebox.connect( function( err ) {
  if( err ) {
    console.error( 'Auth error:', err );
    process.exit( 1 );
  }
  async.parallel({
    'deviceInfo' : function( callback ) {
      livebox.deviceInfo( function( err, data ) {
        client.writePoint( 'deviceInfo', flatten( data.status), {}, function(err, data1) {
          callback( err, flatten( data.status ) );
        })
      });
    },
    'getDSLStats' : function( callback ) {
      livebox.getDSLStats( function( err, data ) {
        client.writePoint( 'getDSLStats', flatten( data.status), {}, function(err, data1) {
          callback( err, flatten( data.status ) );
        })
      });
    },
    'getMibs-dsl' : function( callback ) {
      livebox.getMibs( 'dsl', function( err, data ) {
        client.writePoint( 'getMibs-dsl', flatten( data.status.dsl ), {}, function(err, data1) {
          callback( err, flatten( data.status.dsl ) );
        })
      });
    }
  }, function( err, result ) {
    if( err ) {
        console.error( err );
        return;
    }
    debug( result );
  })
})

from livebox-collect.

AnthoDingo avatar AnthoDingo commented on June 28, 2024

Super, merci beaucoup :)

from livebox-collect.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.