Jump to content
MartynKeigher

Dashing on Ubuntu: Install Guide

Recommended Posts

Hey guys and girls!!

 

AT VERY (VERY) LONG LAST... Here are the step by step command lines you need in order to get Dashing setup on a Ubuntu box. I apologize for how long this took to get posted, I just wanted to ensure that I had time dedicated to this and I needed the process validated before posting. I could really go into detail about what each step of the process does, but that would make for a ‘even longer that it already is’ guide, so to keep it ‘simple’ and to the point... I will only 'explain' the potential non-obvious command lines.

 

Before I begin, I want to thank KLanders, JIshak, KSpooner and BClimer for all their assistance through-out this process! Without them taking time out to help me with this... This post would not have been posted today! (So yes... thanks for kicking me up the ass to get this done!! ;) )

 

________________

 

Pre-Requisites

 

This guide requires a PLAIN BUILD of Ubuntu 14.04 LTS 64 bit Server. The only software dependency you need on it is openssh so that you can 'Putty in' to it! It might also be a good idea, before the dashing installation to update/upgrade all current components of your Ubuntu VM also

 

sudo apt-get update && sudo apt-get -y upgrade

 

sudo apt-get -y install openssh-server

________________

 

INSTALLATION

 

**Considerations:

 

- Due to the way in which the dashboard works (mainly 'send event' based), it will NOT WORK in Internet Explorer. (So, go get a REAL browser like Chrome or Firefox! ;) )

 

- All development takes place on Ubuntu 14.04 LTS, and there may be issues with other platforms. No assistance will be given for installations not using Ubuntu 14.04 LTS.

 

- I am going to install dashing with an instance name of rmm_hud. Please feel free to name your name whatever you want, but just be sure to change all instances of rmm_hud to your own preference

 

- All command lines are in green!

 

- The guide assumes that you already have 'some' experience in a linux environment!

 

 

First off... let's install Ruby and obtain the necessary gems, and a couple of extra bits we will need:

 

sudo apt-get -y install ruby1.9.1 ruby1.9.1-dev \

rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \

build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev

 

sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \

--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \

/usr/share/man/man1/ruby1.9.1.1.gz \

--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \

--slave /usr/bin/irb irb /usr/bin/irb1.9.1 \

--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1

 

sudo gem install roo

 

