Skip to content

Instantly share code, notes, and snippets.

View georgegoh's full-sized avatar

George Goh georgegoh

  • VMware
  • Singapore
View GitHub Profile
@georgegoh
georgegoh / ezlink_trace
Created July 10, 2011 14:18
Trace happens after a long period of unsuccessfully trying to read EZ Link cards.
> Set-ExecutionPolicy -Force RemoteSigned
> mkdir "C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup"
@ECHO OFF
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup\bootstrap.ps1
#Retrieve a Userdata file.
function GetUserDataFile($DestinationPath)
{
$WebClient = (New-Object Net.WebClient)
$WebClient.DownloadFile("http://169.254.169.254/latest/user-data/", $DestinationPath)
}
$workingDir = "C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup"
#Get the userdata file into the working directory.
"Script Name" : C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup\init.bat
@georgegoh
georgegoh / es-health.sh
Last active October 3, 2018 07:20
One-liner to get health of the Elasticsearch cluster from the first ES pod
#!/bin/sh
oc -n openshift-logging exec `oc -n openshift-logging get po -l component=es -o go-template='{{ (index .items 0).metadata.name }}'` \
-c elasticsearch \
-- curl -s \
--cacert /etc/elasticsearch/secret/admin-ca \
--cert /etc/elasticsearch/secret/admin-cert \
--key /etc/elasticsearch/secret/admin-key \
https://logging-es:9200/_cluster/health?pretty
@georgegoh
georgegoh / export_efk_secrets.sh
Created November 14, 2017 02:00
Export secrets used in the OCP EFK stack
#!/bin/sh
SECRETS="curator curator-ops elasticsearch fluentd kibana kibana-proxy"
for secret in $SECRETS
do
oc export secret logging-$secret > logging-$secret.yaml
done
@georgegoh
georgegoh / import_efk_secrets.sh
Created November 14, 2017 02:01
Import EFK secrets and restart the pods.
#!/bin/sh
SECRETS="curator curator-ops elasticsearch fluentd kibana kibana-proxy"
for secret in $SECRETS
do
oc delete secret logging-${secret}
oc create -f logging-${secret}.yaml
done
@georgegoh
georgegoh / setup_es_backup.sh
Last active November 14, 2017 03:46
Set up backup path for Elasticsearch
oc rsh `oc get po -l component=es --show-labels -o name|head -n 1` \
curl --cacert /etc/elasticsearch/secret/admin-ca \
--cert /etc/elasticsearch/secret/admin-cert \
--key /etc/elasticsearch/secret/admin-key \
-XPUT 'https://logging-es:9200/_snapshot/log_backup?pretty' -H 'Content-Type: application/json' -d'
{
"type": "fs",
"settings": {
"location": "/elasticsearch/backup",
"compress": true