Okay, so last year, I made a library to access the Telnet-based API on Dovado routers. I wanted this because I was planning to build a dashboard (using Dashing) that could show our network data usage, 4G coverage and stuff like that.

I never made that dashboard, mainly because I didn't really need it (plus, I burned out and pretty much dropped everything). The other day, I found that library again (never published it) when going through some old repositories so I decided to polish up the docs, complete some of the unfinished parts and publish it to RubyGems.

So here it is, the Ruby-Dovado library, very much suited to use for buiding dashboards among other things. The project page is here.

Using it in a dashboard

So I said this could be used in a dashboard, which is exactly how I'm using it right now. Here's a simple example.

First off, I have a widget that displays the current mobile coverage like so:

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
  <div data-id="signal_strength" data-view="Meter" data-title="Cell Coverage" data-min="0" data-max="100" data-suffix="%"></div>
  <i class="icon-signal icon-background"></i>
</li>

Second, I have a job that accesses my router and fetches that information:

require 'dovado'

@router = Dovado::Router.new(address: '192.168.0.1', user: 'apiuser', password: 'REDACTED')

SCHEDULER.every '1m', first_in: 0 do |job|
  begin
    router_info = @router.info
    if router_info.keys.member? :signal_strength
      signal_strength = router_info[:signal_strength]
      matching = signal_strength.match(/(\d+)\W?\%\W(.*)\WdBm\W\((.*)\)/)

      if matching
        send_event('signal_strength', value: matching[1].to_i)
      end
    end

  rescue => ex
    puts "Problem accessing the router: #{ex.inspect}"
  end
end

This renders a nice widget like this:

Cell Coverage Dashboard Widget

To check it out, go to the project page.