alerty 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 689717247b8b716abcb2c075cb639dea127bceb4
4
- data.tar.gz: 3e30b2ad81fef99ed76de3890f2fd604e352874c
3
+ metadata.gz: e0be1ca225982a4ccff7e0f9d835abb80518d5ee
4
+ data.tar.gz: 7cbf3f8fb89ee97e5f71a0614042adf39dac4b43
5
5
  SHA512:
6
- metadata.gz: e8f92fe2bf8a763242ba11a153ce4c61e2fd94d2a05bc4187ce324c6f97fb62be620a9a115556a590a88997ef75b5ff7f5ec9145a91b77acc16b212816995e39
7
- data.tar.gz: c579e1a0202ae502bf43ff8b52961fb1bbfb5b5fb400781b48e7e848865e48ac93a412881a45b93103523e6864860ddf006ab3a6d0fe6d761de88685f5f44b6a
6
+ metadata.gz: ca6ceb14d27c6485858b3fdf3cb122b8edebe87b2437811c4b89a7b0e85ab9f983dfb80bb2084c07e120a0fcbcd8d843d9f3bdb5945b84b69c71d1ad6d07f1aa
7
+ data.tar.gz: 6db27634148695a234d35b55ebf7367f821bc682a5ce99186a959e8b246a45474e54f95034a45ba45fbe490bbfe933596c493666b76c876cea598c99c651a310
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.1.0 (2016/03/28)
2
+
3
+ Enhancements:
4
+
5
+ * Add --log-shift-age option
6
+ * Add --log-shift-size option
7
+
1
8
  # 0.0.9 (2015/11/23)
2
9
 
3
10
  Enhancements:
data/README.md CHANGED
@@ -21,8 +21,10 @@ gem install alerty
21
21
  You can write a configuration file located at `/etc/alerty/alerty.yml` (You can configure this path by `ALERTY_CONFIG_FILE` environment variable, or `-c` option):
22
22
 
23
23
  ```
24
- log_path: STDOUT
25
- log_level: 'debug'
24
+ log_path: /var/tmp/alerty.log
25
+ log_level: 'info'
26
+ log_shift_age: 10
27
+ log_shift_size: 10485760
26
28
  timeout: 10
27
29
  lock_path: /tmp/lock
28
30
  retry_limit: 2
@@ -42,12 +44,14 @@ $ alerty -c example.yml -- ls -l /something_not_exist
42
44
  ### CLI Help
43
45
 
44
46
  ```
45
- $ bin/alerty -h
47
+ Usage: alerty [options] -- command
46
48
  -c, --config CONFIG_FILE config file path (default: /etc/alerty/alerty.yml)
47
49
  --log LOG_FILE log file path (default: STDOUT)
48
50
  -l, --log-level LOG_LEVEL log level (default: warn)
49
- -t, --timeout SECONDS timeout of the command, send alert if timeout reached (default: no timeout)
50
- --lock LOCK_FILE exclusive lock file to prevent running a command duplicatedly, send alert if locked (default: no lock)
51
+ --log-shift-age SHIFT_AGE Number of old log files to keep (default: 0 which means no log rotation)
52
+ --log-shift-size SHIFT_SIZE Maximum logfile size in bytes (default: 1048576)
53
+ -t, --timeout SECONDS timeout the command (default: no timeout)
54
+ --lock LOCK_FILE exclusive lock file to prevent running a command duplicatedly (default: no lock)
51
55
  --retry-limit NUMBER number of retries (default: 0)
52
56
  --retry-wait SECONDS retry interval = retry wait +/- 12.5% randomness (default: 1.0)
53
57
  -d, --debug debug mode (same with --log-level debug)
@@ -60,8 +64,12 @@ Following plugins are available:
60
64
  * [stdout](./lib/alerty/plugin/stdout.rb)
61
65
  * [file](./lib/alerty/plugin/file.rb)
62
66
  * [exec](./lib/alerty/plugin/exec.rb)
63
- * [alerty-plugin-ikachan](https://github.com/sonots/alerty-plugin-ikachan)
64
- * [alerty-plugin-amazon_sns](https://github.com/sonots/alerty-plugin-amazon_sns)
67
+ * [sonots/alerty-plugin-ikachan](https://github.com/sonots/alerty-plugin-ikachan)
68
+ * [sonots/alerty-plugin-amazon_sns](https://github.com/sonots/alerty-plugin-amazon_sns)
69
+ * [civitaspo/alerty-plugin-mail](https://github.com/civitaspo/alerty-plugin-mail)
70
+ * [inokappa/alerty-plugin-datadog_event](https://github.com/inokappa/alerty-plugin-datadog_event)
71
+ * [inokappa/alerty-plugin-amazon_cloudwatch_logs](https://github.com/inokappa/alerty-plugin-amazon_cloudwatch_logs)
72
+ * [inokappa/alerty-plugin-post_im_kayac](https://github.com/inokappa/alerty-plugin-post_im_kayac)
65
73
 
66
74
  ## Plugin Architecture
67
75
 
data/alerty.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "alerty"
3
- gem.version = '0.0.9'
3
+ gem.version = '0.1.0'
4
4
  gem.author = ['Naotoshi Seo']
5
5
  gem.email = ['sonots@gmail.com']
6
6
  gem.homepage = 'https://github.com/sonots/alerty'
data/lib/alerty/cli.rb CHANGED
@@ -25,6 +25,12 @@ class Alerty
25
25
  op.on('-l', '--log-level LOG_LEVEL', "log level (default: warn)") {|v|
26
26
  opts[:log_level] = v
27
27
  }
28
+ op.on('--log-shift-age SHIFT_AGE', "Number of old log files to keep (default: 0 which means no log rotation)") {|v|
29
+ opts[:log_shift_age] = Integer(v)
30
+ }
31
+ op.on('--log-shift-size SHIFT_SIZE', "Maximum logfile size in bytes (default: 1048576)") {|v|
32
+ opts[:log_shift_age] = Integer(v)
33
+ }
28
34
  op.on('-t', '--timeout SECONDS', "timeout the command (default: no timeout)") {|v|
29
35
  opts[:timeout] = v.to_f
30
36
  }
data/lib/alerty/config.rb CHANGED
@@ -26,6 +26,14 @@ class Alerty
26
26
  opts[:log_level] || config.log_level || 'warn'
27
27
  end
28
28
 
29
+ def log_shift_age
30
+ opts[:log_shift_age] || config.shift_age || 0
31
+ end
32
+
33
+ def log_shift_size
34
+ opts[:log_shift_size] || config.shift_size || 1048576
35
+ end
36
+
29
37
  def timeout
30
38
  opts[:timeout] || config.timeout
31
39
  end
data/lib/alerty.rb CHANGED
@@ -7,7 +7,7 @@ require_relative 'alerty/cli'
7
7
 
8
8
  class Alerty
9
9
  def self.logger
10
- @logger ||= Logger.new(Config.log_path).tap do |logger|
10
+ @logger ||= Logger.new(Config.log_path, Config.log_shift_age, Config.log_shift_size).tap do |logger|
11
11
  logger.level = Config.log_level
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alerty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-23 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.4.5
178
+ rubygems_version: 2.5.1
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Send an alert if a given command failed