Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gordonm on github.
  • I am gordonm (https://keybase.io/gordonm) on keybase.
  • I have a public key ASCaBpcvN1dwh18if3uyAA7QrzgRTpY5OL25j-laLPss8wo

To claim this, I am signing this object:

#!/usr/bin/env bash
###############FUNCTIONS############
function prepare {
#optimize the index
echo -n "Optimizing index $INDEX_NAME..."
curl -XPOST "$ADDRESS/$INDEX_NAME/_optimize" 2>/dev/null| grep 'failed":0' >/dev/null
if [ $? -eq 0 ]; then
echo "done"
@gordonm
gordonm / check_salt
Created November 29, 2012 18:04 — forked from bastichelaar/check_salt
Nagios script to check whether a salt minion is online (with timeout)
#!/usr/bin/env python
import salt.cli.caller
import salt.config
import argparse
import sys
import signal
class TimeoutException(Exception):
pass
@gordonm
gordonm / check_salt.py
Created June 8, 2012 20:09 — forked from SEJeff/check_salt.py
nagios check to make sure the salt minion is available and responding to commands from @bastichelaar
#!/usr/bin/env python
import salt.cli.caller
import salt.config
import argparse
import sys
parser = argparse.ArgumentParser(description='Check if minions are online.')
parser.add_argument('hostname', help='The name of the minion to be checked')
args = parser.parse_args()
@gordonm
gordonm / gist:2896872
Created June 8, 2012 16:59
Salt state example
include:
- yum.omd
mon-required-pkgs:
pkg.installed:
- names:
- omd-0.54
- mod_ssl
- check_mk-agent-mon
- require:
@gordonm
gordonm / init.sls
Created June 8, 2012 16:31
elasticsearch
openjdk-6-jre:
pkg:
- installed
/tmp/elasticsearch.tar.gz:
file:
- managed
- source: https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.2.tar.gz
/tmp/servicewrapper.tar.gz:
@gordonm
gordonm / gist:2871674
Created June 5, 2012 00:24
Salt master not responding
[root@provision tmp]# date
Mon Jun 4 17:08:07 PDT 2012
[root@provision tmp]# grep salt-master /var/log/messages
Jun 4 17:05:30 provision kernel: salt-master[5136]: segfault at 20 ip 00007fc3753e1e1c sp 00007fff60f935e0 error 4 in libzmq.so.1.0.0[7fc3753c5000+2e000]
[root@provision tmp]# ps auxww | grep [s]alt
root 5128 0.0 0.0 646044 14780 ? Sl Jun01 0:02 /usr/bin/python /usr/bin/salt-master -d
root 5129 1.8 0.0 256748 13036 ? S Jun01 86:32 /usr/bin/python /usr/bin/salt-master -d
root 5136 0.7 0.0 0 0 ? Z Jun01 37:41 [salt-master] <defunct>
[ david@samwise ] $ cat salt.sls
/etc/salt/minion:
file:
- managed
- owner: root
- group: root
- mode: 444
- source: salt://salt/files/salt-minion.config
- template: jinja
- context:
[ david@samwise ] $ cat salt.sls
/etc/salt/minion:
file:
- managed
- owner: root
- group: root
- mode: 444
- source: salt://salt/files/salt-minion.config
- template: jinja
- context: {