Skip to content

Instantly share code, notes, and snippets.

View smbambling's full-sized avatar

Steven Bambling smbambling

View GitHub Profile
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@smbambling
smbambling / command_chech.sh
Created July 7, 2017 12:41
Bash Script using a function to test to make sure commands are available. Allows to test for multiple versions of a command
#!/usr/bin/env bash
cmd_list=(
"virtualenv-2.7 virtualenv-2.5 virtualenv"
"docker docker.io"
)
# Function to check if referenced command exists
cmd_exists() {
if [ $# -eq 0 ]; then
######################################################################
######################################################################
# Managed by Puppet
#
# NOTE: Changes made to this file will be
# overwritten during the next update, default: 30 min
######################################################################
######################################################################
# Bash only checks the first word of a command for an alias,
#!/usr/bin/env bash
for item; do
entries=$(dig ${item} +short ANY)
if [ -z "${entries}" ]; then
echo -e "No A or AAAA entries returned for ${item}"
else
for entry in ${entries}; do
reverse_entry=$(dig +short -x "${entry}")
if [ -z "${reverse_entry}" ]; then

SNMP Tips

Loading MIBs

Net-SNMP loads MIBs from two locations by default :

$HOME/.snmp/mibs
/usr/local/share/snmp/mibs
#!/bin/sh
# This file is managed by Puppet.
# Any changes will be lost.
# This is the rsync script to manage <%= @repository %>
# Logging
DATE=`/bin/date +%Y-%m-%d`
CONFFILE='/etc/yum.repos.d/<%= @repository -%>.repo'
OUTDIR='<%= @log_directory %>'
[ -d $OUTDIR ] || mkdir -p $OUTDIR
# == Overview: Configure the Master Mirror for a site
#
# == Requirements: N/A
#
# == Monitoring: Apache
#
# == Notes:
#
# The repositories will be pulled down based off a hash for all crons.
#
## Snippet from puppet agent run
Debug: Prefetching puppetserver_gem resources for package
Debug: Executing: '/opt/puppetlabs/bin/puppetserver gem list --local'
Debug: Executing: '/opt/puppetlabs/bin/puppetserver gem list --local ^deep_merge$'
Debug: Executing: '/opt/puppetlabs/bin/puppetserver gem install --no-rdoc --no-ri deep_merge'
Error: Could not install: ERROR: Could not find a valid gem 'deep_merge' (>= 0) in any repository
Error: /Stage[main]/Hiera::Deep_merge/Hiera::Install[deep_merge]/Package[puppetserver deep_merge]/ensure: change from absent to present failed: Could not install: ERROR: Could not find a valid gem 'deep_merge' (>= 0) in any repository
postgresql::server::role { 'marmot':
password_hash => 'foobar',
}
Error: /Stage[main]/Profile::Postgresql/Postgresql::Server::Role[marmot]/Postgresql_psql[CREATE ROLE "marmot" ENCRYPTED PASSWORD 'foobar' LOGIN NOCREATEROLE NOCREATEDB NOSUPERUSER CONNECTION LIMIT -1]: Could not evaluate: undefined method `exitcode' for [" 0\n\n", #<Process::Status: pid 8127 exit 0>]:Array
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/vendor/rgen/lib/rgen/array_extensions.rb:25:in `method_missing'
/vagrant/puppet/environments/dev/modules/postgresql/lib/puppet/type/postgresql_psql.rb:41:in `matches'
/vagrant/puppet/environments/dev/modules/postgresql/lib/puppet/type/postgresql_psql.rb:92:in `should_run_sql'
/vagrant/puppet/environments/dev/modules/postgresql/lib/puppet/type/postgresql_psql.rb:16:in `retrieve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1072:in `block in retrieve'
#!/usr/bin/env python
# Requirements:
# - request module ( sudo yum install python-requests )
# - slacker ( sudo pip install slacker)
# * https://github.com/os/slacker
# Suppress Deprecation Warning....because...python 2.6 is old
import warnings