<commit_before>#!/usr/bin/env ruby
require 'rubygems'
$: <<  File.dirname(__FILE__)+'/../lib'
require 'graphiterb'
require 'configliere'
Configliere.use :commandline, :config_file

Settings.read 'graphite.yaml'
Settings.resolve!
Log = Logger.new($stderr) unless defined?(Log)

class AvailSpaceMonitor
  def hostname
    @hostname ||= `hostname`.chomp
  end
  
  def diskfree
    @diskfree ||= `df`
  end
  
  def send_metrics
    monitor = Graphiterb::GraphiteLogger.new(:iters => nil, :time => Settings.update_delay)
    loop do
      diskfree.split("\n").grep(/^\/dev\//).each do |disk|
        handle, size, spaceused, spacefree, percentfree, location = disk.split(/\s+/)
        monitor.periodically do |metrics, iter, since|
          metrics << ["system.#{hostname}#{handle.gsub(/\//,'.')}.available", spacefree.to_i]
        end
      end
      sleep Settings.update_delay
    end
  end
  <commit_msg>Fixed to display all disks; host name . => _<commit_after>#!/usr/bin/env ruby
require 'rubygems'
$: <<  File.dirname(__FILE__)+'/../lib'
require 'graphiterb'
require 'configliere'
Configliere.use :commandline, :config_file

Settings.read 'graphite.yaml'
Settings.resolve!
Log = Logger.new($stderr) unless defined?(Log)

class AvailSpaceMonitor
  def hostname
    @hostname ||= `hostname`.chomp.gsub(".","_")
  end
  
  def diskfree
    @diskfree ||= `df`
  end
  
  def send_metrics
    monitor = Graphiterb::GraphiteLogger.new(:iters => nil, :time => Settings.update_delay)
    loop do
      monitor.periodically do |metrics, iter, since|
        diskfree.split("\n").grep(/^\/dev\//).each do |disk|
          handle, size, spaceused, spacefree, percentfree, location = disk.split(/\s+/)
          metrics << ["system.#{hostname}#{handle.gsub(/\//,'.')}.available", spacefree.to_i]
        end
      end
      sleep Settings.update_delay
    end
  end
  
{'fraction_non_alphanumeric': 0.155126140633387, 'fraction_numerical': 0.0, 'mean_word_length': 3.2850574712643676, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 8, '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': '7112024', 'n_tokens_mistral': 619, 'n_tokens_neox': 623, 'n_words': 135}