Skip to content

Instantly share code, notes, and snippets.

View jjasghar's full-sized avatar

JJ Asghar jjasghar

View GitHub Profile
@jjasghar
jjasghar / create_vm.sh
Created May 18, 2012 19:44
Using Virtualbox to build throw away vms
#!/usr/local/bin/bash
VDI_DIR='/home/me/vdi/'
UBUNTU_GOLD_VDI="ubuntu_11_10_gold.vdi"
REDHAT_GOLD_VDI="centos_6_2_gold.vdi"
HOST_NIC="em0"
echo "Name of VM"
read name_of_vm
ಠ_ಠ Disapproval
(╯°□°)╯︵ ┻━┻ Flipped the table
┬──┬ ノ( ゜-゜ノ) Put the table back
t(-_-)t Both middle fingers up
..|..(~.')> Pissed off Kirby
@jjasghar
jjasghar / gist:3011904
Created June 28, 2012 15:10
stupid nethack
10:08:55 [h0m3ro] ~ $ nethack-console
[1]+ Stopped nethack-console
10:09:31 [h0m3ro] ~ $ sudo kill -9 nethack-console
ERROR: garbage process ID "nethack-console".
Usage:
kill pid ... Send SIGTERM to every process listed.
kill signal pid ... Send a signal to every process listed.
kill -s signal pid ... Send a signal to every process listed.
[default]
host = charlie.its.utexas.edu
index=bbdev
# Syslogs
[monitor:///var/log/messages]
index=syslog
# Secure logs
[monitor:///var/log/secure]
@jjasghar
jjasghar / gist:3101236
Created July 12, 2012 21:41
Redhat Linux Audit
#!/bin/bash
DATE=`date +%F`
HOSTNAME=`hostname -s`
EMAIL=me@hostname.com
uname -a >> /tmp/$HOSTNAME.$DATE.txt
echo "" >> /tmp/$HOSTNAME.$DATE.txt
uptime >> /tmp/$HOSTNAME.$DATE.txt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
=====================================================================
Red Hat Security Advisory
Synopsis: Moderate: sudo security update
Advisory ID: RHSA-2012:1081-01
Product: Red Hat Enterprise Linux
Advisory URL: https://rhn.redhat.com/errata/RHSA-2012-1081.html
#!/usr/local/bin/bash
VBoxManage clonehd ubuntu_11_10_gold.vdi ubuntu_11_10_tmp.vdi
VBoxManage createvm --name "tmp" --ostype "Ubuntu" -register
VBoxManage modifyvm "tmp" --memory 4096 --boot1 dvd
VBoxManage storagectl "tmp" --name "IDE Controller" --add ide
VBoxManage storageattach "tmp" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium ubuntu_11_10_tmp.vdi
VBoxManage modifyvm "tmp" --nic1 bridged --nictype1 82543GC --bridgeadapter1 em0
VBoxHeadless -s "tmp" -n
#!/usr/local/bin/bash
VBoxManage clonehd ubuntu_11_10_gold.vdi ubuntu_11_10_tmp.vdi
VBoxManage createvm --name "tmp" --ostype "Ubuntu" -register
VBoxManage modifyvm "tmp" --memory 4096 --boot1 dvd
VBoxManage storagectl "tmp" --name "IDE Controller" --add ide
VBoxManage storageattach "tmp" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium ubuntu_11_10_tmp.vdi
VBoxManage modifyvm "tmp" --nic1 bridged --nictype1 82543GC --bridgeadapter1 em0
VBoxHeadless -s "tmp" -n
13:37:29 [ops01] cookbooks $ knife environment show _default
chef_type: environment
cookbook_versions: {}
default_attributes: {}
description: The default Chef environment
json_class: Chef::Environment
name: _default
override_attributes: {}
[ops01] cookbooks $ knife cookbook show shibboleth

Application specific host grouping in Riemann-dash

It is generally desirable to group all the hosts for a specific service into a single dashboard view. For example, all the web servers are in single view while all the database servers are in another view.

This is usually not an issue when you are sending custom metrics using Riemann client. However, there are cases where you are using something that you do not control how the metrics are being sent. i.e., Riemann-tools.

Since Riemann-tools scripts are application agnostic, in order for the dashboard view to group hosts, we must inject some application specific information into the tags field. Tags is a collection of arbitrary strings. In the case of Riemann-tools scripts you can pass in arbitrary strings on the command line.

riemann-health --host 127.0.0.1 --tag "prod" --tag "webserver"