Skip to content

Instantly share code, notes, and snippets.

View mattyjones's full-sized avatar

Matt Jones mattyjones

  • Northeast-US
View GitHub Profile
@mattyjones
mattyjones / python_over_ssh
Last active November 16, 2020 16:20
Execute a script located on a remote server over ssh using python
#! /usr/bin/env python
import secure
import pexpect
# the file containing the list of servers to log into
input_file = "script_list"
# The login creds
user = secure.USER
@mattyjones
mattyjones / email_threshold_check.py
Last active August 29, 2015 14:00
Parse a logfile in realtime for an email storm
#! /usr/bin/env python
'''
email_throttle.py
Matt Jones [email protected]
Created 04.23.14
Last Update 05.05.14
Notes:
@mattyjones
mattyjones / email_threshold.conf
Created May 8, 2014 15:11
This is an sec rulle file to help prevent an email storm with Icinga/Nagios caused by excessive notifications.
type=SingleWithThreshold
ptype=RegExp
pattern=dsn=(\d+)\.(\d+)\.(\d+)
context=maillog_tripped
desc=$0
action=shellcmd shutdown -h now
window=10
thresh=2
type=SingleWithThreshold
@mattyjones
mattyjones / email_throttle2.conf
Created May 12, 2014 14:24
This is an sec rulle file to help prevent an email storm with Icinga/Nagios caused by excessive notifications.
type=SingleWithThreshold
ptype=RegExp
pattern=test
desc=$0
action=eval %e {'[email protected]'} ; \
eval %c {'/var/spool/icinga/cmd/icinga.cmd'} ; \
pipe 'The email threshold was tripped at %t /n Stopping the sendmil service' /bin/mail -s "Email Storm Alert" %e ; \
shellcmd /usr/bin/printf "[%%lu] DISABLE_NOTIFICATIONS" %u > %c
window=60
thresh=25
@mattyjones
mattyjones / groups.md
Last active August 29, 2015 14:04
Icinga 1x Core Configuration File Written In Markdown

Icinga Groups Configuration File

Dependency Servicegroups

Details:

The groups are used to set dependency conditions environment wide. Details on specific dependencies can be found in dependencies.md

Example:

Sensu-Plugins Development Environment

Components

  • Chef
  • Vagrant
  • GIR

Chef

#!/bin/bash +e
#
# DevOps - Auto-generated by Chef for XXX
#
# /etc/init.d/sensu-graceful-shutdown
# Subsystem for notifying the sensu server that a graceful shutdown has been initiated
#
# chkconfig: 12345 05 05
# description: Notify the sensu server that a graceful shutdown has been initiated
#

Ingredients

  • 2lb turkey burger
  • 5 Green Peppers cleaned
  • 1 Sweet Onion diced
  • 1/2c BBQ sauce
  • 2c cooked brown rice

Prep