fluent-plugin-proc_count 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.document +3 -0
 - data/.gitignore +9 -0
 - data/.travis.yml +15 -0
 - data/.yardopts +1 -0
 - data/ChangeLog.md +4 -0
 - data/Gemfile +7 -0
 - data/LICENSE.txt +20 -0
 - data/README.md +51 -0
 - data/Rakefile +11 -0
 - data/exsample/exsample.conf +25 -0
 - data/fluent-plugin-proc_count.gemspec +28 -0
 - data/lib/fluent/plugin/in_proc_count.rb +81 -0
 - data/test/helper.rb +18 -0
 - data/test/plugin/test_in_proc_count.rb +52 -0
 - metadata +186 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 65cf9683795c5e95e8930157f62738313453df9f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0a20921c1ddb7c8ad1a572e6e2d2829b29b0b760
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4faf563de09bd3560d12e9d27fa16c3024353ce6d30c5b54915d320419b194f848c509c845ddb2b6de63f5fe3e7248063b3029267a2b04081b0280916e12a529
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cd0242d1f8e3cabf384f0fc15d7a660d391ca294e82f4a94fdd1005c5b0eeb5d3f5e5dd6518c36b4ed83b144f5cea8c715b71a8fa0dcaab81cbb4e8448a05e62
         
     | 
    
        data/.document
    ADDED
    
    
    
        data/.gitignore
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/.yardopts
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --markup markdown --title "fluent-plugin-proc_count Documentation" --protected
         
     | 
    
        data/ChangeLog.md
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2016 toyama0919
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 4 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 5 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 6 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 7 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 8 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 9 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 12 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 15 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 16 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 17 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 18 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 19 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # fluent-plugin-proc_count
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            process count check plugin for fluentd
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Examples
         
     | 
| 
      
 6 
     | 
    
         
            +
            ```
         
     | 
| 
      
 7 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 8 
     | 
    
         
            +
              @type proc_count
         
     | 
| 
      
 9 
     | 
    
         
            +
              interval 60s
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              <process>
         
     | 
| 
      
 12 
     | 
    
         
            +
                tag proc_count.fluentd
         
     | 
| 
      
 13 
     | 
    
         
            +
                regexp bin/fluentd
         
     | 
| 
      
 14 
     | 
    
         
            +
                proc_count 2 # expect process count
         
     | 
| 
      
 15 
     | 
    
         
            +
              </process>
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              <process>
         
     | 
| 
      
 18 
     | 
    
         
            +
                tag proc_count.embulk
         
     | 
| 
      
 19 
     | 
    
         
            +
                regexp embulk
         
     | 
| 
      
 20 
     | 
    
         
            +
                proc_count 1 # expect process count
         
     | 
| 
      
 21 
     | 
    
         
            +
              </process>
         
     | 
| 
      
 22 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 25 
     | 
    
         
            +
              @type stdout
         
     | 
| 
      
 26 
     | 
    
         
            +
            </match>
         
     | 
| 
      
 27 
     | 
    
         
            +
            ```
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            #### output
         
     | 
