Class: ISPMonitor::Checks::HealthcheckCheck
- Defined in:
- lib/isp_monitor/checks/healthcheck_check.rb
Constant Summary collapse
- DEFAULT_URL =
"https://hc-ping.com/5d4cb729-4c3a-405c-8e6c-c4d8c3d266c5"
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from BaseCheck
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(config) ⇒ HealthcheckCheck
constructor
A new instance of HealthcheckCheck.
Methods inherited from BaseCheck
Constructor Details
#initialize(config) ⇒ HealthcheckCheck
Returns a new instance of HealthcheckCheck.
7 8 9 10 11 |
# File 'lib/isp_monitor/checks/healthcheck_check.rb', line 7 def initialize(config) super(config) @url = config.fetch(:url, DEFAULT_URL) @uri = URI(@url) end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
5 6 7 |
# File 'lib/isp_monitor/checks/healthcheck_check.rb', line 5 def uri @uri end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/isp_monitor/checks/healthcheck_check.rb', line 4 def url @url end |
Instance Method Details
#check ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/isp_monitor/checks/healthcheck_check.rb', line 13 def check res = Net::HTTP.get_response(uri) log_event 'healthcheck', { response_code: res.code } end |