Skip to content

Instantly share code, notes, and snippets.

@jworl
jworl / es_delete_index.sh
Created September 1, 2017 21:46
Delete elasticsearch index
INDEX=$1
curl -XDELETE http://localhost:9200/${INDEX}
@jworl
jworl / es_indices.sh
Created August 31, 2017 18:46
show all elasticsearch indices with stats
curl -XGET 'localhost:9200/_cat/indices?v&pretty'
@jworl
jworl / es_index_property.sh
Created August 31, 2017 18:45
display elasticsearch index properties
index=$1
curl -XGET 'http://localhost:9200/${index}?pretty'
@jworl
jworl / logstash_template.sh
Last active September 14, 2017 15:15
elasticsearch template used by logstash for output
# Create logstash template for pipeline
LOGSTASH_TEMPLATE() {
pipeline=$1
curl -XPUT http://localhost:9200/_template/${pipeline}?pretty -H 'Content-Type: application/json' -d'
{
"order" : 0,
"version" : 50002,
"template" : "${pipeline}-*",
"settings" : {
"index" : {
@jworl
jworl / yaml2json.sh
Created June 29, 2017 14:54
yaml2json function within bash
# requires PyYAML
_YAML2JSON(){
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < $1
}
@jworl
jworl / ipmi_power.sh
Last active September 8, 2022 07:53
Issue reset, power off, or power on for SuperMicro BMC via web interface
#!/usr/bin/env bash
# written by: Joshua Worley
# received great help from DavidWittman here:
# https://gist.github.com/DavidWittman/98281cdf1d32ac795b74
# This version's improvements:
# - allows reset, power on, or power off
# - sanity check conditionals
# - sends pushover alert for notification