NOTE: (I can't stress this enough!!) This step has been known to take up-to 10 minutes as code is compiled (nokogiri), so be patient, and do not interrupt it! It may act un-repsonsive, but you WILL eventually get put back to the shell prompt. - Thanks.

 

sudo gem install mysql2 bundle dashing htmlentities rdf-rdfxml xml-simple simple-rss httparty json google-api-client puma passenger

 

sudo apt-get -y install unzip nodejs make libmysqlclient-dev

 

Next up, we will change directories and Install Dashing:

 

cd /opt

 

 

sudo mv master dashing.zip

 

sudo unzip dashing.zip

 

sudo mv Shopify-dashing-***** dashing

 

NOTE: **** denote random characters. Be sure to replace the *****'s in the guide with what is on your system! To find out what 'the characters are' then do a ls -l command while in the /opt directory.

 

cd dashing

 

sudo dashing new rmm_hud

 

cd rmm_hud

 

sudo dashing install 6246149

 

NOTE: This installs the 'Hotness Widget'.

 

sudo dashing install 4990174

 

NOTE: This installs the 'Weather Widget'. (Optional Step!)

 

sudo dashing install 5422482

 

NOTE: This installs the 'RSS/News Widget'. (Optional Step!)

 

sudo dashing install 9588819

 

NOTE: This installs the 'Server Status Widget'. (Optional Step!)

 

sudo nano Gemfile

 

Your Gem file needs to look like this:

 

  • source 'https://rubygems.org'
     
    gem 'dashing'
    gem 'mysql2'
    gem 'twitter'
    gem 'thin'
    gem 'htmlentities'
    gem 'rdf-rdfxml'
    gem 'simple-rss'
    gem 'httparty'
    gem 'json'
    gem 'passenger'
    gem 'roo'
    gem 'nokogiri'
    gem 'google-api-client'
    gem 'xml-simple'
    gem 'puma'

 

sudo bundle install

 

NOTE: This actually compiles the dashing install and creates the dashboard.

 

sudo dashing start

 

 

OK... So at this point, you should be able to navigate to http://ip.of.ubuntu.vm:3030'>http://ip.of.ubuntu.vm:3030 and see a dashboard! If you don't then carefully go over steps one more time, making sure you have not missed anything out. If you DO see your dashboard, then let's move on and get some data in there!!!

 

Next up, we are going to create an 'odbc connection' to our LabTech server, to port 3306. This is done by creating a my_db.rb file.

 

sudo nano jobs/my_db.rb

 

Your my_db.rb file needs to look like this:

 

require 'mysql2'

class MyDb
 def self.conn
   Mysql2::Client.new( :host => "IP.of.LT.Server", :username => "username", :password => "MyP@$$w0rd", :port => "3306", :database => "labtech" )
end
end

 

If you want to create a READ-ONLY account in your LT Database, to use (almost like a service account) for this, then that can be done by running the following query in SqlYog:

 

GRANT SELECT on labtech.* to 'dashing'@'*' IDENTIFIED by 'MyP@$$w0rd';

 

Now, we will create another '.rb' file for a SQL query. Each query needs to be in it's own '.rb' file, and overtime you will have lots of these, so be sure to name appropriately and try and avoid spaces in your filenames!! For the purposes of the How-To Guide, we will create an agentcount.rb file. This will return the number of agents installed in your LT system. Please also consider when writing your queries (in your '.rb' files, make sure that they bring back a valid result in SQLyog first!!

 

sudo nano jobs/agentcount.rb

 

Your agentcount.rb file needs to look like this:

 

require_relative 'my_db.rb'

SCHEDULER.every '30s', :first_in => 0 do |job|

       db = MyDb.conn

       sql = "SELECT computerid FROM computers"

       results = db.query(sql)

       current_agentcount = results.count


       send_event('agentcount', { value: current_agentcount } )
db.close
end

 

The last thing we need to do in order for this result to show on your dashboard is program a widget to present the data. We will first need to create our own dashboard, which we call 'home' (by copying one that is already included) and then replacing an existing widget (or 'tile') with one that will show your query result.

 

sudo cp dashboards/sampletv.erb dashboards/home.erb

 

sudo nano dashboards/home.erb

 

Find the following code:

 




 

and replace it with this:

 

   



NOTE 1: Ensure that 'data-warm' value represents YOUR Total LT License count.

NOTE 2: Feel free to give your dash 'page' a new name - on Line 11.

NOTE 3: Every time you make a change the to home.erb file, you will need to restart dashing for change to take effect.

 

Now that we have data going into the dashboard, the last thing we need to do is make sure that it will run as a Service, so the process won’t end when you exit your putty session. To do this, we need to create a service file, and a folder so that it store its logs. One of Dashing's dependencies is 'thin'. This is a really lightweight web-service that the dashboard will run on. We can get this setup in just a few steps.

 

 

sudo mkdir /opt/dashing/rmm_hud/logs

 

sudo touch /opt/dashing/rmm_hud/logs/thin.log

 

sudo nano /etc/init/thin.conf

 

Your thin.conf file needs to look like this:

 

description "thin"
version "1.0"
author "Travis Reeder"

env LANG=en_US.UTF-8
env APP_HOME=/opt/dashing/rmm_hud

respawn
start on runlevel [23]

script
   cd $APP_HOME
   sudo thin start -e production -p 3030 > $APP_HOME/logs/thin.log 2>&1
end script

Reminder: If you chose not to use rmm_hud as your dashing instance name, be sure to change it on line 6!

 

Now that you have created the service that the dash will run on.. Now we can start it!

 

sudo start thin

 

NOTE: To RESTART the 'thin' service (i.e.: your dashboard) at ANY time, then the command for that is: sudo stop thin && sudo start thin

 

If you followed these steps exactly, you should now be able to navigate your browser to http://ip.of.ubuntu.vm:3030 and see you dashboard! You should also now see a tile that states the number of 'Total Agents Deployed', like this...

 

rP3PWyy.jpg

 

DONE!!! :) :) :)

 

