upstreamstatus 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de6cf26c9c223894b35bf4441244cd36315c0787
4
- data.tar.gz: 39940e72690100f35cb7134fe943fbd81196b2b9
3
+ metadata.gz: 0574acb6b6f4cfcace06f749b340dcceec598036
4
+ data.tar.gz: 359a6ec366793c11839dae58b1ca9f0b352c1dbe
5
5
  SHA512:
6
- metadata.gz: d2124e0fdde48e47f86cc96c2e9389e991856d93c5f061b2fed340f440e54b29876ea31a03eccb3c68a147c9566c86db2ff4f07f5a6e7280624901822e775611
7
- data.tar.gz: e1babb466af524eb1a1a020702b30c7fba2462cfc9eba43925bf3252399649fa0202325ee8e776b13d7482a92e348c80c0a4f8e007e721b43e02015c2090493f
6
+ metadata.gz: bf81420263c53b452278242639fad404cda95174b2e81f66a55635f01da4c32b818333a93f79108795e0e9fda6d4d8e92c994e672235880c5109bcad186f792d
7
+ data.tar.gz: 0fc8c5690afdc50f2d0c1452033a32bee461dedb2da77134cb5c1f3b926419be339e855327dcdd0c045615cafa981b2a565482bb18e49667fdfc4fc00e2c3f8f
@@ -1,3 +1,3 @@
1
1
  class Upstreamstatus
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -50,6 +50,8 @@ class Upstreamstatus
50
50
  end
51
51
 
52
52
  def current_status
53
+ return fake_servers if opts[:simulate]
54
+
53
55
  r = Unirest.get status_check_url
54
56
 
55
57
  unless (200..299).include?(r.code)
@@ -63,6 +65,31 @@ class Upstreamstatus
63
65
 
64
66
  private
65
67
 
68
+ def fake_servers
69
+ [
70
+ {
71
+ 'index': 0,
72
+ 'upstream': 'testupstream',
73
+ 'name': '10.0.0.1:8080',
74
+ 'status': 'up',
75
+ 'rise': 10_459,
76
+ 'fall': 0,
77
+ 'type': 'http',
78
+ 'port': 0
79
+ },
80
+ {
81
+ 'index': 1,
82
+ 'upstream': 'testupstream',
83
+ 'name': '10.0.0.2:8080',
84
+ 'status': 'down',
85
+ 'rise': 10_029,
86
+ 'fall': 0,
87
+ 'type': 'http',
88
+ 'port': 0
89
+ }
90
+ ]
91
+ end
92
+
66
93
  def clear_active_alerts!
67
94
  return unless File.exist? '/var/run/active_upstream_alert'
68
95
  File.delete('/var/run/active_upstream_alert')
@@ -113,6 +140,10 @@ class Upstreamstatus
113
140
  'Notify alert service on failure',
114
141
  short: '-n',
115
142
  default: false
143
+ opt :simulate,
144
+ 'Simulate a failed server',
145
+ short: '-s',
146
+ default: false
116
147
  end
117
148
  end
118
149
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upstreamstatus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Herot