Skip to content

Instantly share code, notes, and snippets.

View salekseev's full-sized avatar

Stas Alekseev salekseev

View GitHub Profile
exec { 'restore_golden_mongodump':
path => '/usr/bin:/usr/sbin:/bin',
onlyif => [
'which mongorestore',
'echo "db.access_tokens.find()" | mongo --quiet graylog | grep prometheus',
]
}
@salekseev
salekseev / check-elasticsearch-underreplicated.sh
Created July 28, 2017 19:21
Script to check Elasticsearch clusters for under-replicated indices
#!/bin/sh
#
# script accepts URLs of Elasticsearch clusters as arguments
# exit code table:
# 0 - no underreplicated indices
# 1 - found underreplicated indices
# 2 - unable to connect to one of those URLs could not be connected to
# 3 - timed out getting list of indices
#
for var in "$@"
#!/bin/sh
stack=devops-graylog
puppet_environment=development
stack_nodes=$(bundle exec sfn inspect --nodes $stack | egrep '^\s+"10.*' | cut -d'"' -f2)
for node in $stack_nodes
do
ssh $node "sudo bash -c '/opt/puppetlabs/bin/puppet agent -t --environment $puppet_environment' "
done
0xFa445C624412187A0292E8b2Fb5C73466699D015
#!/bin/bash
elasticsearch_url="https://elasticsearchlog.athenahealth.com:9200"
month=$(date +%Y.%m)
indices=$(curl -s "${elasticsearch_url}/_cat/indices?bytes=b" | sort -rnk8)
echo "Statistics for the month of $month"
echo -n "Events stored month-to-date: "
require 'diplomat'
service = 'mongodb'
puts Diplomat::Health.service(service, passing: true).map { |service| service['Service']['Address'] + ':' + service['Service']['Port'].to_s }

Keybase proof

I hereby claim:

  • I am salekseev on github.
  • I am salekseev (https://keybase.io/salekseev) on keybase.
  • I have a public key ASCERHqJ9yH5cLmY6ZkKqNxmwsUw2-r1rxj_bmXFMPllJAo

To claim this, I am signing this object:

{
"algo": "cryptonight",
"av": 0,
"background": false,
"colors": true,
"cpu-affinity": null,
"cpu-priority": 3,
"donate-level": 0,
"log-file": null,
"max-cpu-usage": 100,