This file contains hidden or 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/env python | |
# Use via: curl -X GET http://localhost:9200/<index>/_search/?fields=@timestamp,level,hostname,kubernetes.host,kubernetes.pod_name,kubernetes.container_name,message&q=message:<string> | |
import sys, os, json | |
if len(sys.argv) == 1 or sys.argv[1] == '-': | |
json_doc = json.load(sys.stdin) | |
else: | |
json_doc = json.load(open(sys.argv[1])) |
This file contains hidden or 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
$ cat ../jctoolbox/openshift/origin-15.inventory | |
[OSEv3:children] | |
masters | |
nodes | |
[OSEv3:vars] | |
ansible_become=true | |
ansible_ssh_user=vagrant | |
ansible_ssh_private_key_file=/home/jeff.cantrill/.ssh/id_rsa | |
ansible_user=root |
This file contains hidden or 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 | |
function finish { | |
rm -rf $TMPDIR | |
} | |
trap finish EXIT | |
TMPDIR=$(mktemp -d) | |
mkdir $TMPDIR/output | |
let num=0 | |
let slow=0 |
This file contains hidden or 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 | |
let num=0 | |
for pod in $(oc get pod -n logging -l component=fluentd -o name); do | |
rss=$(oc exec -n logging $(basename $pod) -- ps auxww | grep fluentd | tail -n 1 | awk '{ print $6 }') | |
if [ "$rss" -gt 384000 ]; then | |
let num=num+1 | |
echo "$pod $rss" | |
fi | |
done | |
echo $num |
This file contains hidden or 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 | |
ES_URL='https://localhost:9200' | |
curl_get='curl -s -X GET --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key' | |
date | |
$curl_get $ES_URL/_cluster/pending_tasks?pretty |
This file contains hidden or 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/env python2 | |
# A script to generate a report of Elasticsearch index usage | |
# (from _cat/indices?v&bytes=b) by prefix for a set of known | |
# date suffixes. | |
# | |
# E.g. | |
# $ curl -X GET http://localhost:9200/_cat/indices?v\&bytes=b -o indices.lis | |
# $ ./sum-es-indices.py indices.lis | |
# |
This file contains hidden or 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 | |
pod=$1 | |
oc exec -c elasticsearch $pod -- es_util --query=_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED |
This file contains hidden or 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 | |
# This script allocates all primary shards that are unassigned to a a given node using | |
# the openshift binary. The binary must be in the path and the user executing the script | |
# must have access to logging project. The inputs are: | |
# pod An Elasticsearch pod name | |
# node An node Elasticsearch cluster which should be any one of the DC's. We could | |
# probably infer this from the pod name | |
pod=$1 | |
node=$2 |
This file contains hidden or 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 -e | |
# | |
# Copyright 2017 Red Hat, Inc. and/or its affiliates | |
# and other contributors as indicated by the @author tags. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains hidden or 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 | |
POD=$1 | |
enable=${2:-"all"} #or none | |
PERSIST=${PERSIST:-"transient"} | |
oc exec -n logging -c elasticsearch $POD -- es_util --query=_cluster/settings -XPUT -d "{\"${PERSIST}\":{\"cluster.routing.allocation.enable\":\"${enable}\"}}" |
OlderNewer