fluent-plugin-apache_modstatus 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/fluent-plugin-apache_modstatus.gemspec +23 -0
- data/lib/fluent/plugin/in_apache_modstatus.rb +66 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4e3327d7ed60435a3d45620ad98b8de76d7f28c
|
4
|
+
data.tar.gz: 7f62e834fb68da23bc88c4c6561bb36fec67bc1e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd8fcb838484c58bd0fe5092e40c17af18b22966a68689ece7348f9f5c05bd5389ea9b788620d2a99208a999fe2df14ca56423cff4c741d5cb7c09e610fdb076
|
7
|
+
data.tar.gz: 292dfc69030b1e3facd6107de87943ddd2b6212cf66caa4cd490b6c3b11531445c9482e9ae9c055a8dde78284d536fa4fb2cce90d0266474c16a52938e5c1b52
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jason Westbrook
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Fluent::Plugin::Apache::ModStatus
|
2
|
+
|
3
|
+
Collect Apache stats from the mod_status Module
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
fluent-gem install fluent-plugin-diskusage
|
9
|
+
```
|
10
|
+
or
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-diskusage
|
14
|
+
```
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
`refresh_interval` is an optional parameter, by default the plugin will poll every 2 minutes (120 seconds)
|
19
|
+
|
20
|
+
```
|
21
|
+
<source>
|
22
|
+
type apache_modstatus
|
23
|
+
url http://localhost/server-status/?auto
|
24
|
+
tag apache.server_status
|
25
|
+
refresh_interval 30
|
26
|
+
</source>
|
27
|
+
```
|
28
|
+
|
29
|
+
### Record Format
|
30
|
+
|
31
|
+
Your record format might vary depending on what extensions and options are turned on in your config. The plugin looks at the machine readable mod_serverstatus output and parses all the "Label: VALUE" lines and outputs them in the record
|
32
|
+
|
33
|
+
```
|
34
|
+
"serverversion" => "Apache/2.4.16"
|
35
|
+
"servermpm" => "prefork"
|
36
|
+
"server_built" => "Aug 13 2015 23:52:13"
|
37
|
+
"currenttime" => "Friday, 18-Sep-2015 14:40:21 PDT"
|
38
|
+
"restarttime" => "Sunday, 13-Sep-2015 03:20:23 PDT"
|
39
|
+
"parentserverconfiggeneration" => "5"
|
40
|
+
"parentservermpmgeneration" => "4"
|
41
|
+
"serveruptimeseconds" => "472798"
|
42
|
+
"serveruptime" => "5 days 11 hours 19 minutes 58 seconds"
|
43
|
+
"load1" => "0.31"
|
44
|
+
"load5" => "0.21"
|
45
|
+
"load15" => "0.21"
|
46
|
+
"total_accesses" => "1205397"
|
47
|
+
"total_kbytes" => "44430012"
|
48
|
+
"cpuuser" => "233.95"
|
49
|
+
"cpusystem" => "38.8"
|
50
|
+
"cpuchildrenuser" => "5243.08"
|
51
|
+
"cpuchildrensystem" => "8685.85"
|
52
|
+
"cpuload" => "3.00375"
|
53
|
+
"uptime" => "472798"
|
54
|
+
"reqpersec" => "2.5495"
|
55
|
+
"bytespersec" => "96227.8"
|
56
|
+
"bytesperreq" => "37743.9"
|
57
|
+
"busyworkers" => "35"
|
58
|
+
"idleworkers" => "3"
|
59
|
+
```
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jwestbrook/fluent-plugin-apache-modstatus.
|
64
|
+
|
65
|
+
|
66
|
+
## License
|
67
|
+
|
68
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
69
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "fluent-plugin-apache_modstatus"
|
7
|
+
spec.version = '0.0.3'
|
8
|
+
spec.authors = ["Jason Westbrook"]
|
9
|
+
spec.email = ["jwestbrook@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Gather the status from the Apache mod_status Module}
|
12
|
+
spec.homepage = "https://github.com/jwestbrook/fluent-plugin-apache_modstatus"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "fluentd", [">= 0.10.30", "< 2"]
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
class Fluent::ApacheModStatus < Fluent::Input
|
2
|
+
Fluent::Plugin.register_input('apache_modstatus',self)
|
3
|
+
|
4
|
+
# Define `router` method to support v0.10.57 or earlier
|
5
|
+
unless method_defined?(:router)
|
6
|
+
define_method("router") { Fluent::Engine }
|
7
|
+
end
|
8
|
+
|
9
|
+
config_param :tag, :string
|
10
|
+
config_param :url, :string
|
11
|
+
config_param :refresh_interval, :integer, :default => 120
|
12
|
+
|
13
|
+
def configure(conf)
|
14
|
+
super
|
15
|
+
require 'net/http'
|
16
|
+
require 'uri'
|
17
|
+
end
|
18
|
+
|
19
|
+
def valid_float(value)
|
20
|
+
!!Float(value) rescue false
|
21
|
+
end
|
22
|
+
|
23
|
+
def start
|
24
|
+
super
|
25
|
+
@watcher = Thread.new(&method(:run))
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
while true
|
30
|
+
output
|
31
|
+
sleep @refresh_interval
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def output
|
36
|
+
|
37
|
+
record = {}
|
38
|
+
|
39
|
+
page_content = Net::HTTP.get(URI.parse(@url))
|
40
|
+
status_values = page_content.lines.map(&:chomp)
|
41
|
+
status_values.each do |item|
|
42
|
+
if item.include? "Scoreboard: "
|
43
|
+
|
44
|
+
elsif item.include? ": "
|
45
|
+
values = item.split(": ")
|
46
|
+
values[0].downcase!
|
47
|
+
values[0].gsub!(/ /,"_")
|
48
|
+
if valid_float(values[1])
|
49
|
+
record[values[0]] = values[1].to_f
|
50
|
+
else
|
51
|
+
record[values[0]] = values[1]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
time = Fluent::Engine.now
|
58
|
+
router.emit(tag,time,record)
|
59
|
+
end
|
60
|
+
|
61
|
+
def shutdown
|
62
|
+
@watcher.terminate
|
63
|
+
@watcher.join
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-apache_modstatus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Westbrook
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.30
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.10.30
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.10'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.10'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
description:
|
62
|
+
email:
|
63
|
+
- jwestbrook@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- .gitignore
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- fluent-plugin-apache_modstatus.gemspec
|
74
|
+
- lib/fluent/plugin/in_apache_modstatus.rb
|
75
|
+
homepage: https://github.com/jwestbrook/fluent-plugin-apache_modstatus
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.0.14
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Gather the status from the Apache mod_status Module
|
99
|
+
test_files: []
|