Skip to content

Instantly share code, notes, and snippets.

View andre's full-sized avatar

Andre Lewis andre

View GitHub Profile
@andre
andre / php_fpm_status.rb
Created May 30, 2013 16:47
added connections per second
class PHPFpmStatus < Scout::Plugin
needs 'open-uri', 'json'
OPTIONS=<<-EOS
url:
name: FPM Status Url
default: "http://localhost/status?json"
EOS
def build_report
# MySQL Statistics by Eric Lindvall <eric@5stops.com>
# MySQLTuner integration by Andre Lewis <@andre@scoutapp.com>
class MysqlQueryStatistics < Scout::Plugin
ENTRIES = %w(Com_insert Com_select Com_update Com_delete)
require 'shellwords'
OPTIONS=<<-EOS
user:
name: MySQL username
# A Scout plugin to perform simple count of files in a directory using regex.
#
# path - Provide the path to a directory you would like to check.
# file_regex - Provide the regex you want to use to look for file under the path.
# http://ruby-doc.org/core-2.0/Dir.html#method-c-glob
#
# Created by Gerric Chaplin <gerric@particleflux.co.uk>
class SimpleFileCount < Scout::Plugin
OPTIONS=<<-EOS
#!/bin/bash
# This is the current stable release to default to, with Omnibus patch level (e.g. 10.12.0-1)
# Note that the chef template downloads 'x.y.z' not 'x.y.z-r' which should be a duplicate of the latest -r
use_shell=0
prerelease="false"
# Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
#! /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.
# MySQL Statistics by Eric Lindvall <eric@5stops.com>
# MySQLTuner integration by Andre Lewis <@andre@scoutapp.com>
class MysqlQueryStatistics < Scout::Plugin
ENTRIES = %w(Com_insert Com_select Com_update Com_delete)
OPTIONS=<<-EOS
user:
name: MySQL username
notes: Specify the username to connect with
default: root
@andre
andre / mysql_replication_monitor_2.rb
Created October 17, 2012 20:32
A version of MySQLReplicationMonitor that relies on triggers instead of internally-generated alerts
require 'time'
require 'date'
class MysqlReplicationMonitor < Scout::Plugin
needs 'mysql'
OPTIONS=<<-EOS
host:
name: Host
notes: The slave host to monitor
default: 127.0.0.1
@andre
andre / killtrough.sh
Created October 9, 2012 18:44
remove troughs from rrd files (like killspike.sh, but for troughs
#!/bin/sh
#
# killtrough
# Remove (presumably erroneous) troughs from RRD files
#
# Matt Zimmerman <mdz@debian.org>, 05/2002
#
# Modified by Andre Lewis to kill troughs instead of peaks 10/2012
Process: Cloud [43188]
Path: /Users/USER/Downloads/Cloud.app/Contents/MacOS/Cloud
Identifier: com.linebreak.Cloud
Version: 2.0 beta (42)
Code Type: X86-64 (Native)
Parent Process: launchd [226]
Date/Time: 2012-10-05 10:33:45.238 -0700
OS Version: Mac OS X 10.7.4 (11E53)
Report Version: 9
class Counter < Scout::Plugin
def build_report
value =`ls -1 ~ | wc -l`.to_i
report(:count=>value)
end
end