Skip to content

Instantly share code, notes, and snippets.

View jameswnl's full-sized avatar

James Wong jameswnl

View GitHub Profile
@jameswnl
jameswnl / gist:5fa3ac8e60915a7ddf59
Created August 5, 2014 03:09
sequence IQ multi-node hadoop cluster on dockers output
bash-3.2$ . .amb && amb-deploy-cluster
starting an ambari cluster with: 3 nodes
[DEBUG] docker run -d --dns 127.0.0.1 --entrypoint /usr/local/serf/bin/start-serf-agent.sh -e KEYCHAIN= --name amb0 -h amb0.mycorp.kom sequenceiq/ambari --tag ambari-server=true
2ee6cc6983649f442e68966a9275669460b4ca7c96a9a1c850609f9878069899
[DEBUG] docker run -d -e SERF_JOIN_IP=172.17.0.18 --dns 127.0.0.1 --entrypoint /usr/local/serf/bin/start-serf-agent.sh -e KEYCHAIN= --name amb1 -h amb1.mycorp.kom sequenceiq/ambari --log-level debug
ebf5b14c05ff44eb3b4c426b40f5d7221a50cd09bc5104eecc65afb4a9d93f51
[DEBUG] docker run -d -e SERF_JOIN_IP=172.17.0.18 --dns 127.0.0.1 --entrypoint /usr/local/serf/bin/start-serf-agent.sh -e KEYCHAIN= --name amb2 -h amb2.mycorp.kom sequenceiq/ambari --log-level debug
cb189ec23808fe782c5aa2244bd5ea9d74f7abb6c42bd63e1cb2969149d596cb
[DEBUG] docker run -it --rm -e EXPECTED_HOST_COUNT=3 -e BLUEPRINT=multi-node-hdfs-yarn --link amb0:ambariserver --entrypoint /bin/sh sequenceiq/ambari -c /tmp/install-cluste
- hosts: localhost
name: Provision play
connection: local
gather_facts: False
vars:
- ami_id: ami-78fc7410
- key_name: operations
- username: jameswong
tasks:
- name: Provision a set of instances
### after running this, manually update the Name tag and assign EIP. Run the bbin.yml playbook
- hosts: localhost
name: Provision kyoto
connection: local
gather_facts: False
vars:
- ami_id: ami-6bceb41c # with 1x500GB EBS
- key_name: operations
#https://boto3.readthedocs.org/en/latest/reference/services/cloudwatch.html
import boto3
client = boto3.client('cloudwatch')
r2=client.get_metric_statistics(Namespace='AWS/EC2', MetricName='CPUUtilization',Statistics=['SampleCount'],StartTime=datetime(2015, 7, 19), EndTime=datetime(2015, 7, 20), Period=120, Dimensions=[{'Name': 'InstanceId', 'Value': 'i-6a469f90'}])
runs=[]
for status in ec2.meta.client.describe_instance_status()['InstanceStatuses']:
runs.append(status)
DB migration plan for VMware Distributed vSwitch support:
PR1:
1. update table switches.uid_ems = switches.host_id + "|" + switches.uid_ems
2. add index to switches on field uid_ems :uniquness => true
(VDS already has its uid_ems natural unique, this migration is to enforce that for local vSwitches)
PR2:
1. create a join table between hosts and switches, host_switches
2. populate (host_switches.host_id, host_switches.uid_ems) = (switches.host_id, switches.uid_ems)
{"MOR":"dvs-138", "config":{"uuid":"72 e1 2a 50 23 7a 6f 8c-2a 0d ed 82 3f 77 4a ab", "name":"DC1_DVS", "numStandalonePorts":"0", "numPorts":"384", "maxPorts":"2147483647", "uplinkPortPolicy":{"uplinkPortName":["uplink1", "uplink2", "uplink3", "uplink4"]}, "uplinkPortgroup":["dvportgroup-139"], "defaultPortConfig":{"blocked":{"inherited":"false", "value":"false"}, "vmDirectPathGen2Allowed":{"inherited":"false", "value":"false"}, "inShapingPolicy":{"inherited":"false", "enabled":{"inherited":"false", "value":"false"}, "averageBandwidth":{"inherited":"false", "value":"100000000"}, "peakBandwidth":{"inherited":"false", "value":"100000000"}, "burstSize":{"inherited":"false", "value":"104857600"}}, "outShapingPolicy":{"inherited":"false", "enabled":{"inherited":"false", "value":"false"}, "averageBandwidth":{"inherited":"false", "value":"100000000"}, "peakBandwidth":{"inherited":"false", "value":"100000000"}, "burstSize":{"inherited":"false", "value":"104857600"}}, "vendorSpecificConfig":{"inherited":"false"}, "net
@jameswnl
jameswnl / SecondMiqAppliance
Created October 3, 2017 18:19
Set up 2nd MIQ appliance
systemctl stop evmserverd && systemctl disable evmserverd
systemctl stop $APPLIANCE_PG_SERVICE && systemctl disable $APPLIANCE_PG_SERVICE
rm -rf $APPLIANCE_PG_DATA/*
vmdb && rm -f REGION config/database.yml
@jameswnl
jameswnl / vmware_metric_counters.rb
Created October 17, 2017 15:14
VMware metric counters
counter_keys = ["net_usage_rate_average",
"mem_vmmemctl_absolute_average",
"net_usage_rate_average",
"cpu_ready_delta_summation",
"mem_swaptarget_absolute_average",
"net_usage_rate_average",
"net_usage_rate_average",
"cpu_ready_delta_summation",
"mem_vmmemctltarget_absolute_average",
"net_usage_rate_average",
sudo xcode-select -s /Library/Developer/CommandLineTools && gem install ovirt-engine-sdk -v4.1.9 && sudo xcode-select -r
@jameswnl
jameswnl / NewMiqProvider.md
Last active November 15, 2017 20:10
Describe pain points with possible enhancements of creating a new MIQ Provider

Based on using existing generator commnd: rails generate provider <AnyCloud>

Difficulties/Problems

  1. Variable not found error for the new cloud manager due to naming convention of class and folder.
  2. UI add-provider page: Validate button not enabled
  3. manageiq-ui-classic/app/views/layouts/angular-bootstrap/_auth_credentials_angular_bootstrap.html.haml
  4. manageiq-ui-classic/app/views/layouts/angular-bootstrap/_endpoints_angular.html.haml