This file contains 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 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 |
This file contains 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
# requires PyYAML | |
_YAML2JSON(){ | |
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < $1 | |
} |
This file contains 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
# 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" : { |
This file contains 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
index=$1 | |
curl -XGET 'http://localhost:9200/${index}?pretty' |
This file contains 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
curl -XGET 'localhost:9200/_cat/indices?v&pretty' |
This file contains 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
INDEX=$1 | |
curl -XDELETE http://localhost:9200/${INDEX} |
This file contains 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
TEMPLATE=$1 | |
curl -XGET 'localhost:9200/_template/${TEMPLATE}?pretty' |
This file contains 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
curl -XPUT http://localhost:9200/_template/pfsense?pretty -H 'Content-Type: application/json' -d' | |
{ | |
"order" : 0, | |
"version" : 50002, | |
"template" : "pfsense-*", | |
"settings" : { | |
"index" : { | |
"number_of_shards": 3, | |
"number_of_replicas": 1, | |
"refresh_interval" : "30s" |
This file contains 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
ES_DELETE_QUERY(){ | |
INDEX=$1 | |
KEY=$2 | |
VALUE=$3 | |
curl -XPOST 'localhost:9200/${INDEX}/_delete_by_query?scroll_size=5000&pretty' -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"match": { | |
"${KEY}": "${VALUE}" | |
} |
This file contains 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
# set the following cluster settings to prevent rebalancing | |
curl -XPUT 'localhost:9200/_cluster/settings?pretty' -H 'Content-Type: application/json' -d' | |
{ | |
"persistent": { | |
"cluster.routing.allocation.enable": "none" | |
} | |
} | |
' |
OlderNewer