svcstats.py – Report IBM SVC/Storwize storage system performance statistics in CLI using SMI-S interface

My *stat-like utility to report IBM SVC/Storwize storage system performance statistics in CLI using SMI-S interface.

Report IBM SVC/Storwize storage system performance statistics in CLI using SMI-S interface

  • Requires Python 3 with ‘pywbem’ module
  • Before running svcstats.py, enable statistic on SVC/Storwize system:
    svctask startstats -interval <1-60 minutes>

Download svcstats.py from GitHub

Usage:
svcstats.py -n|-v|-m|-d -a address -u user -p password [-f minutes] [-ht]

Options:
-n, -v, -m or -d
option -q not recognized
Show nodes, vdisks, mdisks or drives performance statistics.

-a address -u user -p password
Valid IP/DNS address, username and passwors to connect with IBM SVC/Storwize storage system
[-f minutes]
Optional report frequency interval. Must not be less then default "StatisticsFrequency" value.
[-h]
Disable column headers.
[-t]
Show report date/time creation timestamp on the storage system

IBM SVC/Storwize CIM agent documentation

Project page: svcstats.py

Advertisements
Posted in My projects, Storage, Storage Automation | Tagged , , , , , , , , , , , , | Leave a comment

Extracting Performance Data from IBM Storwize

Vadim Zaigrin

Universal Storage Collector could extract performance data not only from EMC Storage Systems 🙂

New Extractor extracts data from IBM Storwize storage family.

View original post 116 more words

Posted in Copy-paste, Storage | Tagged , , , | 1 Comment

Executing a batch of commands on multiple IBM SVC/Storwize storage systems

Sometimes you have to change several configuration parameters or run multiple commands over a list of IBM SVC storage systems. Here is my small Python 3 script to do the stuff quickly. It requires Paramiko module to handle SSH interactions.

Edit svcrun_conf.py to set targets, logins, passwords and all other parameters.

Usage: ./svcrun.py

#!/usr/bin/python3

# svcrun.py - using SSH, execute a batch of commands on multiple IBM SVC/Storwize storage systems
# 
# Python 3 and paramiko module are required
# Edit svcrun_conf.py to set targets, logins, passwords and all other parameters
#
# Usage:
#  ./svcrun.py
#
# 2017.09.14  v 1.0   Mikhail Zakharov <zmey20000@yahoo.com>

import sys
import datetime
import paramiko

# Configurable values are in svcrun_conf.py
import svcrun_conf


def ssh_exec(command, target, port=22):
    """Execute a command via SSH and read results"""

    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

    try:
        client.connect(target[0], username=target[1], password=target[2], port=port)
    except:
        return 'Error: {user}@{target}: is inaccessible: {error}'.format(user=target[1], target=target[0],
                                                                         error=sys.exc_info()[1])

    stdin, stdout, stderr = client.exec_command(command)

    error = stderr.read()
    if error:
        error = error.decode('US-ASCII')
        client.close()
        return 'Error: {user}@{target}: "{command}" has failed: {error}'.format(target=target[0], user=target[1],
                                                                                command=command, error=error)

    data = stdout.read()
    client.close()

    try:
        data = data.decode('UTF-8')
    except UnicodeDecodeError:
        data = data.decode('US-ASCII')

    return data


def runcommand(target, command):
    dt = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now())

    print(dt, 'Run command: "{cmd}"'.format(cmd=command), file=sys.stderr)
    print(ssh_exec(command, target), file=open(dt + '_' + target[0] + '_' + command.split()[0] + '.out', 'a'))


for target in svcrun_conf.svc_targets:
    for command in svcrun_conf.svc_commands:
        runcommand(target, command)

print('Done', file=sys.stderr)

Configuration file is required:

# Configuration file for svcsrun.py

# Default SVC/Storwize credentials
svc_username = 'username'
svc_password = 'password'

# SVC/Storwize systems to run commands on
svc_targets = {
    # 'Hostname/IP', 'Login', 'Password'),
    ('192.168.1.11', svc_username, svc_password),
    ('192.168.1.12', 'anotheruser', 'secret')
}

# Commands to run one by one on each SVC/Storwize system
svc_commands = [
    'lssystem -delim \,',
    'lsvdisk -nohdr -bytes -delim \,'
]

Download it from GitHub

Posted in Storage Automation, Tips & tricks | Tagged , , , , , , , , , | Leave a comment

Scan IBM SVC/Storwize system for “SCSI ID Mismatches”

A small addition to the SAN/Storage CLI Toolbox which shows so called SCSI ID (LUN) mismatches on IBM SVC/Storwize systems. This Bourne shell/awk script shows the list of the same vdisks that are mapped with different SCSI IDs. Should be useful for clusters, especially VMware.

#!/bin/sh

# -----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# zmey20000@yahoo.com wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Mikhail Zakharov
# -----------------------------------------------------------------------------

# simmatch.sh - Scan IBM SVC/Storwize system for "SCSI ID Mismatches"
# 2017.08.31    v1.0

delim=","			# Main delimiter
delim2=";"			# Second layer delimiter
fashion="../fashion/fashion"	# fashion SSH wrapper. Comment/uncomment the
				# appropriate lines below if you want pure SSH

