Class: ISPMonitor::Checks::MifiCheck

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

Instance Attribute Summary collapse

Attributes inherited from BaseCheck

#config, #interval, #name

Instance Method Summary collapse

Methods inherited from BaseCheck

#run

Constructor Details

#initialize(config) ⇒ MifiCheck

Returns a new instance of MifiCheck.



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

def initialize(config)
  super(config)
  @url = config.fetch(:url, "http://192.168.1.1/apps_home/usageinfo")
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#checkObject



9
10
11
12
13
# File 'lib/isp_monitor/checks/mifi_check.rb', line 9

def check
  usage = http_get_json(url)
  usage[:totalShrUsage] = usage[:totalShrUsage].to_f # force cast to numeric
  log_event 'mifi-usage', usage
end