Skip to content

Instantly share code, notes, and snippets.

View skamithi's full-sized avatar

Stanley Karunditu skamithi

  • Raleigh, North Carolina
View GitHub Profile
[
{
"driver_hwmon": [
"fan1"
],
"min": 7200,
"cpld_path": "/sys/bus/platform/devices/dell_s6000_cpld.0",
"0": "ok",
"state": "OK",
"prev_state": "OK",
#! /usr/bin/env ruby
# encoding: UTF-8
#
# check-environmentals
#
# DESCRIPTION:
# Send a Warning message if an environmental sensor is
# more than the warning threshold.
# Send a critical message if sensor is beyond critical threshold.
# Event is sent on first match. So if multiple environmental sensors
#!/bin/bash
#
# Wrapper script for sflowtool when used in pipe input in logstash.
# This wrapper script ensures that the sflowtool is not running prior to start of the sflowtool.
ARGS="$@"
SFLOWTOOL_PID=$(/bin/ps -ef | /bin/grep "/usr/bin/sflowtool $ARGS" | /bin/grep -v "grep" | /bin/awk ' { print $2 } ')
if [ ! -z $SFLOWTOOL_PID ]; then
kill -s 9 $SFLOWTOOL_PID
@skamithi
skamithi / logstash-input-sflowtool
Created December 4, 2015 05:07 — forked from whiskeyalpharomeo/logstash-input-sflowtool
Logstash Input for sFlowtool
input {
pipe {
type => "sflow"
command => "/usr/local/bin/sflowtool_wrapper.sh -l -p 6343"
}
}
@skamithi
skamithi / gist:0f4ce3568fb2a764d03a
Created November 22, 2015 23:42 — forked from mrichar1/gist:a433240cbe142f101e69
Logging events from sensu to logstash

To log checks from sensu into logstash, I use the following sensu config:

{
  "handlers": {
    "logstash": {
      "type": "tcp",
      "socket": {
        "host": "logstash.example.com",
        "port": 1234
@skamithi
skamithi / gist:6735507
Created September 27, 2013 21:34 — forked from jof/gist:1281122
#!/usr/bin/env ruby
require 'getoptlong'
require 'rubygems'
require 'snmp'
SNMP_COMMUNITY = 'public'
HOSTNAME_BLACKLIST = [ "that_one_switch_thats_down_but_in_dns" ]
ZONE_FILE = /path/to/dns/zone/file
HOSTNAME_REGEX = /^\s?(switch[0-9]+)/i
# The IP Address Validator accepts the following options
#
# * allow_nil - allows nil values
# * allow_blank - allows blank values
# * allow_cidr - allows /prefixlen CIDR masks in values
#
# the validator will use regular expressions in an attempt to prevent
# malformed IP addresses from being passed to the IPAddr.new initializer
# as this method can be very slow to raise exceptions for malformed input.
class IpAddressValidator < ActiveModel::EachValidator