Class: ISPMonitor::Checks::BaseCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/isp_monitor/checks/base_check.rb

Direct Known Subclasses

DownloadCheck, HealthcheckCheck, MifiCheck, PingCheck

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ BaseCheck

Returns a new instance of BaseCheck.



4
5
6
7
8
# File 'lib/isp_monitor/checks/base_check.rb', line 4

def initialize(config)
  @config = config
  @name = config.fetch(:name)
  @interval = config.fetch(:interval, '1h')
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



2
3
4
# File 'lib/isp_monitor/checks/base_check.rb', line 2

def config
  @config
end

#intervalObject (readonly)

Returns the value of attribute interval.



2
3
4
# File 'lib/isp_monitor/checks/base_check.rb', line 2

def interval
  @interval
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/isp_monitor/checks/base_check.rb', line 2

def name
  @name
end

Instance Method Details

#checkObject

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/isp_monitor/checks/base_check.rb', line 10

def check
  raise NotImplementedError
end

#runObject



14
15
16
17
18
19
# File 'lib/isp_monitor/checks/base_check.rb', line 14

def run
  check
rescue StandardError => e
  puts e.inspect
  puts e.backtrace
end