This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had a problem which required a closed monitoring of AMQ resources. | |
All Enterprise Java program can be monitored by JMX and the standard interface to visualize instrumentation data is JConsole. | |
Jconsole is great for realtime monitoring, but our load tests were running for hours and we needed all raw data to be parsed offline, a Jconsole graph is an approximation for our purposes. | |
I wanted a Cli tool to save on file all raw numbers; first I needed a java utility to query java processes via JMX protocol. | |
I choose jmxterm ( http://wiki.cyclopsgroup.org/jmxterm/ ) which is simple and scriptable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Acts like rpm -qa and lists the names of all the installed packages. | |
# Usage: | |
# python rpmqa.py | |
# This toool was used to debug RedHat Bugzilla BZ#1253608 for RHEL6 (not public) | |
# the relative errata is: https://rhn.redhat.com/errata/RHBA-2015-1809.html | |
import rpm | |
import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto | |
import sys,os.path | |
from boto.s3.key import Key | |
file_name=sys.argv[1] | |
if not os.path.isfile(file_name): | |
print file_name + " not found!" | |
sys.exit() | |
aws_access_key='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
################################################################################## | |
function usage(){ | |
echo "usage: $(basename $0) /path/to/jenkins_home archive.tar.gz" | |
} | |
################################################################################## | |
readonly JENKINS_HOME=$1 | |
readonly DEST_FILE=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can't simply run a backup on a specific node in a cluster, since its role can change to master and lead to an overload for it. | |
You need some intelligence to choose the right node (slave) and allow multiple nodes to execute the backup; you want to be safe without | |
designing a specific node to run it. | |
This is my approach: | |
* schedule the script below in any MongoDB host | |
* the script will exit if it's running on a master | |
* if it's a slave, it will wait a random interval, check if there's a lock document on the master and if not present perform the backup. | |
in such a way you are covered from any single node failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ------------------------------------------------------------ * | |
* file: sslconnect.c * | |
* ------------------------------------------------------------ * | |
* file: sslconnect.c * | |
* purpose: utility to time an SSL connection and * | |
* to compile: * | |
* gcc -lssl -lcrypto -o sslconnect sslconnect.c * | |
* ------------------------------------------------------------ */ | |
#include <sys/socket.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'redis' | |
require 'uri' | |
uri = URI.parse('redis://127.0.0.1:26379') | |
REDIS = Redis.new(:host => uri.host, :port => uri.port) | |
REDIS.psubscribe('*switch-master' ) do |on| | |
on.psubscribe do |event, total| | |
puts "Subscribed to ##{event} (#{total} subscriptions)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# the envionment variable 'mode' will select the type of deployment from the yml file | |
require 'yaml' | |
mode = ENV['mode'] | |
puts ("mode selected: #{mode}") | |
box_details = YAML.load_file("vagrant_ansible.yml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Configuration File for keepalived | |
global_defs { | |
} | |
vrrp_script chk_redis_master { | |
script "redis-cli info replication|grep master > /dev/null" | |
interval 2 # check every 2 seconds | |
weight 2 # add 2 points of prio if OK | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
yum update | |
yum install -y unzip php httpd mysql-server mysql php-mysql vim telnet | |
conf=" \n | |
[mysqld] \n | |
port=3307 \n | |
datadir=/var/lib/mysql \n | |
socket=/var/lib/mysql/mysql.sock\n |
OlderNewer