Permalink
Browse files

shoter alert subject, fixing require exceptions, better error handling

  • Loading branch information...
1 parent 9685418 commit 3c50d6b7a68b43e270c9afcc524893e69cc56df7 @itsderek23 itsderek23 committed Oct 20, 2011
@@ -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,14 +36,16 @@ 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']
rescue OpenURI::HTTPError
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
@@ -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?

0 comments on commit 3c50d6b

Please sign in to comment.