zcollective 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/zcollective +32 -8
- data/lib/zcollective/zabbixclient.rb +2 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b248c41ffe0cffdb85ef264f9318624e2e73236
|
4
|
+
data.tar.gz: ce6a45137a8c5e94fd01ebef6d4213dc4ca47f74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63ea1f38c40b7cbdf76476599a21d82c1eeb4d5f2dc0f960ac9e25710e4a59a52d9388ea431fd530ebaa5807932e7d679de51a6d871f19f1dc58c355188fc9e
|
7
|
+
data.tar.gz: 94d26534356b3b87d35e9a7f9737e2886224c71a06c8fd74bf938ad43b0896770e5b639110bce0ccbd0c1c012177f2767bc2d3df500525fd4e66d40e24ae090d
|
data/bin/zcollective
CHANGED
@@ -115,6 +115,15 @@ optparse = OptionParser.new do |opts|
|
|
115
115
|
options[:hostgroup_facts] = f
|
116
116
|
end
|
117
117
|
|
118
|
+
options[:insecure_https] = false
|
119
|
+
opts.on('--insecure-https', 'Don\'t validate the SSL cert') do
|
120
|
+
options[:insecure_https] = true
|
121
|
+
end
|
122
|
+
|
123
|
+
options[:auto_zabbix_inventory] = false
|
124
|
+
opts.on('--auto-zabbix-inventory', 'Enable Zabbix auto-inventory mode for the discovered hosts') do
|
125
|
+
options[:auto_zabbix_inventory] = true
|
126
|
+
end
|
118
127
|
end
|
119
128
|
|
120
129
|
begin
|
@@ -181,11 +190,12 @@ end
|
|
181
190
|
log.debug( "Connecting to Zabbix RPC service" )
|
182
191
|
|
183
192
|
zabbix_client = ZCollective::ZabbixClient.new(
|
184
|
-
:url
|
185
|
-
:user
|
186
|
-
:password
|
187
|
-
:debug
|
188
|
-
:http_timeout
|
193
|
+
:url => options[:zabbix_api_url],
|
194
|
+
:user => options[:zabbix_user],
|
195
|
+
:password => options[:zabbix_pass],
|
196
|
+
:debug => options[:debug],
|
197
|
+
:http_timeout => options[:http_timeout],
|
198
|
+
:insecure_https => options[:insecure_https],
|
189
199
|
)
|
190
200
|
|
191
201
|
log.debug( "Connected and authenticated" )
|
@@ -600,7 +610,7 @@ hosts.each do |host,data|
|
|
600
610
|
# we're just adding a Zabbix agent interface), and need
|
601
611
|
# to be in a group.
|
602
612
|
|
603
|
-
|
613
|
+
host_create_hash = {
|
604
614
|
'host' => host,
|
605
615
|
'interfaces' => [
|
606
616
|
{
|
@@ -612,9 +622,23 @@ hosts.each do |host,data|
|
|
612
622
|
'port' => '10050'
|
613
623
|
}
|
614
624
|
],
|
615
|
-
'groups'
|
625
|
+
'groups' => groups_by_id,
|
616
626
|
'templates' => templates_to_add
|
617
|
-
|
627
|
+
}
|
628
|
+
|
629
|
+
# If we've asked or auto-zabbix-inventory mode, set that. Otherwise
|
630
|
+
# leave it unset.
|
631
|
+
# We also set a note on the host saying when it was discovered.
|
632
|
+
# This is needed, otherwise Zabbix will ignore the request to
|
633
|
+
# enable the auto inventory mode.
|
634
|
+
if options[:auto_zabbix_inventory]
|
635
|
+
host_create_hash['inventory_mode'] = '1'
|
636
|
+
host_create_hash['inventory'] = {
|
637
|
+
'notes' => "Discovered by ZCollective at #{Time.now}",
|
638
|
+
}
|
639
|
+
end
|
640
|
+
|
641
|
+
resp = zabbix_client.request('host.create', host_create_hash)
|
618
642
|
|
619
643
|
# This call returns the created host id
|
620
644
|
|
@@ -100,6 +100,8 @@ module ZCollective
|
|
100
100
|
http = Net::HTTP::Proxy(proxy.host, proxy.port).new( uri.host, uri.port )
|
101
101
|
http_timeout = @options[:http_timeout]
|
102
102
|
http.read_timeout = http_timeout.to_i unless http_timeout.nil?
|
103
|
+
http.use_ssl = true if uri.to_s.start_with?("https")
|
104
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @options[:insecure_https]
|
103
105
|
|
104
106
|
request = Net::HTTP::Post.new( uri.request_uri )
|
105
107
|
request.add_field( 'Content-Type', 'application/json-rpc' )
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zcollective
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Topper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netaddr
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.5.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
26
|
version: 1.5.0
|
27
27
|
description: ZCollective is a tool used to configure Zabbix using data discovered
|
@@ -32,8 +32,8 @@ executables:
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
-
- lib/zcollective/zabbixclient.rb
|
36
35
|
- bin/zcollective
|
36
|
+
- lib/zcollective/zabbixclient.rb
|
37
37
|
homepage: http://github.com/scalefactory/zcollective
|
38
38
|
licenses: []
|
39
39
|
metadata: {}
|
@@ -43,17 +43,17 @@ require_paths:
|
|
43
43
|
- lib
|
44
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.5.2
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Zabbix/MCollective integration
|