Wednesday 26 September 2018

Promise error

``` const Influx = require('influx') const si = require('systeminformation');const influx = new Influx.InfluxDB('https://ift.tt/2O8GW3V siInfo = si.getAllData((data) => { console.log('Pulling Data') });siInfo .then(result => console.log(result.os.hostname)) .then(result => influx.writePoints([ { measurement: 'promise test', tags: { host: result.os.hostname }, fields: { cpu: parseInt(21), mem: parseInt(434523) }, } ]) ) .catch(err => console.log('Error', err.message));```Can anyone help me? Im trying to get the hostname pushed to the DB, i can console.log it but when i call it inside the field i get an error.."Pulling DataDESKTOP-GTE5ISFError - Cannot read property 'os' of undefined''

Submitted September 27, 2018 at 01:22AM by rendsolve

No comments:

Post a Comment