Reporting Dashboard

jsherwood
Contributor

Does anyone out there use Dashing/Smashing for creating dashboards?

I'm in the process of pulling one together to report on various elements of our Jamf setup using the API to pull data and have started with the low hanging fruit (i.e. pulling data from Smart Groups) which has made me the office hero.

I want to take it a little further and bring in server status indicators to show if services (such as the JSS) are up but am scratching my head on the best way to achieve this - I know I can curl the JSS health check page but the challenge comes in how to turn that into a widget.

Anyone tried this already and if so, is it straightforward or a complete pain in the ass ?

3 REPLIES 3

Iibias
New Contributor

I recently started using smashing. Any progress on your question?

captain-paul
New Contributor II

0f93d982d5374af0bf07c53cab891455

I'm happy to share this one
Thanks to a dev colleague of mine, we have this tile on our dashboard...I'm not a developer by the way :)

  • add gem 'httparty' to your Gemfile
  • open terminal, go to your project folder, run bundle
  • create a new job in the jobs folder
  • modify the url in the code according to your needs
# Note: change this to obtain your chart data from some external source require 'httparty' require 'json'

TODO: specify new interval

SCHEDULER.every '10s', :first_in => 0 do |job| url = "https://your-jamf-instance.com/healthCheck.html"

retrieve GET request

response = HTTParty.get(url) error_msg = ""

parse response

parsed = JSON.parse(response.body) if parsed.length == 0 error_msg = "The Jamf Pro web app is running without error." else case parsed[0]["description"] when "DBConnectionError" error_msg = "An error occurred while testing the database connection." when "SetupAssistant" error_msg = "The Jamf Pro Setup Assistant was detected." when "DBConnectionConfigError" error_msg = "A configuration error occurred while attempting to connect to the database." when "Initializing" error_msg = "The Jamf Pro web app is initializing." when "ChildNodeStartUpError" error_msg = "An instance of the Jamf Pro web app in a clustered environment failed to start." when "InitializationError" error_msg = "A fatal error occurred and prevented the Jamf Pro web app from starting." else error_msg = "Unknown Error occured!" end end send_event("health", { text: error_msg }) end
  • add the tile to your dashboard
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1"> <div data-id="health" data-view="Text" data-title="JAMF health status" data-text=""></div> <i class="fa fa-heart icon-background"></i> </li>

enjoy :)

Hi peeps,

this is how the code should look like....I finally found the "code insert" button 😂

 

# Note: change this to obtain your chart data from some external source

require 'httparty'
require 'json'

# TODO: specify new interval
SCHEDULER.every '10s', :first_in => 0 do |job|

url = "https://company.jamfcloud.com/healthCheck.html"


#retrieve GET request
response = HTTParty.get(url)
error_msg = ""

#parse response
parsed = JSON.parse(response.body)
        if parsed.length == 0
        error_msg = "The Jamf Pro web app is running without error."
            else case parsed[0]["description"]
            when "DBConnectionError"
              error_msg = "An error occurred while testing the database connection."
            when "SetupAssistant"
              error_msg = "The Jamf Pro Setup Assistant was detected."
            when "DBConnectionConfigError"
              error_msg = "A configuration error occurred while attempting to connect to the database."
            when "Initializing"
              error_msg = "The Jamf Pro web app is initializing."
            when "ChildNodeStartUpError"
              error_msg = "An instance of the Jamf Pro web app in a clustered environment failed to start."
            when "InitializationError"
              error_msg = "A fatal error occurred and prevented the Jamf Pro web app from starting."
            else error_msg = "Unknown Error occured!";
        end

end

send_event("health", { text: error_msg })

end