<commit_before><commit_msg>A better PHP-FPM plugin You can use it to find if PHP-FPM is up using is_up variable You can get all the status variable available<commit_after>class PHPFpmStatus < Scout::Plugin
  needs 'open-uri', 'json'

  OPTIONS=<<-EOS
  url:
    name: FPM Status Url
    default: "http://localhost/status?json"
  EOS

  def build_report
    url = option(:url) || 'http://localhost/status?json'
    begin
        open(url) do |p|
          content = p.read
          stats = JSON.parse(content)
          report({
                :is_up => 1,
                :start_since          => stats["start since"].to_i,
                :idle_processes       => stats["idle processes"].to_i,
                :active_processes     => stats["active processes"].to_i,
                :total_processes      => stats["total processes"].to_i,
                :accepted_conn        => stats["accepted conn"].to_i,
                :listen_queue         => stats["listen queue"].to_i,
                :listen_queue_len     => stats["listen queue len"].to_i,
                :max_active_processes => stats["max active processes"].to_i,
                :max_children_reached => stats["max children reached"].to_i
                })
        end
    rescue StandardError => trouble
      report({
            :is_up => 0,
            :message => "#{trouble} #{trouble.backtrace}"
            })
    end     
  end
end
{'fraction_non_alphanumeric': 0.11639460610361958, 'fraction_numerical': 0.0014194464158978, 'mean_word_length': 1.8775510204081634, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, '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': '3723108', 'n_tokens_mistral': 412, 'n_tokens_neox': 397, 'n_words': 98}