sensu-check-helpers 0.0.2 → 0.0.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06bd3f4e004fd2e3b95b0eec8ed2cf447fc633ad
|
4
|
+
data.tar.gz: b3e1a3b51a43964df08c1002cf97e4d59c2302f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c092c2467b6b164c30648f48891eb8ea939a6ae36f6c4aa7a08c2a33f4b8e84627c242b1bd6b938859bdd96230d62859c56d16c2a923c63e029a60978c6ae2bd
|
7
|
+
data.tar.gz: 192fdf943dce23e7ec824bfc8fb2d7e584d6378660295fb17eac40f28b08a51b50350af2fdf9c20c1977d3b560014e82f1d682ef4a8f0268423727c249dfa96f
|
@@ -12,19 +12,19 @@ module SensuCheckHelpers
|
|
12
12
|
|
13
13
|
def send_ok(alert_name, alert_message)
|
14
14
|
handlers = config[:handlers].split(',').map(&:strip)
|
15
|
-
check_result = { :
|
15
|
+
check_result = { name: alert_name, status: OK, output: "OK: #{alert_message}", handlers: handlers }
|
16
16
|
sensu_client_socket check_result.to_json
|
17
17
|
end
|
18
18
|
|
19
19
|
def send_warning(alert_name, alert_message)
|
20
20
|
handlers = config[:handlers].split(',').map(&:strip)
|
21
|
-
check_result = { :
|
21
|
+
check_result = { name: alert_name, status: WARNING, output: "WARNING: #{alert_message}", handlers: handlers }
|
22
22
|
sensu_client_socket check_result.to_json
|
23
23
|
end
|
24
24
|
|
25
25
|
def send_critical(alert_name, alert_message)
|
26
26
|
handlers = config[:handlers].split(',').map(&:strip)
|
27
|
-
check_result = { :
|
27
|
+
check_result = { name: alert_name, status: CRITICAL, output: "CRITICAL: #{alert_message}", handlers: handlers }
|
28
28
|
sensu_client_socket check_result.to_json
|
29
29
|
end
|
30
30
|
|
@@ -3,7 +3,7 @@ module SensuCheckHelpers
|
|
3
3
|
module Request
|
4
4
|
|
5
5
|
def http_request(url, bypass_ssl: false)
|
6
|
-
response = bypass_ssl ? open(url, { :
|
6
|
+
response = bypass_ssl ? open(url, { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }) : open(url)
|
7
7
|
JSON.parse response.read
|
8
8
|
end
|
9
9
|
|
@@ -7,11 +7,11 @@ module SensuCheckHelpers
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def as_seconds(duration)
|
10
|
-
ChronicDuration.parse(duration.to_s, :
|
10
|
+
ChronicDuration.parse(duration.to_s, keep_zero: true)
|
11
11
|
end
|
12
12
|
|
13
13
|
def pretty_time(duration)
|
14
|
-
ChronicDuration.output(duration, :
|
14
|
+
ChronicDuration.output(duration, format: :long)
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|