<commit_before>package Resmon::Module::PGREP;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;

sub handler {
  my $arg = shift;
  my $proc = $arg->{'object'};
  my $args = join(' ',$arg->{'arg0'},$arg->{'arg1'},$arg->{'arg2'});
  $args =~s/\s+$//;
  $proc .= " $args" if $args;
  my $output = cache_command("pgrep -f -l '$proc' | head -1", 500);
  if($output) {
    chomp $output;
    return("OK(pid:$output)");
  }
  return("BAD(no output)");
};
1;
<commit_msg>Lower the cache time to 180 seconds for PGREP checks<commit_after>package Resmon::Module::PGREP;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;

sub handler {
  my $arg = shift;
  my $proc = $arg->{'object'};
  my $args = join(' ',$arg->{'arg0'},$arg->{'arg1'},$arg->{'arg2'});
  $args =~s/\s+$//;
  $proc .= " $args" if $args;
  my $output = cache_command("pgrep -f -l '$proc' | head -1", 180);
  if($output) {
    chomp $output;
    return("OK(pid:$output)");
  }
  return("BAD(no output)");
};
1;

{'fraction_non_alphanumeric': 0.24686595949855353, 'fraction_numerical': 0.01832208293153327, 'mean_word_length': 3.8962264150943398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4522804', 'n_tokens_mistral': 441, 'n_tokens_neox': 425, 'n_words': 97}