<commit_before>module Moonshine
  module Scout

    # Define options for this plugin in config/moonshine.yml or the
    # <tt>configure</tt> method in your application manifest:
    #
    #   configure(:scout => {:agent_key => 'YOUR-SCOUT-KEY'})
    #
    # Then include the plugin and call the recipe(s) you need:
    #
    #  plugin :scout
    #  recipe :scout
    def scout(options = {})

      unless options[:agent_key]
        puts "To use the Scout agent, specify your key in config/moonshine.yml:"
        puts ":scout:"
        puts "  :agent_key: YOUR-SCOUT-KEY"
        return
      end

      gem 'scout', :ensure => :latest
      cron 'scout_checkin',
        :command  => "/usr/bin/scout #{options[:agent_key]}",
        :minute   => "*/#{options[:interval]||1}",
      :user     => options[:user] || configuration[:user] || 'daemon'

      # needed for apache status plugin
      package 'lynx', :ensure => :installed, :before => package('scout')
      cron 'cleanup_lynx_tempfiles',
        :command  => "find /tmp/ -name 'lynx*' -type d -delete",
        :hour     => '0',
        :minute   => '0'

      # provides iostat, needed for disk i/o plugin
      package 'sysstat', :ensure => :installed, :before => package('scout')
<commit_msg>Add deploy user to the adm group.<commit_after>module Moonshine
  module Scout

    # Define options for this plugin in config/moonshine.yml or the
    # <tt>configure</tt> method in your application manifest:
    #
    #   configure(:scout => {:agent_key => 'YOUR-SCOUT-KEY'})
    #
    # Then include the plugin and call the recipe(s) you need:
    #
    #  plugin :scout
    #  recipe :scout
    def scout(options = {})

      unless options[:agent_key]
        puts "To use the Scout agent, specify your key in config/moonshine.yml:"
        puts ":scout:"
        puts "  :agent_key: YOUR-SCOUT-KEY"
        return
      end

      gem 'scout', :ensure => :latest
      cron 'scout_checkin',
        :command  => "/usr/bin/scout #{options[:agent_key]}",
        :minute   => "*/#{options[:interval]||1}",
      :user     => options[:user] || configuration[:user] || 'daemon'

      # needed for apache status plugin
      package 'lynx', :ensure => :installed, :before => package('scout')
      cron 'cleanup_lynx_tempfiles',
        :command  => "find /tmp/ -name 'lynx*' -type d -delete",
        :hour     => '0',
        :minute   => '0'

      # provides iostat, needed for disk i/o plugin
      package 'sysstat', :ensure => :installed, :before => package('scout')

      # needed for MySQL Slow Queries to work
      # add user to adm group, to be able to acces
      # FIXME this seems to run EVERY time, regarless of the unless
      exec "usermod -a -G adm #{configuration[:user]}",
        :unless => "groups #{configuration[:rails]} | egrep '\\badm\\b'", # this could probably be more succintly and strongly specfied
        :before => package('scout')

{'fraction_non_alphanumeric': 0.13875598086124402, 'fraction_numerical': 0.002050580997949419, 'mean_word_length': 2.543583535108959, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 35, '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': '7449606', 'n_tokens_mistral': 923, 'n_tokens_neox': 903, 'n_words': 278}