To log checks from sensu into logstash, I use the following sensu config:
{
"handlers": {
"logstash": {
"type": "tcp",
"socket": {
"host": "logstash.example.com",
"port": 1234
[ | |
{ | |
"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 |
input { | |
pipe { | |
type => "sflow" | |
command => "/usr/local/bin/sflowtool_wrapper.sh -l -p 6343" | |
} | |
} |
To log checks from sensu into logstash, I use the following sensu config:
{
"handlers": {
"logstash": {
"type": "tcp",
"socket": {
"host": "logstash.example.com",
"port": 1234
#!/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 |