Module: SAAL
- Defined in:
- lib/saal.rb,
lib/chart.rb,
lib/envoy.rb,
lib/charts.rb,
lib/daemon.rb,
lib/sensor.rb,
lib/dbstore.rb,
lib/denkovi.rb,
lib/sensors.rb,
lib/dinrelay.rb,
lib/owsensor.rb,
lib/chart_data.rb,
lib/outliercache.rb
Defined Under Namespace
Modules: DINRelay, Denkovi, Envoy
Classes: Chart, ChartDataRange, Charts, DBStore, Daemon, ForkedRunner, OWSensor, OutlierCache, Sensor, SensorUnderlying, Sensors, UnimplementedMethod, UnknownSensorType
Constant Summary
collapse
- CONFDIR =
"/etc/saal/"
- SENSORSCONF =
CONFDIR+"sensors.yml"
- DBCONF =
CONFDIR+"database.yml"
- CHARTSCONF =
CONFDIR+"charts.yml"
- VERSION =
'0.3.6'
Class Method Summary
collapse
Class Method Details
.do_http_get(host, port, path, user, pass, timeout) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/http.rb', line 5
def SAAL::do_http_get(host, port, path, user, pass, timeout)
begin
http = Net::HTTP.new(host,port)
http.open_timeout = timeout
http.read_timeout = timeout
req = Net::HTTP::Get.new(path)
req.basic_auth(user, pass) if user && pass
response = http.request(req)
if response.code != "200"
return nil
end
return response
rescue Exception
return nil
end
end
|
.do_https_get_token(host, path, token, timeout) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/http.rb', line 25
def SAAL::do_https_get_token(host, path, token, timeout)
begin
http = Net::HTTP.new(host,443)
http.open_timeout = timeout
http.read_timeout = timeout
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
req = Net::HTTP::Get.new(path)
req['Accept'] = "application/json"
req['Authorization'] = "Bearer #{token}"
response = http.request(req)
if response.code != "200"
$stderr.puts "ERROR: Code #{response.code}"
$stderr.puts response.body
return nil
end
return response
rescue Exception
return nil
end
end
|