<commit_before>#!/usr/bin/env ruby
# $Id$
#
# Ganglia metric for tivoli backup statistics

gmetric=%x{which gmetric}.chomp
exit 1 if $?.exitstatus != 0

gmetric="#{gmetric} --type=float --dmax=99999 --tmax=60 --slope=positive"

logs=["/var/log/dsmsched.log", "/var/log/dsmsched.backuppc.log" ]

logs.each do |log|
  if (File.exist?(log) && File.readable?(log))
    label=File.basename(log)
    %x{tail -13 /var/log/dsmsched.log |grep Total |sed -e 's/,//g' -e 's/ MB//' -e 's/bytes/MB/' -e 's/Total number of //g'}.chomp.each do |line|
      nam=line.split(":")
      #puts "#{gmetric} --name=\"Tivoli #{label} #{nam[0].lstrip.rstrip}\" --value=#{nam[1].lstrip.rstrip}"
      %x{#{gmetric} --name=\"Tivoli #{label} #{nam[0].lstrip.rstrip}\" --value=#{nam[1].lstrip.rstrip}}
    end
  end
end<commit_msg>some fixes for the tivoli reports<commit_after>#!/usr/bin/env ruby
# $Id$
#
# Ganglia metric for tivoli backup statistics

gmetric=%x{which gmetric}.chomp
exit 1 if $?.exitstatus != 0

gmetric="#{gmetric} --type=float --dmax=99999 --tmax=60 --slope=positive"

logs=["/var/log/dsmsched.log", "/var/log/dsmsched.backuppc.log" ]

logs.each do |log|
  if (File.exist?(log) && File.readable?(log))
    label=File.basename(log)
    %x{tail -13 /var/log/dsmsched.log |grep Total |sed -e 's/,//g' -e 's/ MB//' -e 's/bytes/MB/' -e 's/Total number of //g'}.chomp.each do |line|
      nam=line.split(":")
      #puts "#{gmetric} --name=\"Tivoli #{label} #{nam[0].lstrip.rstrip}\" --value=#{nam[1].lstrip.rstrip}"
      %x{#{gmetric} --name=\"Tivoli #{label} #{nam[0].lstrip.rstrip}\" --value=#{nam[1].lstrip.rstrip.to_i}}
    end
  end
end
{'fraction_non_alphanumeric': 0.23237277743715512, 'fraction_numerical': 0.018393623543838136, 'mean_word_length': 3.4958677685950414, 'pattern_counts': {'":': 2, '<': 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': '5918671', 'n_tokens_mistral': 701, 'n_tokens_neox': 681, 'n_words': 134}