Skip to content

Instantly share code, notes, and snippets.

@WrathOfChris
WrathOfChris / test_carbon_ring.py
Created November 2, 2014 16:25
quick test of carbon ConsistentHashingRouter order
#!/usr/local/bin/python
import carbon.routers
from pprint import pprint
import string
import random
this = carbon.routers.ConsistentHashingRouter()
this.addDestination(("4.4.4.4", 2003, 1))
this.addDestination(("3.3.3.3", 2003, 1))
this.addDestination(("2.2.2.2", 2003, 1))
@WrathOfChris
WrathOfChris / riak-nagios-connection-error.md
Last active August 29, 2015 14:02
riak-nagios cannot connect from unprivileged user

riak 1.4.8 check_node works as expected when run as either root user or ubuntu user, but not when using an unprivileged user such as sensu.

Resolution

$HOME/.erlang.cookie not writeable by sensu user. By default, /opt/sensu is not writeable by the sensu user.

$ sudo -u sensu mkdir -p /tmp/sensu
$ HOME=/tmp/sensu sudo -u sensu /usr/lib/riak/erts-5.9.1/bin/escript /usr/local/sbin/check_node --node riak@`hostname -f` --name sensu@`hostname -f` --cookie riak node_up
OKAY: [email protected] is responding to pings
@WrathOfChris
WrathOfChris / gist:14d739f9daebaa068f39
Created June 2, 2014 18:34
check_node with error dump
diff --git a/src/check_node.erl b/src/check_node.erl
index aeff65e..3905e5b 100644
--- a/src/check_node.erl
+++ b/src/check_node.erl
@@ -68,10 +68,10 @@ retry_connect(Name0, Number, Node, Cookie) ->
end;
{error, Reason} ->
case Reason of
- {shutdown, _} ->
+ {shutdown, Foo} ->
@WrathOfChris
WrathOfChris / gist:c197ce69fefb970dace4
Created June 2, 2014 18:23
riak-nagios check_node
$ sudo -u sensu /usr/lib/riak/erts-5.9.1/bin/escript /usr/local/sbin/check_node --node riak@`hostname -f` --name sensu@`hostname` --cookie riak-us-east-1 node_up
UNKNOWN: Foo {child,undefined,net_sup_dynamic,
{erl_distribution,start_link,
[['250sensu@ip-172-20-31-83']]},
permanent,1000,supervisor,
[erl_distribution]}u
---
- name: Snowflake role
hosts: "{{host}}"
user: ubuntu
sudo: true
vars_files:
- vars/main.yml
tasks:
- include: tasks/main.yml
@WrathOfChris
WrathOfChris / gist:7947116
Created December 13, 2013 16:40
.bash_profile for mac ec2 tools
AWS_ACCESS_KEY=''
AWS_SECRET_KEY=''
# ec2-api-tools
EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
JAVA_HOME="$(/usr/libexec/java_home)"
export AWS_ACCESS_KEY AWS_SECRET_KEY EC2_HOME JAVA_HOME
# aws-iam-tools
export AWS_IAM_HOME="/usr/local/opt/aws-iam-tools/jars"