THAT concludes the How-To guide for Dashing on a Ubuntu VM!! This was a system that was initially devised by KLanders (aka scubes13) and myself close to A YEAR ago. We presented it Greg Buerk, and he loved it so much that he developed an LT plugin for it and people have been having great success with it!! I know that there are still a few people around that 'prefer' it on Ubuntu, as they may be well versed already in Linux/Ruby environments, so saw no need to jump to the plugin. Both ways though work totally fine, its just this way is seen as a little more 'raw'. As you may, or may not be, aware... this guide has been a LOOOONG time coming, so I just want to say A BIG Thanks for waiting for me on this one!! :)

 

I'll leave this guide with you and you can use the agentcount.rb as a template to learn from and build out (and hopefully share) YOUR OWN '.rb' files to the community! To do so, I would recommend wrapping the text-content of the .rb files into a code block here on LTG (as I did for the guide!) so that others can copy/paste and have fun with it, also don't forget to include the dashboard 'placeholder' too!!

 

As always, please feel free to leave comments and questions about ANYTHING I have gone through in this guide and I, and others, will do our best to help you out!! Again, I want to personally thank kspooner, BClimer and Josh.Ishak for going through the validation with/for me this week, scubes13 for spending the time to initially develop this with me, and to all of you who participate in this amazing community!!

 

Regards,

Edited by Guest

Share this post


Link to post
Share on other sites

PROTIP!!!:

 

If you are having issues with running dashing, or editing your files, or making changes. The webserver "thin" does not easily display what small change you may be missing. Simply run these commands from the rmm_hud folder to see what dashing has to say:

sudo stop thin

dashing start

 

This should display error codes for you to parse or seek assistance with.

 

 

Guide to adding in MSSQL support (for CW integration)

 

 

First things first. Make sure you have dashing installed and running, as well as labtech data being displayed. This insures that this small addition to MK's fantastic guide will translate well.

 

 

From your rmm_hud directory, run this command

 

 

apt-get install freetds-dev

 

This installs the requirements for the gem that communicates with MSSQL.

Next, we must install and bundle the gem that is needed for ruby/dashing to work with MSSQL.

 

gem install tiny_tds

 

Now we must edit the Gemfile to include the new gem as requirement (similar to mysql2)

 

nano Gemfile

 

Add

gem 'tiny_tds'

at the bottom of the file, below mysql2.

 

Now we must rebundle the gems! All you have to do is type:

 

bundle install

 

After that you should now be able to start a new .rb file! So lets go ahead and create one shall we?

 

 
nano jobs/mssql.rb

 

That puts us inside the jobs folder (your still in /rmm_hud right?!?) . All you have to do it copy/paste the information inside of this RB file to connect it into CW (or other MSSQL platform)

 

NOTE: The code exampled below pulls ticket counts from one of my PERSONAL service boards. Please verify what SQL code you are using and make sure it returns valid results before entering.

require 'tiny_tds'



SCHEDULER.every '300s', :first_in => 0 do |job|


client = TinyTds::Client.new(:username => 'dashing', :password => 'PASSWORDg', :host => '192.168.1.1', :database => 'cw', :port => '1433')
rs = client.execute("SELECT count(*) as value FROM [cw].[dbo].[sR_Service]WHERE SR_Board_RecID = \'36\' AND Date_Closed IS null AND SR_Status_RecID != \'475\' ")
rs.each do |row| 
 send_event('bravo', {value: row['value'] })
end
client.close

end

 

Now you have a job to process to CW information, and the required gem's.. Now you just need a widget for the data to process into and display! In MK's setup, there are two widgets with the "data-id='synergy'".

 

MK changed one to be the LT Agents display. Lets edit the other one to display the CW information.

 

nano dashboards/home.erb

 

Find the second meter widget that should be beside MK's, and change that line to be this:

 

>
</pre>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">

</li>

 

Now run the start/stop command ( sudo stop thin && sudo start thin ) and you should see your new widget!

Edited by Guest

Share this post


Link to post
Share on other sites

So a few things for those looking to do some CW stuff.

 

