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
@szaydel
szaydel / arcaccess.d
Created February 3, 2014 20:48
Dtrace script that shows aging of data in the ARC.
#!/usr/sbin/dtrace -s
#pragma D option quiet
dtrace:::BEGIN
{
printf("lbolt rate is %d Hertz.\n", `hz);
printf("Tracing lbolts between ARC accesses...");
}
fbt::arc_access:entry
#!/usr/bin/ksh
# This is a temporary workaround for aggregates not starting on boot.
DLADM_CMD=/usr/sbin/dladm
IPADM_CMD=/usr/sbin/ipadm
SVCPROP_CMD=/usr/bin/svcprop
typeset fmri=/system/postinst/config
typeset admin_name=$(${SVCPROP_CMD} -p settings/def_admin_int ${fmri})
typeset vnic_config=/etc/admin0.config
Feb 27 05:35:54.250379 afpd[22811] {dsi_stream.c:162} (D5:DSI): from_buf(read: 0, unread:0 , space left: 12582912): returning 0
Feb 27 05:35:54.250555 afpd[22811] {dsi_stream.c:162} (D5:DSI): from_buf(read: 0, unread:0 , space left: 12582912): returning 0
Feb 27 05:35:54.250594 afpd[22811] {dsi_stream.c:162} (D5:DSI): from_buf(read: 0, unread:0 , space left: 12582912): returning 0
Feb 27 05:35:54.250653 afpd[22811] {dsi_tcp.c:241} (I:DSI): AFP/TCP session from 10.11.2.10:50091
Feb 27 05:35:54.250767 afpd[22811] {netatalk_conf.c:1451} (D5:AFPDaemon): unload_volumes: BEGIN
Feb 27 05:35:54.250803 afpd[22811] {netatalk_conf.c:1462} (D5:AFPDaemon): unload_volumes: END
Feb 27 05:35:54.251062 afpd[22811] {dircache.c:575} (D5:AFPDaemon): dircache_init: done. max dircache size: 8192
Feb 27 05:35:54.251124 afpd[22811] {server_ipc.c:299} (D5:AFPDaemon): ipc_child_write(IPC_STATE)
Feb 27 05:35:54.251155 afpd[22811] {dsi_stream.c:162} (D5:DSI): from_buf(read: 0, unread:0 , space left: 12582912): returning 0
Feb 27 05:35:5
@szaydel
szaydel / zrecvlat.d
Created April 18, 2014 20:19
Dtrace ZFS receive side script to observe latency of restore subroutines.
#!/usr/sbin/dtrace -s
fbt:zfs:restore_*:entry
{
self->start = timestamp;
}
fbt:zfs:restore_*:return
{
@runtime[probefunc] = quantize(timestamp - self->start);
@szaydel
szaydel / nagios-iostat.py
Last active August 29, 2015 14:01
Python wrapper around iostat with adjusted formatting suitable for consumption by Nagios.
#!/usr/bin/env python
__author__ = 'RackTop Systems'
import shlex
import subprocess
from subprocess import PIPE
from string import digits
import datetime
import time
import signal
@szaydel
szaydel / cluster.xml
Created May 27, 2014 22:06
A SMF manifest for RSF1 HA Cluster Service on BrickstorOS.
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='BrickstorOS-High-Availability:bsros-ha'>
<service name='racktop/system/cluster' type='service' version='0'>
<dependency
name='network'
grouping='require_any'
restart_on='error'
type='service'>
<service_fmri value='svc:/milestone/network'/>
@szaydel
szaydel / spa-snippets.d
Last active August 29, 2015 14:01
Dtrace snippets useful to get some insight into ZFS and SPA synching process.
## Observe durations of SPA sync events.
dtrace -n '::txg_sync_thread:txg-syncing { x[1234] = timestamp } ::txg_sync_thread:txg-synced /x[1234] != 0/ { this->delta = (timestamp - x[1234]) / 1000; @[this->delta > 65536 ] = quantize(this->delta); x[1234] = 0; } :END { trunc(@, 10); }'
@szaydel
szaydel / rsf.sh
Last active August 29, 2015 14:01
RSF1 scripts with BrickstorOS-specific modifications.
#!/bin/sh
#
# $Id: rsf.sh,v 2.138 2014/04/01 14:49:21 build Exp $
#
# Script: rsf.sh
#
# Description: Generic supporting vars and functions for RSF-1 scripts
#
# Platform: Unix
#
@szaydel
szaydel / rsfexec
Last active August 29, 2015 14:01
RSF1 rsfexec script with BrickstorOS-specific modifications. Mainly, changes are to network handling, where ifconfig, which by nature is non-persistent is replaced with ipadm, which by nature is persistent, but we use `-t` throughout, in order to make it non-persistent, which is what we want with floating interfaces.
#!/bin/sh
# $Id: rsfexec,v 1.104 2014/02/26 16:09:03 matt Exp $
#
# Script: rsfexec
#
# Description: Overall handler for service scripts
#
# Platform: Unix
#
# Author: High-Availability.Com Ltd
@szaydel
szaydel / cluster
Created May 30, 2014 13:33
RSF-1 Cluster Startup modified to work with SMF and having specific customizations to work on BrickstorOS.
#!/bin/sh
# $Id: rsfrc,v 2.106 2014/04/16 10:40:12 pg Exp $
#
# Script: rsfrc
#
# Description: RSF-1 startup/shutdown script
# Use the 'restart' option if services are already up
# Use the 'kill' option to stop RSF-1 but leave
# services running. WARNING: this option may cause an
# incorrect failover if the remote end is in automatic mode!