splunk-client 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +5 -1
- data/VERSION +1 -1
- data/lib/splunk_client/splunk_client.rb +10 -4
- metadata +2 -2
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -96,6 +96,10 @@ Incorrect credentials will raise a Nokogiri error referencing `Undefined namespa
|
|
96
96
|
|
97
97
|
## Revision History
|
98
98
|
|
99
|
+
#### 0.9
|
100
|
+
|
101
|
+
* Added support for HTTP proxy servers.
|
102
|
+
|
99
103
|
#### 0.8
|
100
104
|
|
101
105
|
* Added preliminary GET support for alarms within the Splunk REST API
|
@@ -135,4 +139,4 @@ If you contribute to this software, and I hope you do, please leave the VERSION
|
|
135
139
|
|
136
140
|
# License
|
137
141
|
|
138
|
-
This software is released under the MIT License (ref: LICENSE)
|
142
|
+
This software is released under the MIT License (ref: LICENSE)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
@@ -5,17 +5,19 @@ require 'net/https'
|
|
5
5
|
require 'cgi'
|
6
6
|
require 'rubygems'
|
7
7
|
require 'nokogiri'
|
8
|
+
require 'uri'
|
8
9
|
require File.expand_path File.join(File.dirname(__FILE__), 'splunk_job')
|
9
10
|
require File.expand_path File.join(File.dirname(__FILE__), 'splunk_alert')
|
10
11
|
require File.expand_path File.join(File.dirname(__FILE__), 'splunk_alert_feed')
|
11
12
|
|
12
13
|
class SplunkClient
|
13
14
|
|
14
|
-
def initialize(username, password, host, port=8089)
|
15
|
+
def initialize(username, password, host, port=8089, proxy_url = '')
|
15
16
|
@USER=username; @PASS=password; @HOST=host; @PORT=port
|
16
|
-
|
17
|
+
@PROXY_URI = URI(proxy_url) if proxy_url && !proxy_url.empty?
|
18
|
+
|
17
19
|
sessionKey = get_session_key
|
18
|
-
|
20
|
+
|
19
21
|
if (sessionKey == "")
|
20
22
|
raise SplunkSessionError, 'Session key is invalid. Please check your username, password and host'
|
21
23
|
else
|
@@ -70,7 +72,11 @@ class SplunkClient
|
|
70
72
|
private ###############################################################################
|
71
73
|
|
72
74
|
def splunk_http_request
|
73
|
-
|
75
|
+
if @PROXY_URI
|
76
|
+
http = Net::HTTP.new(@HOST, @PORT, @PROXY_URI.host, @PROXY_URI.port)
|
77
|
+
else
|
78
|
+
http = Net::HTTP.new(@HOST, @PORT)
|
79
|
+
end
|
74
80
|
http.use_ssl = true
|
75
81
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
76
82
|
return http
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splunk-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|