You'll want to query against the SR_Service table for Ticket info

A couple of columns for you:

SR_Status_RecID = Status a ticket is in (Numeric Value) --- Useful for NEW, ON HOLD, WAITING CLIENT RESPONSE tickets. Think how you can use this in Service. Think how you can use this in SALES.

SR_Urgency_RecID = PRIORITY column of a Ticket. Useful as hell for those P1/Crit Tickets you need to sort out/limit your counts to.

 

Your values will be different than everyone elses, so no point in sending out the values here.

 

I'll throw more up as we build out more dashboards.

 

/ir

Share this post


Link to post
Share on other sites
So a few things for those looking to do some CW stuff.

 

You'll want to query against the SR_Service table for Ticket info

A couple of columns for you:

SR_Status_RecID = Status a ticket is in (Numeric Value) --- Useful for NEW, ON HOLD, WAITING CLIENT RESPONSE tickets. Think how you can use this in Service. Think how you can use this in SALES.

SR_Urgency_RecID = PRIORITY column of a Ticket. Useful as hell for those P1/Crit Tickets you need to sort out/limit your counts to.

 

Your values will be different than everyone elses, so no point in sending out the values here.

 

I'll throw more up as we build out more dashboards.

 

/ir

 

I'll just leave this here:

 

https://university.connectwise.com/university/content/documents/datadictionary-2013.2Updated.pdf

Share this post


Link to post
Share on other sites

If anyone uses Cacti to monitor any device, this can be added into Dashing as well.

Using the example directories do the following

 

cd /opt/dashing/rmm_hud/

 

sudo nano jobs/cactidb.rb

 

Paste the following into the cactidb.rb

 

require 'mysql2'

class MyDbCacti
 def self.conn
   Mysql2::Client.new(:host => "cacti.ip.or.host", :username => "mysqluser", :password => "passw0rd", :port => "3306", :database => "cacti" )
end
end

 

Save this

 

sudo nano jobs/cacti.rb

 

Paste the following into this file

 

require_relative 'cactidb.rb'

SCHEDULER.every '30s', :first_in => 0 do |job|

       db = MyDbCacti.conn

       sql = "select * from host where status = 1"

       results = db.query(sql)

       current_cactidown = results.count


       send_event('cactidown', { value: current_cactidown } )
db.close
end

 

Then update the home.erb

 

sudo nano dashboards/home.erb

 

Then add in

 



 

 

stop start thin, refresh the page, and it'll display devices showing as down on Cacti

Share this post


Link to post
Share on other sites

Hmm, I'm having issues getting data from the CW database. I have changed the connection details and attempted to form a query, but I just get this line error when trying to start dashing. Any ideas?

 

root@ubuntu:/opt/dashing/rmm_hud# dashing start

