The Sidekiq Monitor plugin for Scout, a hosted server monitoring service, reports key metrics like enqueued, processed, and failed jobs. Triggers can be configured to alert when the metrics reach specified thresholds. A Scout account is required to use the plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lion | |
attr_accessor :age | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MySQL Health plugin | |
# | |
# Plugin is intended to monitor basic MySQL parametrs | |
# plugin was inspired by mysqltuner | |
# | |
# Currently plugin monitors | |
# * InnoDB data size / buffer pool | |
# * Highest usage of available connections | |
# * Active processes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stream data for 20 minutes | |
while(streamer_start_time+MAX_DURATION > Time.now) | |
data=[] | |
# run each scout plugin (cpu usage, apache stats, etc) | |
plugins.each do |plugin| | |
plugin.run | |
data << { | |
# plugin.reports example data | |
# [{"Idle %"=>95, "System %"=>1,"User %"=>4}] | |
:fields=>plugin.reports.inject{|memo,hash|memo.merge(hash)}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pusher = new Pusher(appKey,{encrypted: true}); | |
var channel = pusher.subscribe(streamingKey); | |
channel.bind('server_data', update); | |
// The function that's called when we retrieve new data from the realtime_data action | |
function update(server){ | |
// example data | |
// var server={"hostname": "nuevo.local","data": [{"name": "CPU Usage","fields": {"idle": 95, "system": 1,"user": 4}},{"fields":{"capacity":59.0,"avail":97.0,"size":233.0,"used":136.0},"name":"Disk Usage"}],"server_time": "02:38:11 PM"}; | |
// append data to a smoothie chart | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assets_path = File.expand_path("~/projects/rails/scout/public") | |
log_path = File.expand_path "~/assets.txt" | |
temp_requested_files_path = File.expand_path "~/processed_assets.txt" | |
ignore_pattern = /sparkline|datejs/ | |
known_used =[ | |
"javascripts/jquery-1.7.1.min.js", | |
"javascripts/jquery.extensions.js", | |
"javascripts/application.js", | |
"stylesheets/default.css", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + "/parent.rb") | |
class Child < Parent | |
def build_report | |
report(:parent_value => parent_method) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scout test py.rb | |
== This plugin doesn't have option metadata. | |
== You haven't provided any options for running this plugin. | |
== Output: | |
{:server_name=>nil, | |
:errors=>[], | |
:reports=> | |
[{:created_at=>"2012-09-18 17:00:05", | |
:fields=>{:random=>7.0}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# This example bash script file is located here: /home/your-username/scripts/scout_cron.sh for our example, but could be anywhere on your server. | |
# Make sure you remember to make this file an executable script by: chmod +x /home/your-username/scripts/scout_cron.sh. | |
# Loading the RVM Environment files. To find your unique rvm path use: rvm env --path -- ruby-version[@gemset-name]. | |
# For example: rvm env --path -- 1.9.3-p194@projectX | |
source /home/deploy/.rvm/environments/ruby-1.9.3-p374 | |
# Changing directories to our rails project. The example below is a Capistrano path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomInterval < Scout::Plugin | |
def build_report | |
interval = 15*60 # 15 minute interval | |
if @last_run.nil? or Time.now > @last_run + interval | |
# it's time to report | |
report(:metric => rand) | |
end | |
end | |
end |