lita-nagios 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/nagios.rb +17 -19
- data/lita-nagios.gemspec +3 -3
- data/spec/lita/handlers/nagios_spec.rb +14 -0
- data/spec/spec_helper.rb +9 -0
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88f8e45007a3d4f0268225a304e51588abcf42bd
|
4
|
+
data.tar.gz: 8483c8262be5092f99e957422c4a62e237d506b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d9af0f47043be5e55490aba6e1c64042424e6066c64f0b065651a4a0cfe463c0e873be66cddc1ae9771f12fd334924a401f8c6d464499b833258897e535b888
|
7
|
+
data.tar.gz: 73ab2c13d36eb3988bc62391a3cc2ea49c3bd1a1b476d57606b9d99d86b0fe1272bca372cc0b8401de4cf3a9126099ca6a1bc59f8a168520bfc445a45db5f57c
|
data/lib/lita/handlers/nagios.rb
CHANGED
@@ -2,24 +2,22 @@ module Lita
|
|
2
2
|
module Handlers
|
3
3
|
class Nagios < Handler
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
config.verify_ssl = true
|
13
|
-
end
|
5
|
+
config :default_room
|
6
|
+
config :cgi, default: "http://nagios.example.com/cgi-bin/nagios3"
|
7
|
+
config :user, default: "nagiosuser"
|
8
|
+
config :pass, default: "nagiospass"
|
9
|
+
config :version, default: 3
|
10
|
+
config :time_format, default: "iso8601"
|
11
|
+
config :verify_ssl, default: true
|
14
12
|
|
15
13
|
def initialize(robot)
|
16
14
|
@site = NagiosHarder::Site.new(
|
17
|
-
config.cgi,
|
18
|
-
config.user,
|
19
|
-
config.pass,
|
20
|
-
config.version,
|
21
|
-
config.time_format,
|
22
|
-
config.verify_ssl
|
15
|
+
robot.config.handlers.nagios.cgi,
|
16
|
+
robot.config.handlers.nagios.user,
|
17
|
+
robot.config.handlers.nagios.pass,
|
18
|
+
robot.config.handlers.nagios.version,
|
19
|
+
robot.config.handlers.nagios.time_format,
|
20
|
+
robot.config.handlers.nagios.verify_ssl
|
23
21
|
)
|
24
22
|
super(robot)
|
25
23
|
end
|
@@ -30,7 +28,7 @@ module Lita
|
|
30
28
|
|
31
29
|
route /^nagios\s+(?<action>enable|disable)\s+notif(ication(s)?)?/, :toggle_notifications,
|
32
30
|
command: true,
|
33
|
-
restrict_to: ["
|
31
|
+
restrict_to: ["nagios_admins"],
|
34
32
|
kwargs: {
|
35
33
|
host: { short: "h" },
|
36
34
|
service: { short: "s" }
|
@@ -52,7 +50,7 @@ module Lita
|
|
52
50
|
|
53
51
|
route /^nagios\s+recheck/, :recheck,
|
54
52
|
command: true,
|
55
|
-
restrict_to: ["
|
53
|
+
restrict_to: ["nagios_admins"],
|
56
54
|
kwargs: {
|
57
55
|
host: { short: "h" },
|
58
56
|
service: { short: "s" }
|
@@ -79,7 +77,7 @@ module Lita
|
|
79
77
|
|
80
78
|
route /^nagios\s+ack(nowledge)?/, :acknowledge,
|
81
79
|
command: true,
|
82
|
-
restrict_to: ["
|
80
|
+
restrict_to: ["nagios_admins"],
|
83
81
|
kwargs: {
|
84
82
|
host: { short: "h" },
|
85
83
|
service: { short: "s" },
|
@@ -110,7 +108,7 @@ module Lita
|
|
110
108
|
|
111
109
|
route /^nagios(\s+(?<type>fixed|flexible))?\s+downtime/, :schedule_downtime,
|
112
110
|
command: true,
|
113
|
-
restrict_to: ["
|
111
|
+
restrict_to: ["nagios_admins"],
|
114
112
|
kwargs: {
|
115
113
|
host: { short: "h" },
|
116
114
|
service: { short: "s" },
|
data/lita-nagios.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-nagios"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.2"
|
4
4
|
spec.authors = ["Jonathan Amiez"]
|
5
5
|
spec.email = ["jonathan.amiez@gmail.com"]
|
6
6
|
spec.description = "Nagios interaction with Lita"
|
@@ -14,13 +14,13 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
|
-
spec.add_runtime_dependency "lita", "
|
17
|
+
spec.add_runtime_dependency "lita", "~> 4.0"
|
18
18
|
spec.add_runtime_dependency "lita-keyword-arguments"
|
19
19
|
spec.add_runtime_dependency "nagiosharder", ">= 0.5.0"
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake", "~> 0"
|
23
|
-
spec.add_development_dependency "rspec", "
|
23
|
+
spec.add_development_dependency "rspec", ">= 3.0.0.beta2"
|
24
24
|
spec.add_development_dependency "simplecov"
|
25
25
|
spec.add_development_dependency "coveralls"
|
26
26
|
end
|
@@ -1,4 +1,18 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lita::Handlers::Nagios, lita_handler: true do
|
4
|
+
it { is_expected.to route_http(:post, "/nagios/notifications").to(:receive) }
|
5
|
+
it { is_expected.to route_command("nagios enable notif -h par-db4").with_authorization_for(:nagios_admins).to(:toggle_notifications) }
|
6
|
+
it { is_expected.to route_command("nagios enable notif -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:toggle_notifications) }
|
7
|
+
it { is_expected.to route_command("nagios disable notification -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:toggle_notifications) }
|
8
|
+
it { is_expected.to route_command("nagios disable notifications -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:toggle_notifications) }
|
9
|
+
|
10
|
+
it { is_expected.to route_command("nagios recheck -h par-db4").with_authorization_for(:nagios_admins).to(:recheck) }
|
11
|
+
it { is_expected.to route_command("nagios recheck -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:recheck) }
|
12
|
+
|
13
|
+
it { is_expected.to route_command("nagios ack -h par-db4").with_authorization_for(:nagios_admins).to(:acknowledge) }
|
14
|
+
it { is_expected.to route_command("nagios ack -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:acknowledge) }
|
15
|
+
|
16
|
+
it { is_expected.to route_command("nagios fixed downtime -d 2h -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:schedule_downtime) }
|
17
|
+
it { is_expected.to route_command("nagios flexible downtime -d 2h -h par-db4 -s Load").with_authorization_for(:nagios_admins).to(:schedule_downtime) }
|
4
18
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,11 @@
|
|
1
|
+
require "simplecov"
|
2
|
+
require "coveralls"
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
4
|
+
SimpleCov::Formatter::HTMLFormatter,
|
5
|
+
Coveralls::SimpleCov::Formatter
|
6
|
+
]
|
7
|
+
SimpleCov.start { add_filter "/spec/" }
|
8
|
+
|
1
9
|
require "lita-nagios"
|
2
10
|
require "lita/rspec"
|
11
|
+
Lita.version_3_compatibility_mode = false
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-nagios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Amiez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: lita-keyword-arguments
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 3.0.0.beta2
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 3.0.0.beta2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|