| 
      
 30 
     | 
    
         
            +
            ```
         
     | 
| 
      
 31 
     | 
    
         
            +
            # output: proc_count.example:  {"regexp":"embulk","proc_count":0,"expect_proc_count":1,"hostname":"npc064.local"}
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            1. Fork it
         
     | 
| 
      
 37 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 38 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 39 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 40 
     | 
    
         
            +
            5. Create new [Pull Request](../../pull/new/master)
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ## Information
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            * [Homepage](https://github.com/toyama0919/fluent-plugin-proc_count)
         
     | 
| 
      
 45 
     | 
    
         
            +
            * [Issues](https://github.com/toyama0919/fluent-plugin-proc_count/issues)
         
     | 
| 
      
 46 
     | 
    
         
            +
            * [Documentation](http://rubydoc.info/gems/fluent-plugin-proc_count/frames)
         
     | 
| 
      
 47 
     | 
    
         
            +
            * [Email](mailto:toyama0919@gmail.com)
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            ## Copyright
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            Copyright (c) 2016 toyama0919
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 2 
     | 
    
         
            +
              @type forward
         
     | 
| 
      
 3 
     | 
    
         
            +
              port 24224
         
     | 
| 
      
 4 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 7 
     | 
    
         
            +
              @type proc_count
         
     | 
| 
      
 8 
     | 
    
         
            +
              interval 60s
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              <process>
         
     | 
| 
      
 11 
     | 
    
         
            +
                tag proc_count.fluentd
         
     | 
| 
      
 12 
     | 
    
         
            +
                regexp bin/fluentd
         
     | 
| 
      
 13 
     | 
    
         
            +
                proc_count 2 # expect process count
         
     | 
| 
      
 14 
     | 
    
         
            +
              </process>
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              <process>
         
     | 
| 
      
 17 
     | 
    
         
            +
                tag proc_count.embulk
         
     | 
| 
      
 18 
     | 
    
         
            +
                regexp embulk
         
     | 
| 
      
 19 
     | 
    
         
            +
                proc_count 1 # expect process count
         
     | 
| 
      
 20 
     | 
    
         
            +
              </process>
         
     | 
| 
      
 21 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 24 
     | 
    
         
            +
              @type stdout
         
     | 
| 
      
 25 
     | 
    
         
            +
            </match>
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Gem::Specification.new do |gem|
         
     | 
| 
      
 4 
     | 
    
         
            +
              gem.name          = "fluent-plugin-proc_count"
         
     | 
| 
      
 5 
     | 
    
         
            +
              gem.version       = "0.0.1"
         
     | 
| 
      
 6 
     | 
    
         
            +
              gem.summary       = %q{process count check plugin for fluentd.}
         
     | 
| 
      
 7 
     | 
    
         
            +
              gem.description   = %q{process count check plugin for fluentd.}
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem.license       = "MIT"
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem.authors       = ["toyama0919"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem.email         = "toyama0919@gmail.com"
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem.homepage      = "https://github.com/toyama0919/fluent-plugin-proc_count"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              gem.files         = `git ls-files`.split($/)
         
     | 
| 
      
 14 
     | 
    
         
            +
              gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem.require_paths = ['lib']
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              gem.add_runtime_dependency 'ffi'
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem.add_runtime_dependency 'sys-proctable'
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              gem.add_development_dependency 'bundler'
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem.add_development_dependency 'fluentd'
         
     | 
| 
      
 23 
     | 
    
         
            +
              gem.add_development_dependency 'pry'
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem.add_development_dependency 'rake'
         
     | 
| 
      
 25 
     | 
    
         
            +
              gem.add_development_dependency 'rubocop'
         
     | 
| 
      
 26 
     | 
    
         
            +
              gem.add_development_dependency 'rubygems-tasks'
         
     | 
| 
      
 27 
     | 
    
         
            +
              gem.add_development_dependency 'yard'
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,81 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'sys/proctable'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'ostruct'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Fluent
         
     | 
| 
      
 5 
     | 
    
         
            +
              class ProcCountInput < Fluent::Input
         
     | 
| 
      
 6 
     | 
    
         
            +
                Plugin.register_input 'proc_count', self
         
     | 
| 
      
 7 
     | 
    
         
            +
                include Sys
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 10 
     | 
    
         
            +
                  super
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                config_param :interval, :time, default: '5m'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                config_section :process, required: true, param_name: :processes do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  config_param :tag, :string
         
     | 
| 
      
 17 
     | 
    
         
            +
                  config_param :regexp, :string
         
     | 
| 
      
 18 
     | 
    
         
            +
                  config_param :proc_count, :integer, default: 1
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def configure(conf)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  super
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @processes = @processes.map { |process| 
         
     | 
| 
      
 24 
     | 
    
         
            +
                    s = OpenStruct.new
         
     | 
| 
      
 25 
     | 
    
         
            +
                    s.regexp = Regexp.new(process.regexp)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    s.proc_count = process.proc_count
         
     | 
| 
      
 27 
     | 
    
         
            +
                    s.tag = process.tag
         
     | 
| 
      
 28 
     | 
    
         
            +
                    s
         
     | 
| 
      
 29 
     | 
    
         
            +
                  }
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                def start
         
     | 
| 
      
 33 
     | 
    
         
            +
                  super
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @thread = Thread.new(&method(:run))
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def shutdown
         
     | 
| 
      
 38 
     | 
    
         
            +
                  super
         
     | 
| 
      
 39 
     | 
    
         
            +
                  Thread.kill(@thread)
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def run
         
     | 
| 
      
 43 
     | 
    
         
            +
                  loop do
         
     | 
| 
      
 44 
     | 
    
         
            +
                    Thread.new(&method(:emit_proc_count))
         
     | 
| 
      
 45 
     | 
    
         
            +
                    sleep @interval
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                def emit_proc_count
         
     | 
| 
      
 50 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 51 
     | 
    
         
            +
                    @processes.each do |process_spec|
         
     | 
| 
      
 52 
     | 
    
         
            +
                      records = get_processes(process_spec)
         
     | 
| 
      
 53 
     | 
    
         
            +
                      if process_spec.proc_count != records.size
         
     | 
| 
      
 54 
     | 
    
         
            +
                        router.emit(
         
     | 
| 
      
 55 
     | 
    
         
            +
                          process_spec.tag,
         
     | 
| 
      
 56 
     | 
    
         
            +
                          Fluent::Engine.now,
         
     | 
| 
      
 57 
     | 
    
         
            +
                          {
         
     | 
| 
      
 58 
     | 
    
         
            +
                            regexp: process_spec.regexp.source,
         
     | 
| 
      
 59 
     | 
    
         
            +
                            proc_count: records.size,
         
     | 
| 
      
 60 
     | 
    
         
            +
                            expect_proc_count: process_spec.proc_count,
         
     | 
| 
      
 61 
     | 
    
         
            +
                            hostname: Socket.gethostname
         
     | 
| 
      
 62 
     | 
    
         
            +
                          }
         
     | 
| 
      
 63 
     | 
    
         
            +
                        )
         
     | 
| 
      
 64 
     | 
    
         
            +
                      end
         
     | 
| 
      
 65 
     | 
    
         
            +
                    end
         
     | 
| 
      
 66 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 67 
     | 
    
         
            +
                    log.error e
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                def get_processes(process_spec)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  processes = []
         
     | 
| 
      
 73 
     | 
    
         
            +
                  ProcTable.ps do |process|
         
     | 
| 
      
 74 
     | 
    
         
            +
                    if process_spec.regexp.match(process.cmdline)
         
     | 
| 
      
 75 
     | 
    
         
            +
                      processes << process
         
     | 
| 
      
 76 
     | 
    
         
            +
                    end
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  processes
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
              end
         
     | 
| 
      
 81 
     | 
    
         
            +
            end
         
     | 
    
        data/test/helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundler'
         
     | 
| 
      
 3 
     | 
    
         
            +
            begin
         
     | 
| 
      
 4 
     | 
    
         
            +
              Bundler.setup(:default, :development)
         
     | 
| 
      
 5 
     | 
    
         
            +
            rescue Bundler::BundlerError => e
         
     | 
| 
      
 6 
     | 
    
         
            +
              $stderr.puts e.message
         
     | 
| 
      
 7 
     | 
    
         
            +
              $stderr.puts "Run `bundle install` to install missing gems"
         
     | 
| 
      
 8 
     | 
    
         
            +
              exit e.status_code
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'test/unit'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         
     | 
| 
      
 13 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__))
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'fluent/test'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require 'fluent/plugin/in_proc_count'
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            class Test::Unit::TestCase
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,52 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class ProcCountInputTest < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 5 
     | 
    
         
            +
                Fluent::Test.setup
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def create_driver(conf)
         
     | 
| 
      
 9 
     | 
    
         
            +
                Fluent::Test::InputTestDriver.new(Fluent::ProcCountInput).configure(conf)
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def test_configure_full
         
     | 
| 
      
 13 
     | 
    
         
            +
                d = create_driver %q{
         
     | 
| 
      
 14 
     | 
    
         
            +
                  interval 60s
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  <process>
         
     | 
| 
      
 17 
     | 
    
         
            +
                    tag proc_count.fluentd
         
     | 
| 
      
 18 
     | 
    
         
            +
                    regexp bin/fluentd
         
     | 
| 
      
 19 
     | 
    
         
            +
                    proc_count 2
         
     | 
| 
      
 20 
     | 
    
         
            +
                  </process>
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  <process>
         
     | 
| 
      
 23 
     | 
    
         
            +
                    tag proc_count.embulk
         
     | 
| 
      
 24 
     | 
    
         
            +
                    regexp embulk
         
     | 
| 
      
 25 
     | 
    
         
            +
                    proc_count 1
         
     | 
| 
      
 26 
     | 
    
         
            +
                  </process>
         
     | 
| 
      
 27 
     | 
    
         
            +
                }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal 'test', d.instance.tag
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert_equal 10 * 60, d.instance.interval
         
     | 
| 
      
 31 
     | 
    
         
            +
                assert_equal 'hoge', d.instance.instance_variable_get(:@hoge)
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              def test_configure_error_when_config_is_empty
         
     | 
| 
      
 35 
     | 
    
         
            +
                assert_raise(Fluent::ConfigError) do
         
     | 
| 
      
 36 
     | 
    
         
            +
                  create_driver ''
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              def test_emit
         
     | 
| 
      
 41 
     | 
    
         
            +
                d = create_driver
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                d.run do
         
     | 
| 
      
 44 
     | 
    
         
            +
                  sleep 2
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                emits = d.emits
         
     | 
| 
      
 48 
     | 
    
         
            +
                assert_equal true, emits.length > 0
         
     | 
| 
      
 49 
     | 
    
         
            +
                assert_equal "tag1", emits[0].first
         
     | 
| 
      
 50 
     | 
    
         
            +
                assert_equal ({"k1"=>"ok"}), emits[0].last
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,186 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: fluent-plugin-proc_count
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - toyama0919
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-11-17 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: ffi
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: sys-proctable
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: fluentd
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: rubocop
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: rubygems-tasks
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: yard
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 130 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 132 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 133 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 135 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 139 
     | 
    
         
            +
            description: process count check plugin for fluentd.
         
     | 
| 
      
 140 
     | 
    
         
            +
            email: toyama0919@gmail.com
         
     | 
| 
      
 141 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 142 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 143 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 144 
     | 
    
         
            +
            files:
         
     | 
| 
      
 145 
     | 
    
         
            +
            - ".document"
         
     | 
| 
      
 146 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 147 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 148 
     | 
    
         
            +
            - ".yardopts"
         
     | 
| 
      
 149 
     | 
    
         
            +
            - ChangeLog.md
         
     | 
| 
      
 150 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 151 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 152 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 153 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 154 
     | 
    
         
            +
            - exsample/exsample.conf
         
     | 
| 
      
 155 
     | 
    
         
            +
            - fluent-plugin-proc_count.gemspec
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lib/fluent/plugin/in_proc_count.rb
         
     | 
| 
      
 157 
     | 
    
         
            +
            - test/helper.rb
         
     | 
| 
      
 158 
     | 
    
         
            +
            - test/plugin/test_in_proc_count.rb
         
     | 
| 
      
 159 
     | 
    
         
            +
            homepage: https://github.com/toyama0919/fluent-plugin-proc_count
         
     | 
| 
      
 160 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 161 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 162 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 163 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 164 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 165 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 166 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 167 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 168 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 169 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 170 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 171 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 172 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 173 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 174 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 175 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 176 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 177 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 178 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 179 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
      
 180 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 181 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 182 
     | 
    
         
            +
            summary: process count check plugin for fluentd.
         
     | 
| 
      
 183 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 184 
     | 
    
         
            +
            - test/helper.rb
         
     | 
| 
      
 185 
     | 
    
         
            +
            - test/plugin/test_in_proc_count.rb
         
     | 
| 
      
 186 
     | 
    
         
            +
            has_rdoc: 
         
     |