This will return the full Git commit SHA of whichever branch is currently checkedout.
Dump the snippet into terraform console (run from within a Git repo) to see for yourself.
| # this is a configurable version of an EventMachine syslogger | |
| # It was build to replace https://github.com/melito/em-syslog | |
| # | |
| # You can instantiate many of them (no global variables) as | |
| # well as configure the facility. It also quacks like a ruby | |
| # logger so it can be interchanged with a ruby logger. | |
| # | |
| # Example: | |
| # | |
| # # 11 is the facility code for an FTP daemon |
| #!/usr/bin/env python | |
| # coding=utf-8 | |
| import argparse | |
| import datetime | |
| import sys | |
| import time | |
| import threading | |
| import traceback | |
| import socketserver |
| * Shows a message while asserting like: | |
| ok: [host] => { | |
| "msg": "disk usage 4.2B of total 20.0GB (21.0%) (should exceed limit 90.0%)" | |
| } | |
| * Note this only looks at first mount point on current node | |
| * Fails if disk is near-full | |
| * Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time | |
| * Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size |
| # | |
| # Figured out using: | |
| # https://wiki.debian.org/DebianInstaller/Preseed/EditIso | |
| # https://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-initrd-img/ | |
| # https://gist.github.com/Aktau/5510437 | |
| # https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/ | |
| # | |
| ## Go home | |
| cd |
This will return the full Git commit SHA of whichever branch is currently checkedout.
Dump the snippet into terraform console (run from within a Git repo) to see for yourself.
. is required in the end, like: home.example.com.