Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

shoter alert subject, fixing require exceptions, better error handling

  • Loading branch information...
commit 3c50d6b7a68b43e270c9afcc524893e69cc56df7 1 parent 9685418
@itsderek23 itsderek23 authored
View
6 elasticsearch_cluster_status/elasticsearch_cluster_status.rb
@@ -15,7 +15,7 @@ class ElasticsearchClusterStatus < Scout::Plugin
notes: The port elasticsearch is running on
EOS
- needs 'net/http', 'json'
+ needs 'net/http', 'json', 'open-uri'
def build_report
if option(:elasticsearch_host).nil? || option(:elasticsearch_port).nil?
@@ -36,7 +36,7 @@ def build_report
# Send an alert every time cluster status changes
if memory(:cluster_status) && memory(:cluster_status) != response['status']
- alert("elasticsearch cluster health status changed from '#{memory(:cluster_status)}' to '#{response['status']}'")
+ alert("elasticsearch cluster status changed to '#{response['status']}'","elasticsearch cluster health status changed from '#{memory(:cluster_status)}' to '#{response['status']}'")
end
remember :cluster_status => response['status']
@@ -44,6 +44,8 @@ def build_report
error("Stats URL not found", "Please ensure the base url for elasticsearch cluster stats is correct. Current URL: \n\n#{base_url}")
rescue SocketError
error("Hostname is invalid", "Please ensure the elasticsearch Host is correct - the host could not be found. Current URL: \n\n#{base_url}")
+ rescue Errno::ECONNREFUSED
+ error("Unable to connect", "Please ensure the host and port are correct. Current URL: \n\n#{base_url}")
end
end
View
2  elasticsearch_index_status/elasticsearch_index_status.rb
@@ -17,7 +17,7 @@ class ElasticsearchIndexStatus < Scout::Plugin
notes: Name of the index you wish to monitor
EOS
- needs 'net/http', 'json'
+ needs 'net/http', 'json', 'open-uri'
def build_report
if option(:elasticsearch_host).nil? || option(:elasticsearch_port).nil? || option(:index_name).nil?
Please sign in to comment.
Something went wrong with that request. Please try again.