<commit_before>#!/usr/bin/perl
use strict;
package Resmon::Module::LINUX_CHECK_TEMP;
use Resmon::Module;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;
my $DEBUG=0;


sub handler {
  my $arg = shift; 
  my ($sensor,$chip)=split('@', $arg->{'object'});
  print STDERR "sensor=$sensor; chip=$chip\n" if $DEBUG;
  $sensor =~s/\+/ /g;
  my $warning = $arg->{'warning'};
  my $critical = $arg->{'critical'};
  $warning = $critical if not $warning;
  my $output = cache_command("/usr/bin/sensors $chip", 30);
  print STDERR $output if $DEBUG;
  my @lines = split(/\n/, $output);
  my ($temp,$continues);
  for my $line (@lines) {
    if ($line =~ /^$sensor:\s*[+-]?([\d.]+)/) {
	  $temp=$1;
	  ## print "case 1 temp:$temp line $line\n" if $DEBUG>1;
	  last;
	}
	elsif($line =~ /^$sensor:/){
	  $continues = 1;
	  ## print "case 2 continues: $line\n" if $DEBUG>1;
	}elsif ($line =~ /^\S/) {
      $continues = 0;
	  ## print "case 3 discontinues: $line\n" if $DEBUG>1;
	}
    if($continues && $line =~ /^\s*[+-]?([\d.]*)°C/){
      $temp=$1;
	  ## print "case 4  temp:$temp line $line\n" if $DEBUG>1;
      last; 
    }
	## print "case 5 continues=$continues  and line $line\n" if $DEBUG>1;
  }
  return "OK($temp $sensor($chip))" if ($temp && ($temp<$warning));
  return "WARNING($temp $sensor($chip))" if ($temp && ($temp<$critical));
  return "BAD($temp $sensor($chip))";
};
1;<commit_msg>make messages consistent with configs in names<commit_after>#!/usr/bin/perl
use strict;
package Resmon::Module::LINUX_CHECK_TEMP;
use Resmon::Module;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;
my $DEBUG=0;


sub handler {
  my $arg = shift; 
  my ($sensor,$chip)=split('@', $arg->{'object'});
  print STDERR "sensor=$sensor; chip=$chip\n" if $DEBUG;
  $sensor =~s/\+/ /g;
  my $warning = $arg->{'warning'};
  my $critical = $arg->{'critical'};
  $warning = $critical if not $warning;
  my $output = cache_command("/usr/bin/sensors $chip", 30);
  print STDERR $output if $DEBUG;
  my @lines = split(/\n/, $output);
  my ($temp,$continues);
  for my $line (@lines) {
    if ($line =~ /^$sensor:\s*[+-]?([\d.]+)/) {
	  $temp=$1;
	  ## print "case 1 temp:$temp line $line\n" if $DEBUG>1;
	  last;
	}
	elsif($line =~ /^$sensor:/){
	  $continues = 1;
	  ## print "case 2 continues: $line\n" if $DEBUG>1;
	}elsif ($line =~ /^\S/) {
      $continues = 0;
	  ## print "case 3 discontinues: $line\n" if $DEBUG>1;
	}
    if($continues && $line =~ /^\s*[+-]?([\d.]*)°C/){
      $temp=$1;
	  ## print "case 4  temp:$temp line $line\n" if $DEBUG>1;
      last; 
    }
	## print "case 5 continues=$continues  and line $line\n" if $DEBUG>1;
  }
  return "OK($temp $sensor\@$chip)" if ($temp && ($temp<$warning));
  return "WARNING($temp $sensor\@$chip)" if ($temp && ($temp<$critical));
  return "BAD($temp $sensor@$chip)";
};
1;
{'fraction_non_alphanumeric': 0.2359277275886032, 'fraction_numerical': 0.01250868658790827, 'mean_word_length': 3.621187800963082, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '5509807', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1127, 'n_words': 283}