Class: ISPMonitor::Checks::MifiCheck
- Defined in:
- lib/isp_monitor/checks/mifi_check.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from BaseCheck
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(config) ⇒ MifiCheck
constructor
A new instance of MifiCheck.
Methods inherited from BaseCheck
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
#url ⇒ Object (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
#check ⇒ Object
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 |