Last active
August 29, 2015 14:21
-
-
Save p5k6/ed78e22065fad79cf15d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Timeout::timeout(30) do | |
| socket = TCPSocket.new @hive_metastore_server, @hive_metastore_port | |
| begin | |
| socket.write("hello") | |
| socket.close_write | |
| x = socket.read | |
| #not sure when this would happen.... | |
| if x.nil? | |
| @monitored_app_state = :unknown | |
| ### raise something eventually | |
| else | |
| conditional_log(:running, "hive metastore appears to be running ok") | |
| @monitored_app_state = :running | |
| end | |
| rescue Errno::ECONNRESET,Errno::ECONNREFUSED => e | |
| conditional_log(:dead, "exception #{e} found. This typically occurs when hive-metastore is not running. ") | |
| conditional_log(:dead, 'try running `sudo service hive-metastore status`') | |
| @monitored_app_state = :dead | |
| ensure | |
| socket.close | |
| end | |
| rescue Timeout::Error | |
| ## restart hive-metastore!! | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment