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 shard usage | |
# (from _cat/shards?v&bytes=b) to see which shards of an index | |
# are not evenly spread across the cluster, and for a set of | |
# hard-coded date patterns, which date patterns are not spread | |
# evenly across the cluster. | |
# | |
# E.g. | |
# $ curl -X GET http://localhost:9200/_cat/shards?v\&bytes=b -o shards.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 | |
echo "DCs" | |
echo "----" | |
oc get dc -n logging -o yaml | grep image: | sort | uniq | |
echo "DSs" | |
echo "----" | |
oc get ds -n logging -o yaml | grep image: | sort | uniq |
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:-} | |
if [ -z "${pod}" ]; then | |
pod=$(oc get pods -l component=fluentd -o jsonpath={.items[*].metadata.name}) | |
fi | |
for p in ${pod}; do | |
echo ">>>>>>>><<<<<<<<<<<<<" | |
echo " ${p}" | |
echo ">>>>>>>><<<<<<<<<<<<<" | |
oc logs $p |
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 | |
POD=$1 | |
SIZE="${SIZE:-1000}" | |
index=".kibana" | |
oc exec -n logging -c elasticsearch $POD -- es_util --query="$index/index-pattern/_search?pretty&stored_fields=_id&size=$SIZE" | grep id | grep project\..* | cut -d ':' -f 2 | cut -d '"' -f 2 | paste -sd " " > patterns | |
echo '' > payload | |
for p in $(cat patterns); do | |
echo "{\"delete\":{\"_index\":\"${index}\", \"_type\":\"index-pattern\", \"_id\":\"$p\"}}"i # >> payload | |
done | |
cat payload |
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/sh | |
pods=${1:-"--all"} | |
shift | |
if [ "${pods}" == "--all" ]; then | |
pods=$(oc get pods -l component=fluentd -o jsonpath={.items[*].metadata.name}) | |
fi | |
for p in $pods; do | |
output=$(oc exec $p -- curl --silent -q https://logging-es:9200/ --key /etc/fluent/keys/key --cacert /etc/fluent/keys/ca --cert /etc/fluent/keys/cert "$@") |
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}\"}}" |
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 | |
# 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 | |
pod=$1 | |
oc exec -c elasticsearch $pod -- es_util --query=_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED |
NewerOlder