/var/lib/gems/1.9.1/gems/backports-3.6.3/lib/backports/std_lib.rb:9:in `require': cannot load such file -- tiny_tds (LoadError)

Share this post


Link to post
Share on other sites
It doesn't appear you have tiny_tds installed. Try: apt-get install tiny_tds

 

tiny_tds is a rubygem. Do the follwing:

 

gem install tiny_tds

 

Add it your Gemfile.

 

> gem 'tiny_tds'

 

bundle install

Share this post


Link to post
Share on other sites

Hi,

 

I have followed the guide exactly and for some reason the agents deployed widget is showing as blank, any pointers? IP of labtech server is correct and so are admin credentials.

 

Thanks.

2014-11-06_11-21-25.png.0ea143a243117d74b5a6705124f334d7.png

Share this post


Link to post
Share on other sites

Run the SQL code you have into SQLYOG or similar program. If it pulls data then its the HTML/Rails code, if not its the SQL thats wrong.

Share this post


Link to post
Share on other sites

Martyn thanks for the excellent documentation and the help.

 

Do you have any documentation on how to add additional dashes? I have 4 monitors I need to fill up.

Share this post


Link to post
Share on other sites
Martyn thanks for the excellent documentation and the help.

 

Do you have any documentation on how to add additional dashes? I have 4 monitors I need to fill up.

 

 

To add additional boards, just keep copying sampletv.erb out for them. So,

 

  • dash1.erb
    dash2.erb
    dash3.erb

 

Then navigate to http://10.10.10.10:3030/'>http://10.10.10.10:3030/'>http://10.10.10.10:3030/dash1 or http://10.10.10.10:3030/dash2 or http://10.10.10.10:3030/dash3 to see them.

 

The only reason why "home" loads by default is because when dashing starts, it looks through the "dashboards" folder alphabetically. You can manually change the default dashboard though in the ..\rmm_hud\config.ru file, like this:

 

Line 5: set :default_dashboard, 'dash2'

Share this post


Link to post
Share on other sites

This is for anyone using the weather widget.

 

After setting everything up using Martyn's guide I noticed the weather widget wasnt showing the weather icon in the background. Not a huge deal but it was bugging me.

 

The documentation on the weather widget seems to be a bit incomplete, so here is how to get those icons showing:

 

* Download the climacons font http://adamwhitcroft.com/climacons/font/

* Extract the contents

* Take the .EOT, .SVG, .TTF and .WOF files and place them in your /assets/fonts folder

* Take the .CSS file and place it in your /assets/stylesheets folder

 

You will now have whatever the icon for the current weather is show up in the background of the widget.

Share this post


Link to post
Share on other sites

Hey All;

 

So if you are like me and starting to run out of room on your dashing, and you zoom out, you see all that blank area on each side. Will this is how you can expand your dashing out.

 

Open your /opt/dashing/rmm_hud/dashboards/home.erb

 

Go to Line 5 and change this line

 

Dashing.numColumns = 5

 

Change 5 to how ever wide you would like it. Hope that helps!

Share this post


Link to post
Share on other sites

So.. to setup auto placement of your tiles (for those who don't know)

 

In your /opt/dashing/rmm_hud/dashboards/home.erb file you will see:

 

li data-row="1" data-col="1"

 

This is your title placement. Change these to what row and column you wish to have that tile to load on.

Share this post


Link to post
Share on other sites

Its not just the hotness widget, its all numbers. You can edit the file /opt/dashing/Shopify(*RAND_NUMS)/javascripts/Dashing.Coffee.

 

At the beginning, the function is called "Batman.Filters.shortenedNumber"

 

Line should look like this:

Batman.Filters.shortenedNumber = (num) ->
 return num if isNaN(num)
 if num >= 1000000000
   (num / 1000000000).toFixed(1) + 'B'
 else if num >= 1000000
   (num / 1).toFixed(1) + ''
 else if num >= 1000
   (num / 1).toFixed(1) + ''
 else
   num

 

EDIT:

I am also not sure if you need to recreate a new "rmm_hud" or not for this to function. I edited mine before I built my DB.

Share this post


Link to post
Share on other sites

Needed to change the following in both number and hotness

 

widgets/number/number.html

In

 

widgets/hotness/hotness.html

In

 

then stop and start thin, refresh your dash and no more #.#

 

It is case sensitive

Share this post


Link to post
Share on other sites
Hi,

 

I have followed the guide exactly and for some reason the agents deployed widget is showing as blank, any pointers? IP of labtech server is correct and so are admin credentials.

 

Thanks.

 

Were you ever able to solve this issue? I'm running into the same problem.

Share this post


Link to post
Share on other sites
Hi,

 

I have followed the guide exactly and for some reason the agents deployed widget is showing as blank, any pointers? IP of labtech server is correct and so are admin credentials.

 

Thanks.

 

Were you ever able to solve this issue? I'm running into the same problem.

 

I took over this from a colleague who posted and figured it out thanks to another post on here. The issue is caused by another widget not loading correct. I removed everything but the time and the agent count and it works.

 

I will be adding in everything else one by one. I suspect it was something to do with twitter, as when Dashing is started. Nothing has data. Wait a minute. Stop dashing, and you will see everything updates with values except twitter.

Share this post


Link to post
Share on other sites

Martyn,

 

Amazing guide, ran through the whole thing zero issues. Thank you. I am just curious what other dashlets do people have setup? or is there another resource for more examples? I'm still trying to figure things out. Thanks again man.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×