naginata 0.1.3 → 0.1.4

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: 2561fc701669bc413ed8bbcc48f46aa054b2cd65
4
- data.tar.gz: 8c9672f7ef3bafe0cdb60fd05f40062e19fb0565
3
+ metadata.gz: b5153f8a4699719891f2a79d83eb4b66c1cca2a1
4
+ data.tar.gz: 8ceceddd2a134409b7fed9a382311342dd6ca783
5
5
  SHA512:
6
- metadata.gz: 7c971bc2a2efa363a82696a4f7cfaae08532d22627af1007679dd41b90b9dbbd711f06f32d192b170c364261faedd1bbec6d928c6fbbc2a1fd10dd91eeb53d92
7
- data.tar.gz: 6e51ccf9cb2e4015b3aa9e5a7ffc5ad91a23ce2377b6c7c405cb05e368392f12fe6d8d358055b81ba13e573e63637c273058cb2f210f114dba990348829c0f56
6
+ metadata.gz: 0c5a5b08495929ea05708b73bb00036114f30b7264788f9b10ce2266822ec9385e867c70e7f8e83703a848e5565c7538b3dc6cfb3a533fa936c8417f58b99020
7
+ data.tar.gz: 3863bc85efbb2bafc139427b8b323e3230e81b1aeddea2beed36d27172f93bc41d6aa593e0406d4987116c779ec071429f7110b3f7745b5612366a5bbc3f96e1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.1.4 - 2015/04/08
2
+
3
+ CLI:
4
+
5
+ * Add shorter aliases -N for --nagios option
6
+ * Add -w option wide output for hosts and services view
7
+
1
8
  ### 0.1.3 - 2015/04/06
2
9
 
3
10
  Fixes:
data/README.md CHANGED
@@ -5,7 +5,7 @@ Naginata is multi nagios server control tool. If you have multiple nagios server
5
5
  Naginata includes `naginata` command executable. `naginata` command can be done by just single command execution from workstation host.
6
6
 
7
7
  * Enable/Disable notifications of hosts and services.
8
- * Display current host and service status. (will be added)
8
+ * Display current host and service status.
9
9
  * and more
10
10
 
11
11
  If you already have nagios servers, it's easy to try out Naginata! It does not require to install ruby and Naginata on remote nagio servers.
@@ -111,7 +111,7 @@ Output example:
111
111
  ```
112
112
  $ naginata services -a
113
113
  NAGIOS HOST SERVICE STATUS FLAGS OUTPUT
114
- nagios0 localhost HTTP WARNING AC,nt HTTP WARNING: HTTP/1.1 403 Forbidden - 5152 bytes in 0.001 second response time
114
+ nagios0 localhost HTTP WARNING AC,nt HTTP WARNING: HTTP/1.1 403 Forbidden - 5152 bytes ...
115
115
  nagios0 localhost Current Load OK AC,NT OK - load average: 0.00, 0.00, 0.00
116
116
  nagios0 localhost PING OK AC,NT PING OK - Packet loss = 0%, RTA = 0.04 ms
117
117
  nagios0 redis01.tokyo.local Load CRITICAL AC,NT Too high load average 15
@@ -167,9 +167,9 @@ $ naginata hosts web01.example.com db01.example.com
167
167
  ```
168
168
 
169
169
 
170
- ### Filtering by nagios servers
170
+ ### Nagios server filter
171
171
 
172
- You can limit target nagios server with `--nagios=server1,..` option.
172
+ You can filter targeted nagios servers with `--nagios=nagiosserver1,..` (or `-N=` shortly) option.
173
173
 
174
174
  For example:
175
175
 
@@ -189,9 +189,7 @@ naginata command with `--debug`
189
189
 
190
190
  ## Development
191
191
 
