Skip to content

Instantly share code, notes, and snippets.

View szaydel's full-sized avatar

Sam Zaydel szaydel

  • RackTop Systems
  • Moss Beach
View GitHub Profile
#! /usr/bin/env python
from pykka.actor import Actor
import pykka
import urllib
class Fetcher(Actor):
def fetch(self, url):
return urllib.urlopen(url).read()
After moving a machine from one Hypervisor to another it may be necessary to change some parameters, particularly likely are Network settings. This is a snippet for making changes to NIC configuration using an input file.
1) Update hostname and other trivial metadata. Hostname stored in the zone at /etc/nodename and /etc/hosts needs to be manually changed.
# echo '{"hostname": "rts-build-01.rts004.racktoplabs.com"}' | vmadm update bf43a067-b619-4383-bf6a-e2c44f0de575
2) Get information about NICs setup in the VM.
# vmadm get bf43a067-b619-4383-bf6a-e2c44f0de575|json nics
[
@szaydel
szaydel / Diagnosing random crashes
Created March 20, 2013 14:28
List of things to collect when diagnosing issues with systems that appear to suddenly crash at random intervals.
These two are per-cpu metrics, and we need to split them out. The output will return one cpu per line, so it should be easy to split into individual metrics.
These are context switches and we want to track whether there are instances where they skyrocket.
kstat -p cpu:*:sys:pswitch
kstat -p cpu:*:sys:inv_swtch
kstat -p unix:0:system_pages:
kstat -p cpu:*:sys:intr
kstat -p cpu:*:sys:xcalls
@szaydel
szaydel / afp-krb5.conf
Last active July 8, 2022 15:41 — forked from oscarcck/afp.conf
AFP Configuration File Examples
; Copyright 2009-2015 RackTop Systems Inc. and/or its affiliates.
; http://www.racktopsystems.com
;
; The methods and techniques utilized herein are considered TRADE SECRETS
; and/or CONFIDENTIAL unless otherwise noted. REPRODUCTION or DISTRIBUTION
; is FORBIDDEN, in whole and/or in part, except by express written permission
; of RackTop Systems.
;
; @@DESCRIPTION@@ Configuration file for Netatalk -- Apple Filing Protocol.
; @@NAME@@ afp.conf
Install prerequisites:
$ sudo apt-get install build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libcrack2-dev libwrap0-dev autotools-dev automake libtool libdb-dev libacl1-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev
Download src:
$ cd /some/temp/dir
$ git clone git://git.code.sf.net/p/netatalk/code netatalk
$ cd netatalk
$ ./bootstrap
@szaydel
szaydel / hastebin.sh
Created April 3, 2013 17:51
A simple hastebin client. This client is meant to work on systems that have the json command. If the command is not there, this will bomb out.
#!/bin/bash
url='hastebin.com';
curl_args='--silent --request POST --data'
[[ -z $1 ]] && str=$(cat /dev/stdin) || str=$1
[[ -x $(which curl) ]] || (printf "%s\n" "Unable to locate cURL executable"; exit 1)
if [ -z "$str" ]; then
echo $usage;
m = json.dumps({ "metrics" :
[
{ "device": "abc123xyz",
"class": "hw-storage",
"group": "hdd",
"component": "disk1",
"field": "errors",
"sub field": "soft errors",
"metric": "50",
#!/usr/bin/bash
cd /; wget -O - http://pkgsrc.joyent.com/packages/SmartOS/bootstrap/bootstrap-2013Q1-x86_64.tar.gz | gzcat | tar -xf - ; cd
## alternatively: # cd /; curl -k http://pkgsrc.joyent.com/packages/SmartOS/bootstrap/bootstrap-2013Q1-x86_64.tar.gz | gzcat | tar -xf -; cd
## Rebuild pkgin database
pkg_admin rebuild
## Getting information about the available packages.
#!/bin/bash
# Simple Ad Hoc SmartOS Setup Service
set -o xtrace
. /lib/svc/share/smf_include.sh
cd /
PATH=/usr/sbin:/usr/bin:/opt/custom/bin:/opt/custom/sbin; export PATH
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar