Skip to content

Instantly share code, notes, and snippets.

View johann8384's full-sized avatar

Jonathan Creasy johann8384

View GitHub Profile
#! /usr/bin/env bash
BRANCH=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
TARGET=Contegix
ISSUE=0
USER=johann8384
while getopts “hi:p:r:l:cf” OPTION
do
class role::hadoop::node {
include ::eluna::misc
include ::java::jdk
include ::java::mysql
::nagios::client::add_to_hostgroup { 'opentsdb_client': }
::ssh::allow_group { ['ops', 'dwh-admins']: }
::sudo::add_access { "dwh-admins sudo access":
user => '%dwh-admins',
input {
tcp {
type => "syslog"
host => "127.0.0.1"
port => 3514
}
tcp {
type => "eventlog"
host => "10.1.1.2"
port => 3515
tarting Nmap 6.40 ( http://nmap.org ) at 2013-11-15 09:36 GMT
Nmap scan report for monitorama.eu (141.101.116.49)
Host is up (0.012s latency).
Other addresses for monitorama.eu (not scanned): 141.101.117.49
PORT STATE SERVICE
20/tcp filtered ftp-data
21/tcp filtered ftp
22/tcp filtered ssh
23/tcp filtered telnet
25/tcp filtered smtp
@johann8384
johann8384 / metrics.scala
Created October 24, 2012 19:16
Metric Handler
type MetricHandler = (MetricName, Map[String, Any]) => String
val metricHandlers = Map("counter" -> handleCounter _, "timer" -> handleTimer _, "meter" -> handleMeter _)
/*
* This is the core function in this class
* accept a parsed metric object and delegate it to an appropriate handler
*/
def handleMetric(metricMap : Map[String, Any]) : String = {
@johann8384
johann8384 / render_graphs.js
Created November 8, 2012 00:10
Render TSDB Graphs for Cacti Style Display
var page = require('webpage').create(),
address, output, size;
var tsdb_host = 'opentsdb.sv2.box.net';
var tsdb_port = 4242;
var start = '1h-ago';
var metric = 'sum:' + phantom.args[0];
var width = 1280;
var height = 720;
@johann8384
johann8384 / histogram.php
Created December 11, 2012 08:52
PHP Stats Library
/**
*
* Extend Stats class to include Histogram support
* borrows heavily from Jesus M Castagnetto's code published here: http://px.sklar.com/code.html?id=119
* @author jcreasy
*/
/*
* // Original Header
* This is a histogram class that accepts and unidimensional array of data
* Returns 2 arrays by using the getStats() and getBins() methods.
@johann8384
johann8384 / check_erb.sh
Last active November 12, 2015 02:59
Git Hooks and associated scripts for checking puppet commits
#!/bin/bash
#Script to test puppet files have valid syntax.
#Intended for use with hudson/jenkins.
set -e
set -u
fail=0
#TODO: Run these in parallel - we have 4 cores.
#TODO: Control the environment (through the config dir?).
<?php
function get_tsdb_data($metric, $range = 'hour', $time = '')
{
$date_format = 'Y/m/d-H:i:s';
$aggregator = 'sum';
if (empty($time)) {
$time = date('U');
}
@johann8384
johann8384 / post-receive
Created October 17, 2013 19:39
post-receive hook for synchronizing BIND masters
#!/bin/bash
unset GIT_DIR
REPO_DIR=/var/lib/gitosis/repositories/internal_dns.git
CLONE_DIR=/var/named/chroot/var/named/data
ERR_OUT=/tmp/named_error.out.$$
if [ ! -e "${CLONE_DIR}/.git" ]; then
git clone "$REPO_DIR" "$CLONE_DIR"