lshostvdiskmap="lshostvdiskmap -nohdr -delim $delim"

# ----------------------------------------------------------------------------- 
usage() {
    echo "Usage:"
    echo " simmatch.sh <target> <user> <password>"
    exit 1
}
  
# ----------------------------------------------------------------------------- 
[ "$#" -ne 3 ] && usage

target="$1"
user="$2"
password="$3"

awk="gawk"				# We need gawk to do the stuff

# Uncomment ssh and comment fashion if you like
#ssh "$user"@"$target" "$lshostvdiskmap" | $awk -F "$delim" -v d2=$delim2 '
$fashion "$target" "$user" "$password" "$lshostvdiskmap" | 
	$awk -F "$delim" -v d2=$delim2 '
{ 
	# Put all records into an array
	for (f = 1; f <= NF; f++)
		dm[NR, f] = $f
	dm[NR, NF + 1] = 0		# Mapping count
	dm[NR, NF + 2] = ""		# SCSI ID List
}
END {
	OFS = FS
	for (l = 1; l <= NR; l++)
		for (l1 = 1; l1 <= NR; l1++)
			if (dm[l, 4] == dm[l1, 4]) {
				dm[l, NF + 1] += 1
				dm[l, NF + 2] = dm[l, NF + 2] dm[l1, 3] OFS
			}
	# Pack SCSI ID List
	for (l = 1; l <= NR; l++) if (dm[l, 9] > 1) {
			len_sidlst = split(dm[l, NF + 2], sidlst)
			# get unique SCSI IDs only
			delete usidlst
			for (le = 1; le <= len_sidlst; le++)
				usidlst[sidlst[le]]++
			# Save unique SCSI IDs back to the list
			delete dm[l, NF + 2]
			for (sid in usidlst)
				if (sid != "")
					dm[l, NF + 2] = dm[l, NF + 2] sid d2
		}
	# Print out report
	print "Host ID", "Host Name", "SCSI ID", "Vdisk ID",\
		"Vdisk Name", "Vdisk UID", "IO Group ID",\
		"IO Group Name", "Mapping count", "SCSI ID List"
	for (l = 1; l <= NR; l++) if (split(dm[l, NF + 2], sidlst, d2) > 2) {
			for (f = 1; f < NF + 2; f++)
				printf dm[l, f] OFS
			# Ugly strip of the last "d2" occurrence
			printf substr(dm[l, NF + 2], 1, length(dm[l, NF + 2]) - 1)"\n"
		}
} 
'

Download it from GitHub.

Posted in Storage Automation, Tips & tricks | Tagged , , , , , , , , , , , , | Leave a comment

Accessing HP/3PAR storage systems using Python and SSH

I have just found a small script on Python 3 which I wrote for D81S to test a connection with HP/3PAR 7xxx arrays. It still looks like a good example of the subject, so I decided to store it for the future reference.

Posted in Storage Automation, Tips & tricks | Tagged , , , , , | Leave a comment

Short memo on COUNTIFS(), SUMIFS() and VLOOKUP() functions in MS Excel

Not using Excel very often, I sometimes have to waste my time searching Office support site for these functions in order to refresh in memory their tricky syntax and usage limitations.

Today I decided to gather everything I know about these functions in a single source to keep it at hand when using Excel or LibreOffice Calc (with minor syntax changes).

Descriptions of the lightweight versions of these functions are available on the Office support site: COUNTIF(), SUMIF(), LOOKUP(). Continue reading

Posted in Tips & tricks | Tagged , , , , , | Leave a comment

LLFD – Link, Login, Fabric, Devices

Have just prepared a brief cheat sheet to remind which processes begin when we connect an HBA with the Brocade Fiber Channel switch port, in other words, when a device joins a fabric.

LINK

  • Signal transition (light/electrical)
  • Speed negotiation
  • Character and Word synchronization
  • Link initialization primitives (transition to active state, ready to send frames)

LOGIN

  • FLOGI – Request Fabric Login port (FFFFFE) for Port ID (PID) by sending NWWN/PWWN and exchange buffer credits capabilities with the switch port. Switch populates NS with PID, NWWN/PWWN
  • PLOGI – Port Login to Name Server (FFFFFC) to be able to register information in NS
  • SCR – State Change Registration at Fabric Controller (FFFFFD) to receive Registered State Change Notifications (RSCN) on events of online/offline of the zone members. SCR is mandatory for initiators
  • NS registration – Register additional attributes in NS: Node / port names, vendor, device model, firmware and driver versions. Separate requests are done for each attribute

FABRIC

  • Initiator requests FC-addresses of zoned devices. Makes additional requests to NS to get WWNs, etc.
  • Device probe – switch probes devices for additional information to populate NS with information from targets. Typically initiators (hosts) reject probes, while targets (storage systems) accept.

DEVICES

  • Initiator sends PLOGI to zoned targets
  • Initiator sends Process Login (PRLI) to targets
  • Start SCSI transmissions

Posted in Storage | Tagged , , , , , , , , , | Leave a comment