Dashing widget to display Sonar metrics, connecting to either a secured or unsecured Sonar repository.
I created this widget after originally attempting to use EHadoux's simple Sonar widget, which did not allow access to my company's secured Sonar instance. Additionally, I implemented the ability to set up the widget using an external configuration file.
Please note that this is technically a job versus a widget, in that it periodically requests data from Sonar and pushes that to the list widget as the view.
The list widget packaged with the Dashing framework.
##Usage
Copy sonar.rb
and sonar.cfg
into the jobs
directory.
Add the following snippet to the dashboard layout file:
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="sonar" data-view="List" data-title="sonar stats" data-unordered="true" data-moreinfo="values as %">
</div>
</li>
To display more metrics, increase the data-sizey attribute.
Change the values for the configuration in sonar.cfg
. All values are required except for username
and password
. If no username is provided, it is assumed the Sonar instance is unsecured. Order of display in the widget is dictated by the order of configured metrics.
If sonar.cfg
is not found, the dashboard will fail to start with a "file not found" message.
Job implementation requires restarting Dashing if you change the configuration file.
Thanks for this, it's quite useful. One note though: the Sonar API returns the elements in arbitrary order, so it would be better to not use index-access, but rather look for the key. Also having the display names in the code and not in the config seems strange, ideally I would have a list of metrics and a corresponding list of names for those metric, both in the config.
Unfortunately my Ruby is not good enough (yet) to propose a patch here...