Skip to content

Instantly share code, notes, and snippets.

View hanynowsky's full-sized avatar
💭
I may be slow to respond.

Hanynowsky hanynowsky

💭
I may be slow to respond.
View GitHub Profile
from __future__ import print_function
from snimpy.manager import Manager as M
from snimpy.manager import load
from snimpy.snmp import SNMPNoSuchInstance
#import pymysql
# Load up SNMP MIBs
@hanynowsky
hanynowsky / main.yml
Last active August 29, 2015 14:24 — forked from rothgar/main.yml
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
#!/usr/bin/env ruby
require 'snmp'
#include SNMP
require 'logger'
require 'sensu-plugin/check/cli'
# Usage: Import specific MIB modules into the snmp gem mib folder
# - : Import specific MIB modules into the snmp gem mib folder
# - : Performs some SNMP Checks
# Pastebin aRuOeLwi
sensu::client_custom:
page: false
grafana_url: "http://dashboards.guesswho.com/grafana/#/dashboard/db/system-overview?var-server=%{::hostname}"
processorcount: %{::processorcount}
memorysize: %{::memorysize}
lsbdistdescription: %{::lsbdistdescription}
kernelrelease: %{::kernelrelease}
is_virtual: %{::is_virtual}
guesswho_seclayer: %{::guesswho_seclayer}
#!/usr/bin/env ruby
require 'snmp'
#include SNMP
require 'logger'
require 'sensu-plugin/check/cli'
# Author: Hanynowsky
# Usage:
# - : Performs some SNMP Checks
#!/opt/sensu/embedded/bin/ruby
require 'snmp'
require 'pp'
include SNMP
if ARGV.empty? then
puts "Please pass the MIB you want to import"
exit 1
end
@hanynowsky
hanynowsky / gist:41de7e55ad60b1258fa1
Created February 20, 2016 16:35 — forked from Buzer/gist:262da357c24907a1d05d
Sensu bridge extension to Flapjack
# Sends events to Flapjack for notification routing. See http://flapjack.io/
#
# This extension requires Flapjack >= 0.8.7 and Sensu >= 0.13.1
#
# In order for Flapjack to keep its entities up to date, it is necssary to set
# metric to "true" for each check that is using the flapjack handler extension.
#
# Here is an example of what the Sensu configuration for flapjack should
# look like, assuming your Flapjack's redis service is running on the
# same machine as the Sensu server:
# Sends events to Flapjack for notification routing. See http://flapjack.io/
#
# This extension requires Flapjack >= 0.8.7 and Sensu >= 0.13.1
#
# In order for Flapjack to keep its entities up to date, it is necssary to set
# metric to "true" for each check that is using the flapjack handler extension.
#
# Here is an example of what the Sensu configuration for flapjack should
# look like, assuming your Flapjack's redis service is running on the
# same machine as the Sensu server:
@hanynowsky
hanynowsky / pantheon-check-ping-endpionts.rb
Created March 11, 2016 16:30 — forked from joemiller/pantheon-check-ping-endpionts.rb
a meta-check for sensu that creates many other checks
#!/usr/bin/env ruby
#
# this is a special meta-check. It runs ping checks against all hosts in
# the /endpoints API and sends individual results directly to sensu-client via
# the udp/3030 client socket. this is different from the normal sensu check model
# where individual scripts run and their exit status and output is used to create
# a single event.
#
# the reason for this check is to be able to dynamically ping a list of hosts
# without the race conditions and timing issues involved with creating individual
@hanynowsky
hanynowsky / stash_slack_integration.md
Created April 26, 2016 09:05 — forked from molaschi/stash_slack_integration.md
Integrate Stash with Slack using webhooks

This is a short article on how we integrate stash and slack in openmind

First of all i assume you have:

  • a working stash installation
  • a repository you to notify slack on pushes
  • stash user with administration priviledges
  • full access to the server (linux) where stash is installed on
  • a team configured on slack
  • slack user with administration priviledges