rapporteur-load_check 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +6 -1
- data/LICENSE.txt +1 -1
- data/README.md +9 -0
- data/lib/rapporteur/load_check.rb +13 -3
- data/rapporteur-load_check.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzU5ZjlhOWU0ZjllNDdjNDg3ZmYwOTExOWU1ZDY1ZjdmOGI2OTBmNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmViZjNlZmJiM2JhZGQyOGQ3YjQxZjk5MGE5ZDU4ZDcxMGFlODZjZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTEwNDNiYmVkMzYyMTM1ZGZmZDQ0NzQ0NzE5ZWYxNWU5ZWU5YzIxMjFhYjQ1
|
10
|
+
MmMxNTM5YzdlNGRkNjI3MzBjYjE4ZmEyZWM1ZGQ4ZGY1ZGEyM2ZhOTUzMGUx
|
11
|
+
MWVmMWZiNDI5MDcyNzVjZjY5NDUwMjFhZWE0N2Y3YTkwY2Y1NjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzVhYWVhYjc0Y2Y0M2YzODQ0NjQyMjYxZjdiNmY0ZWJkNmNhNjFkNzBiN2Ux
|
14
|
+
YjIzYzU4OWQxYTg1ZTRkY2RmODQ3NjFlODUxYTUwZTdmYjZkNmMwZjIxYzRm
|
15
|
+
Yjc0MTJhODhlYTFhZmFhNjkzZTVkOWFlMTNmODEyNTAyMmY2Mzc=
|
data/CHANGELOG.md
CHANGED
@@ -4,8 +4,13 @@
|
|
4
4
|
|
5
5
|
* No significant changes.
|
6
6
|
|
7
|
+
## [1.1.0][v1.1.0] / 2013-05-30
|
8
|
+
|
9
|
+
* Allow adjustment of load failure threshold.
|
10
|
+
|
7
11
|
## 1.0.0 / 2013-05-30
|
8
12
|
|
9
13
|
* Initial public release.
|
10
14
|
|
11
|
-
[unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/1.0
|
15
|
+
[unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/v1.1.0...master
|
16
|
+
[v1.1.0]: https://github.com/codeschool/rapporteur-load_check/compare/v1.0.0...v1.1.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -26,6 +26,15 @@ application configuration files or initializers, such as:
|
|
26
26
|
Rapporteur::Checker.add_check(Rapporteur::Checks::LoadCheck)
|
27
27
|
```
|
28
28
|
|
29
|
+
By default, a load value of 8 or greater triggers a failure. You can adjust
|
30
|
+
this value by passing the threshold to LoadCheck.new, like so:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Rapporteur::Checker.add_check(Rapporteur::Checks::LoadCheck.new(4))
|
34
|
+
```
|
35
|
+
|
36
|
+
The above would cause the checker to fail if load goes above 4.0.
|
37
|
+
|
29
38
|
## Contributing
|
30
39
|
|
31
40
|
1. Fork it
|
@@ -13,12 +13,22 @@ module Rapporteur
|
|
13
13
|
|
14
14
|
private_class_method :getloadavg, :strerror
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
DEFAULT_TOLERANCE = 8.0
|
17
|
+
|
18
|
+
def initialize(tolerance=DEFAULT_TOLERANCE)
|
19
|
+
@tolerance = tolerance
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(checker)
|
23
|
+
loadavg = self.class.current_load
|
24
|
+
checker.add_error(:excess_load) if loadavg > @tolerance
|
19
25
|
checker.add_message(:load, loadavg)
|
20
26
|
end
|
21
27
|
|
28
|
+
def self.call(checker)
|
29
|
+
new.call(checker)
|
30
|
+
end
|
31
|
+
|
22
32
|
def self.current_load
|
23
33
|
loadavg = FFI::MemoryPointer.new(:double, 1)
|
24
34
|
if getloadavg(loadavg, 1) == -1
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rapporteur-load_check"
|
7
|
-
spec.version = "1.
|
7
|
+
spec.version = "1.1.0"
|
8
8
|
spec.authors = ["Envy Labs", "Code School"]
|
9
9
|
spec.email = [""]
|
10
10
|
spec.description = %q{Machine load reporting for rapporteur}
|