Posted on 10-10-2018 06:43 AM
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 ?
Posted on 02-10-2019 06:33 PM
I recently started using smashing. Any progress on your question?
Posted on 01-24-2020 05:03 AM
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 :)
# 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
<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 :)
Posted on 11-16-2021 01:14 AM
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