Skip to content

Instantly share code, notes, and snippets.

View andre's full-sized avatar

Andre Lewis andre

View GitHub Profile
Apache Server Status for localhost
Server Version: Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with
Suhosin-Patch Phusion_Passenger/2.2.15
Server Built: Apr 13 2010 19:28:27
__________________________________________________________________
Current Time: Friday, 20-May-2011 11:46:05 PDT
Restart Time: Friday, 25-Mar-2011 17:38:18 PDT
mysql-slow.log.2:# Time: 120428 6:32:15
mysql-slow.log.2:# Time: 120428 6:37:14
mysql-slow.log.2:# Time: 120428 6:42:15
mysql-slow.log.2:# Time: 120428 6:47:15
mysql-slow.log.2:# Time: 120428 6:52:15
mysql-slow.log.2:# Time: 120428 6:57:15
mysql-slow.log.2:# Time: 120428 7:02:16
mysql-slow.log.2:# Time: 120428 7:06:20
mysql-slow.log.2:# Time: 120428 7:07:16
mysql-slow.log.2:# Time: 120428 7:12:17
{
"completed_in": 0.062,
"max_id": 204603591661596672,
"max_id_str": "204603591661596672",
"next_page": "?page=2&max_id=204603591661596672&q=blue%20angels&rpp=5&include_entities=1&result_type=mixed",
"page": 1,
"query": "blue+angels",
"refresh_url": "?since_id=204603591661596672&q=blue%20angels&result_type=mixed&include_entities=1",
"results": [{
"created_at": "Mon, 21 May 2012 16:04:32 +0000",
@andre
andre / postfix_queue_plugin.rb
Created June 20, 2012 18:26
Postfix plugins for Scout (untested)
class PostfixQeueuePlugin < Scout::Plugin
def build_report
queue_status = `/usr/sbin/postqueue -p`
lines=queue_status.split("\n")
reasons=Hash.new(0)
lines.each do |line|
if line =~ /\s(.*)/
if line.match(/:25: (.*)\)/)
reason=$1.downcase.gsub(" ","_")
class Counter < Scout::Plugin
def build_report
value =`ls -1 ~ | wc -l`.to_i
report(:count=>value)
end
end
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
@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 <[email protected]>, 05/2002
#
# Modified by Andre Lewis to kill troughs instead of peaks 10/2012
@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
# MySQL Statistics by Eric Lindvall <[email protected]>
# MySQLTuner integration by Andre Lewis <@[email protected]>
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
#! /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.