192
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
193
-
194
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
192
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake console` for an interactive prompt that will allow you to experiment.
195
193
 
196
194
  ## Contributing
197
195
 
data/lib/naginata/cli.rb CHANGED
@@ -22,7 +22,7 @@ module Naginata
22
22
  method_option :disable, aliases: "-d", desc: "Disable notification", type: :boolean
23
23
  method_option :dry_run, aliases: "-n", type: :boolean
24
24
  method_option :force, aliases: "-f", desc: "Run without prompting for confirmation", type: :boolean
25
- method_option :nagios, desc: "Filter hosts by nagios server names", type: :array
25
+ method_option :nagios, aliases: "-N", desc: "Filter targeted nagios servers by their hostname", type: :array
26
26
  method_option :services, aliases: "-s", desc: "Services to be enabled|disabled", type: :array
27
27
  method_option :all_hosts, aliases: "-a", desc: "Target all hosts", type: :boolean
28
28
  def notification(*patterns)
@@ -34,7 +34,7 @@ module Naginata
34
34
  CLI::Notification.new(options.merge(patterns: patterns)).execute
35
35
  end
36
36
 
37
- method_option :nagios, desc: "Filter hosts by nagios server names", type: :array
37
+ method_option :nagios, aliases: "-N", desc: "Filter targeted nagios servers by their hostname", type: :array
38
38
  desc 'fetch', 'Download remote status.dat and create cache on local'
39
39
  def fetch
40
40
  require 'naginata/cli/fetch'
@@ -42,8 +42,9 @@ module Naginata
42
42
  end
43
43
 
44
44
  desc 'hosts [hostpattern ..]', 'View host status'
45
- method_option :nagios, desc: "Filter hosts by nagios server names", type: :array
45
+ method_option :nagios, aliases: "-N", desc: "Filter targeted nagios servers by their hostname", type: :array
46
46
  method_option :all_hosts, aliases: "-a", desc: "Target all hosts", type: :boolean
47
+ method_option :wide, aliases: "-w", desc: "Wide output", type: :boolean
47
48
  def hosts(*patterns)
48
49
  if patterns.empty? and !options[:all_hosts]
49
50
  help(:hosts)
@@ -54,9 +55,10 @@ module Naginata
54
55
  end
55
56
 
56
57
  desc 'services [hostpattern ..]', 'View service status'
57
- method_option :nagios, desc: "Filter hosts by nagios server names", type: :array
58
+ method_option :nagios, aliases: "-N", desc: "Filter targeted nagios servers by their hostname", type: :array
58
59
  method_option :services, aliases: "-s", desc: "Filter by service description", type: :array
59
60
  method_option :all_hosts, aliases: "-a", desc: "Target all hosts", type: :boolean
61
+ method_option :wide, aliases: "-w", desc: "Wide output", type: :boolean
60
62
  def services(*patterns)
61
63
  if patterns.empty? and !options[:all_hosts]
62
64
  help(:services)
@@ -24,7 +24,7 @@ module Naginata
24
24
  }
25
25
  table.concat(status.decorate.hosts_table)
26
26
  end
27
- Naginata.ui.print_table table
27
+ Naginata.ui.print_table(table, truncate: !@options[:wide])
28
28
  end
29
29
 
30
30
  end
@@ -31,7 +31,7 @@ module Naginata
31
31
  }
32
32
  table.concat(status.decorate.services_table)
33
33
  end
34
- Naginata.ui.print_table table
34
+ Naginata.ui.print_table(table, truncate: !@options[:wide])
35
35
  end
36
36
 
37
37
  end
@@ -41,7 +41,7 @@ module Naginata
41
41
  #
42
42
  # @return [StatusDecorator]
43
43
  def decorate
44
- StatusDecorator.new(self)
44
+ @decorator ||= StatusDecorator.new(self)
45
45
  end
46
46
 
47
47
  # Create a new instance from raw status.dat string
@@ -35,3 +35,6 @@
35
35
  # user: 'admin',
36
36
  # keys: %w(/path/to/private_key),
37
37
  # }
38
+
39
+ # Default value for :pty is false
40
+ # set :pty, true
@@ -1,3 +1,3 @@
1
1
  module Naginata
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -4,7 +4,7 @@ module NagiosAnalyzer
4
4
  class Section
5
5
 
6
6
  def decorate
7
- SectionDecorator.new(self)
7
+ @decorator ||= SectionDecorator.new(self)
8
8
  end
9
9
 
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naginata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobuhiro Nikushi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sshkit