<commit_before>/*
 * Example showing how to use Beebotte to monitor the CPU and memory usage of a server.
 * You should have first created a corresponding device (see file create_device.js)
 * Works on any Linux platform.
 * Microsoft Windows is not (yet) supported.
 *
 * Copyright, Beebotte.com 2014
 * MIT license
 */

var diskspace = require('diskspace');
var bbt = require('beebotte');

var bclient = new bbt.Connector({
  //API keys for your account
  keyId: process.env.ACCESS_KEY,
  secretKey: process.env.SECRET_KEY
});

//Frequency of activity reporting in milliseconds
var frequency = process.env.FREQUENCY || (60 * 1000 /* 1 minute */);
// Channel name. Change it as suits you (it MUST correspond to an existing channel in your account)
var channel_name = "sandbox";

setInterval(function()
  {
    diskspace.check('/', function (total, free, status) {
      bclient.write({
        channel: channel_name,
        resource: 'disk',
        data: { size: total, used: total - free }
      }, function(err, res) {
        if(err) console.log(err);
      });
    });
    diskspace.check('/data', function (total, free, status) {
      bclient.write({
        channel: channel_name,
        resource: 'data',
        data: { size: total, used: total - free }
      }, function(err, res) {
        if(err) console.log(err);
      });
    });
  }, frequency
);


<commit_msg>Update to match new callback style of diskspace<commit_after>/*
 * Example showing how to use Beebotte to monitor the CPU and memory usage of a server.
 * You should have first created a corresponding device (see file create_device.js)
 * Works on any Linux platform.
 * Microsoft Windows is not (yet) supported.
 *
 * Copyright, Beebotte.com 2014
 * MIT license
 */

var diskspace = require('diskspace');
var bbt = require('beebotte');

var bclient = new bbt.Connector({
  //API keys for your account
  keyId: process.env.ACCESS_KEY,
  secretKey: process.env.SECRET_KEY
});

//Frequency of activity reporting in milliseconds
var frequency = process.env.FREQUENCY || (60 * 1000 /* 1 minute */);
// Channel name. Change it as suits you (it MUST correspond to an existing channel in your account)
var channel_name = "sandbox";

setInterval(function()
  {
    diskspace.check('/', function (err, total, free, status) {
      bclient.write({
        channel: channel_name,
        resource: 'disk',
        data: { size: total, used: total - free }
      }, function(err, res) {
        if(err) console.log(err);
      });
    });
    diskspace.check('/data', function (err, total, free, status) {
      bclient.write({
        channel: channel_name,
        resource: 'data',
        data: { size: total, used: total - free }
      }, function(err, res) {
        if(err) console.log(err);
      });
    });
  }, frequency
);



{'fraction_non_alphanumeric': 0.1247327156094084, 'fraction_numerical': 0.007840342124019958, 'mean_word_length': 2.964689265536723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7609107', 'n_tokens_mistral': 853, 'n_tokens_neox': 827, 'n_words': 285}