Skip to content

Instantly share code, notes, and snippets.

@scr512
scr512 / send_user_quota_to_carbon.py
Created August 7, 2013 20:19
Send Isilon user quota data to Graphite
#!/usr/bin/env python
# Title: send_user_quota_to_carbon.py
# Version: 1.0
# Author: Jason Davis
# Date: 08/07/2013
# Purpose: Send Isilon user quota usage details to Graphite for visualization
# Notes:
# This was inspired by the work of "tjhartmann" https://github.com/tjhartmann/ilmn_scripts/blob/master/graphite/ifs_quotas.py
# This in intended to be executed on single node in cluster via cron. Tested with OneFS 6.5.5.x.
# This should also work on OneFS 7.x with slight modification of the isi quota command.
@scr512
scr512 / send_directory_quota_to_carbon.py
Last active December 23, 2015 07:28
Exports Isilon directory quota information as XML, parses through it and sends the data to Graphite.
#!/usr/bin/env/python
# Version: 2.0
# Author: Jason Davis
# Date: 11/2/2014
# Changes:
# Replacing "/" with "_" as a delimiter was kinda a bad idea. Using "." which is more standard with Graphite metric naming.
# That last logic change was kinda crudely implemented. We shouldn't assume that each quota has a hard threshold and assign a value of 0.
# Added some logic to account for "NoneType" hard thresholds. This is typically seen in quotas being impelemented for accounting purposes only.
# Purpose: Send Isilon directory quota usage details to Graphite for visualization
# Notes:
@scr512
scr512 / send_to_dashing.sh
Created September 17, 2013 21:56
Send Isilon disk usage and cluster status from node to Dashing dashboard via ghetto BASH JSON PUT.
#!/bin/zsh
hdd=$(isi status | grep 'Used:' | awk '{print$3}' | tr -d '()%')
clu_health=$(isi statistics query -nall --stats=cluster.health | grep average | awk '{print$2}')
/usr/local/bin/wget -O- --post-data='{ "auth_token": "mysecrettokenring", "value": "'"$hdd"'" }' --header=Content-Type:application/json "http://10.112.88.114:3030/widgets/aus-hdd"
if [ $clu_health -eq 0 ]
then
/usr/local/bin/wget -O- --post-data='{ "auth_token": "mysecrettokenring", "text": "Healthy", "background-color": "#12DE4F" }' --header=Content-Type:application/json "http://10.112.88.114:3030/widgets/aus-health"
else
/usr/local/bin/wget -O- --post-data='{ "auth_token": "mysecrettokenring", "text": "Attention", "background-color": "#DE4C12" }' --header=Content-Type:application/json "http://10.112.88.114:3030/widgets/aus-health"
fi
@scr512
scr512 / meter.coffee
Created September 18, 2013 15:46
Modified meter.coffee to allow for custom background color via JSON PUT.
class Dashing.Meter extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
constructor: ->
super
@observe 'value', (value) ->
$(@node).find(".meter").val(value).trigger('change')
ready: ->
@scr512
scr512 / netapp_health.rb
Created September 18, 2013 15:51
Dashing job using SNMP queries to get a NetApp filer's general health.
require 'snmp'
NetApp_DataO = Array.new
SNMP::Manager.open(:Host => 'netapp-filer.local', :Version => :SNMPv1, :Community => 'public') do |manager|
manager.load_module("NETAPP-MIB")
response = manager.get(["miscGlobalStatus.0",
"miscGlobalStatusMessage.0"])
response.each_varbind do |varbind|
NetApp_DataO.push(varbind.value.to_s)
end
@scr512
scr512 / send_heat_to_dashing.sh
Last active December 29, 2015 00:59
Send isi statistics heat to Dashing list widget
#!/bin/zsh
#Send top 10 results of isi statistics heat ordered by pathname to Dashing
heat=($(isi statistics heat --nodes=all --pathdepth=6 --totalby=Path | head -16 | grep ifs | awk '{print $5,$1}' | egrep -v ".ifsvar" | sed 's,/ifs/,/,g' | xargs))
heat_array=($heat)
/usr/local/bin/wget -O- --post-data='{ "auth_token": "<your auth token>", "items": [{ "label": "'"$heat_array[1]"'", "value": "'"$heat_array[2]"'" }, { "label": "'"$heat_array[3]"'", "value": "'"$heat_array[4]"'" }, { "label": "'"$heat_array[5]"'", "value": "'"$heat_array[6]"'" }, { "label": "'"$heat_array[7]"'", "value": "'"$heat_array[8]"'" }, { "label": "'"$heat_array[9]"'", "value": "'"$heat_array[10]"'" }, { "label": "'"$heat_array[11]"'", "value": "'"$heat_array[12]"'" }, { "label": "'"$heat_array[13]"'", "value": "'"$heat_array[14]"'" }, { "label": "'"$heat_array[15]"'", "value": "'"$heat_array[16]"'" }, { "label": "'"$heat_array[17]"'", "value": "'"$heat_array[18]"'" }, { "label": "'"$heat_array[19]"'", "value": "'"$heat_array[20]"'" } ]
@scr512
scr512 / gist:8832480
Created February 5, 2014 20:36
duTree.py
#!python
#
# Disk space usage displayed as a tree - duTree.py
#
# Run program without arguments to see its usage.
import string, sys, os, getopt
from os.path import *
boolStrings = ['off', 'on']
@scr512
scr512 / send_to_dashing.sh
Last active August 29, 2015 14:00
send_to_dashing.sh (NAHPC)
#!/bin/zsh
#Stats->Dashing
#08/22/14 Added in some uh... logic to account for column number changes when a disk pool is in an 'ATTN' state
#07/23/14 Commented out the heat stuff as heat is expensive to run on a large cluster
hdd=$(isi_classic status -d | grep 'Used:' | awk '{print$3}' | tr -d '()%')
ssd=$(isi_classic status -d | grep 'Used:' | awk '{print$5}' | tr -d '()%')
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$hdd"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-hdd"
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$ssd"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-ssd"
@scr512
scr512 / send_stats_to_carbon.sh
Last active June 9, 2019 05:49
Send Isilon stats to Graphite (Carbon) and to Dashing instance
#!/bin/zsh
#Stats->Graphite
#10/27/16 Added boot wear monitoring. Removed Dashing stuff.
#02/27/16 Added username specific latency and operation collection. Pushing this data to both Graphite and Dashing
#03/29/15 Added in more accurate tracking of tier capacity via diskpools_to_json.py
#09/24/14 Added in queries for SmartPool capacity tracking
#08/22/14 Added in NFSv3 latency stats
#Let's first look and see if we have a stuck execution of the script. If the lock is older than 3 minutes we'll kill the PID and cleanup the lock.
find /tmp/send_stats_to_carbon.lck -mmin +3 -exec kill -9 `cat /tmp/send_stats_to_carbon.lck` {} \;
@scr512
scr512 / send_directory_quota_to_carbon_json.py
Created February 27, 2016 05:55
Sending directory quotas from the Isilon directly to a Graphite (carbon) instance
#!/usr/bin/env python
#Notes
#This is a little hacky given that you can't calculate a utilization percentage on a quota with no hard-threshold. The "hack" is to set the hard value from 0 to 1.
#Also I'm abusing the fact that if you give Graphite a unix timestamp of 0 then it just straight up drops the metric.
import os
import sys
import time
import json
from subprocess import Popen,PIPE
from socket import socket