cronitor 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/README.md +30 -16
- data/lib/cronitor.rb +12 -0
- data/lib/cronitor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f852a88bb9a1d55729161521e841a533198f5b
|
4
|
+
data.tar.gz: f8202fa60a98954c8d45c66e00aecdb0e67e449e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4a60d0d6c8de4afd286d00e9869e0f5a26bd593c630521869e84dc5c04f833f1ed92c0231709a80675e80176e381755f7c821857205bcd5b36a062ec0321993
|
7
|
+
data.tar.gz: 9d667dcc744903d1324b11ec824c7d2d387a18effd5cc93ed7a8b4cf45c920a8741f4b6f8a3b4b32edf993d13fa2649b5cfcf934903654431150b1068a4cb68f
|
data/README.md
CHANGED
@@ -33,26 +33,40 @@ A Cronitor monitor (hereafter referred to only as a monitor for brevity) is crea
|
|
33
33
|
require 'cronitor'
|
34
34
|
|
35
35
|
monitor_options = {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
36
|
+
name: 'My Fancy Monitor',
|
37
|
+
notifications: {
|
38
|
+
emails: ['test@example.com'],
|
39
|
+
slack: [],
|
40
|
+
pagerduty: [],
|
41
|
+
phones: [],
|
42
|
+
webhooks: []
|
43
|
+
},
|
44
|
+
rules: [
|
45
|
+
{
|
46
|
+
rule_type: 'not_run_in',
|
47
|
+
duration: 5
|
48
|
+
rime_unit: 'seconds'
|
49
|
+
}
|
50
|
+
],
|
51
|
+
note: 'A human-friendly description of this monitor'
|
52
52
|
}
|
53
53
|
my_monitor = Cronitor.new token: 'api_token', opts: monitor_options
|
54
54
|
```
|
55
55
|
|
56
|
+
You may optionally specify a `:human_readable` value for your rule(s), otherwise one will be crafted for you:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
monitor_options = {
|
60
|
+
rules: [
|
61
|
+
{
|
62
|
+
rule_type: 'not_run_in',
|
63
|
+
duration: 5
|
64
|
+
time_unit: 'seconds',
|
65
|
+
human_readable: 'not_run_in 5 seconds'
|
66
|
+
}
|
67
|
+
],
|
68
|
+
```
|
69
|
+
|
56
70
|
### Pinging a Monitor
|
57
71
|
|
58
72
|
Once you’ve created a monitor, you can continue to use the existing instance of the object to ping the monitor that your task status: `run`, `complete`, or `fail`.
|
data/lib/cronitor.rb
CHANGED
@@ -51,6 +51,18 @@ class Cronitor
|
|
51
51
|
true
|
52
52
|
end
|
53
53
|
|
54
|
+
def run
|
55
|
+
ping 'run'
|
56
|
+
end
|
57
|
+
|
58
|
+
def complete
|
59
|
+
ping 'complete'
|
60
|
+
end
|
61
|
+
|
62
|
+
def fail(msg = nil)
|
63
|
+
ping 'fail', msg
|
64
|
+
end
|
65
|
+
|
54
66
|
def ping(type, msg = nil)
|
55
67
|
url = "#{PING_URL}/#{code}/#{type}"
|
56
68
|
url += "?msg=#{URI.escape msg}" if type == 'fail' && !msg.nil?
|
data/lib/cronitor/version.rb
CHANGED