This code is no longer needed. Heroku has provided syslog drains for all users for free.
For better Heroku logging with Papertrail, check this out:
http://help.papertrailapp.com/kb/hosting-services/heroku#standalone
#!/usr/bin/env ruby | |
require 'socket' | |
LISTEN_PORT = 8514 | |
DESTINATION_HOST = "xxxx.papertrailapp.com" | |
DESTINATION_PORT = xxxx | |
class SyslogRelay | |
PARSER = /^(<\d+>\S+\s+\S+\s+\S+) \("([^,]+),([^,]+),([^"]+)"\) ([^:]+): (.*)$/ |
This code is no longer needed. Heroku has provided syslog drains for all users for free.
For better Heroku logging with Papertrail, check this out:
http://help.papertrailapp.com/kb/hosting-services/heroku#standalone
#!/usr/bin/env ruby | |
# | |
# linux-meminfo | |
# | |
# by Eric Lindvall <eric@5stops.com> | |
# | |
# Gather more useful memory statistics for SNMP | |
# | |
# To see the example output, run: | |
# linux-meminfo.rb -g .1.3.6.1.4.1.2021.4.6.0 |
/* | |
* Bookmarklet for viewing source in iPad Safari | |
* Originally from http://www.ravelrumba.com/blog/ipad-view-source-bookmarklet/ | |
*/ | |
javascript:(function(){ | |
var w = window.open('about:blank'), | |
s = w.document; | |
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=720, maximum-scale=1.0, minimum-scale=1.0, initial-scale=1.0" /></head><body></body></html>'); |
obs = obslua | |
os = require("os") | |
io = require("io") | |
relative_path_from_home = "Dropbox/Twitch Assets" | |
settings_path = "" | |
function refresh_button_clicked(props, p) | |
update() | |
end |
# load plugin | |
load 'boundary' | |
# Notify boundary with your orgid, apikey | |
boundary.register 'cdd7261592bca18539eae9bb5f1bcfdd', 'f9e6282c4727c5733585a4be86e0f990' |
I've been playing around with trying to make it as simple as possible to start logging a few metrics with as little effort in setup as possible.
As I was working on Papertrail I came up with a couple interesting ideas, some of which were inspired by OpenTSDB.
In this example we are pretending we're processing emails as background jobs and would like to track how many we've sent over time.
# | |
# Created by Eric Lindvall <eric@sevenscale.com> | |
# | |
# WHAT: Provides a simple overview of memory allocation occuring during a | |
# require. | |
# | |
# For a longer explanation, see my post at: | |
# | |
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby | |
# |
# | |
# Eric Lindvall <eric@5stops.com> | |
# | |
# Update the process name for the process you're running in. | |
# | |
# This will allow top, lsof, and killall to see the process as the | |
# name you specify. | |
# | |
# Just use: | |
# |
require 'faraday' | |
require 'faraday_middleware' | |
require 'json' | |
class DashboardApi | |
LIBRATO_API = 'https://metrics-api.librato.com' | |
LIBRATO_API_VERSION = 'v1' | |
ENDPOINT = [LIBRATO_API, LIBRATO_API_VERSION].join('/') | |
attr_accessor :username |