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
| POST /machine?comp=health HTTP/1.1 | |
| Host: 10.76.84.160 | |
| Accept-Encoding: identity | |
| Content-Length: 439 | |
| Content-Type: text/xml; charset=utf-8 | |
| x-ms-version: 2011-12-31 | |
| x-ms-agent-name: WALinuxAgent | |
| <?xml version="1.0" encoding="utf-8"?><Health xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GoalStateIncarnation>1</GoalStateIncarnation><Container><ContainerId>f5940043-dbed-419c-9122-d77a4ac854b7</ContainerId><RoleInstanceList><Role><InstanceId>79247837105c4470b89352eda4b10942.firstone</InstanceId><Health><State>Ready</State></Health></Role></RoleInstanceList></Container></Health>HTTP/1.1 200 OK | |
| Content-Length: 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
| $ ansible-playbook -i hosts -c local access.yaml | |
| PLAY [all] ******************************************************************** | |
| GATHERING FACTS *************************************************************** | |
| ok: [127.0.0.1] | |
| TASK: [template src=./access.j2 dest=./access.conf] *************************** | |
| changed: [127.0.0.1] |
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
| # Not sure why I had to do this, seems like I shouldn't have to | |
| def region_from_str(s): | |
| regions = boto.ec2.regions() | |
| for r in regions: | |
| if s == r.name: | |
| return r | |
| vpc_conn = VPCConnection(region=region_from_str(region)) |
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
| In [1]: import netaddr | |
| In [2]: vpc_block = netaddr.IPNetwork("192.168.0.0/16") | |
| In [3]: vpc_subnets = list(vpc_block.subnet(24)) | |
| In [4]: vpc_subnets[1:3] | |
| Out[4]: [IPNetwork('192.168.1.0/24'), IPNetwork('192.168.2.0/24')] | |
| In [5]: str(vpc_subnets[2]) | |
| Out[5]: '192.168.2.0/24' |
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
| Guys, | |
| I don't want to be rude but, Linux 3.13 sucks a lot. | |
| I'm wondering here, for God's sake, why Ubuntu 14.04 comes with this lame kernel? What Ubuntu Kernel Team have in mind?! | |
| Mark Shuttlework must say something about this situation. What he is gonna do? I really t want to know that. | |
| I'm a HUGE fan of Ubuntu, and I mean it, I have no plans to switch off Ubuntu and I'll stick with 14.04 but, definitely, Linux 3.13 was a bad, bad choice for a LTS version like Trusty. |
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
| // From https://www.socketloop.com/tutorials/golang-read-directory-content-with-filepath-walk | |
| package main | |
| import ( | |
| "path/filepath" | |
| "os" | |
| "flag" | |
| "fmt" | |
| ) |
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 python | |
| import requests | |
| import sys | |
| import json | |
| from datetime import date, timedelta | |
| #Your PagerDuty API key. A read-only key will work for this. | |
| AUTH_TOKEN = 'YOUR_API_KEY' | |
| #The API base url, make sure to include the subdomain |
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
| if __name__ == "__main__": | |
| c = Elasticsearch("http://192.168.2.218:9200") | |
| f = open(sys.argv[1]) | |
| for line in f: | |
| # Convert public_hostname to IPs because hostname lookups are failing in ES for some reason | |
| if line.find("ec2") > -1: | |
| host = socket.gethostbyname(line.rstrip().lstrip()) | |
| else: | |
| host = line.rstrip().lstrip() |
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
| tracer = logging.getLogger('elasticsearch.trace') | |
| tracer.setLevel(logging.DEBUG) | |
| tracer.addHandler(logging.FileHandler('/tmp/es-client.log')) |
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
| root@docker01:/etc/systemd/system# cat dockerlog-json.service | |
| [Unit] | |
| Description=Send Docker logs via Journalctl to Syslog (JSON) | |
| [Service] | |
| TimeoutStartSec=0 | |
| ExecStart=/bin/sh -c '/bin/journalctl -u docker.service -o json -f | /usr/bin/ncat 192.168.2.136 1515' | |
| Restart=always | |
| RestartSec=5s |
OlderNewer