Skip to content

Instantly share code, notes, and snippets.

View peelman's full-sized avatar

Nick Peelman peelman

View GitHub Profile
@peelman
peelman / README.md
Last active April 14, 2020 20:03
check_juniper_ex_virtchas_count.rb

Check count of members in a Juniper virtual chassis

@peelman
peelman / ed25519-puppet-example.pp
Last active December 30, 2016 21:43
Use puppet to generate ED25519 keys (for older systems or systems that didn't get them generated automatically)
if ($::operatingsystem == 'Ubuntu') {
package { 'openssh-server' :
ensure => latest,
}
service { 'ssh':
ensure => 'running',
enable => true,
require => Package['openssh-server'],
}
@peelman
peelman / Readme.md
Created November 8, 2016 19:56
A very quick Nagios Plugin to check the overall status of an ESXi Host using rbvmomi.

Overview

This is a quick nagios plugin / script to query an ESXi server and grab the "overall status" parameter. This is a parameter each host should respond to and will reflect if any alarms are active on the system. See the official documentation for more info.

This should give notice in the event of a power supply failure, memory errors, loss of connectivity to datastore, etc.

The script only requires a Hostname, but allows for the providing of both a hostname and IP address. The hostname is required to make sure that the status being returned is for the correct host (I don't trust CIM to always return the hosts inside the "hostFolder" in the same order). It is actually used to query the API for the provided string, so it must be accurate and reflect what the system thinks its hostname is. Our environment and conditions mandated this. YMMV.

Parameters

@peelman
peelman / README.md
Created October 12, 2016 20:07
check_multiaddr.pl

A modification to the decade-old check_multiaddr perl script so that it doesn't chop off output from the called script.

#/bin/bash
IP="10.x.x.x"
#Look for number of received pings, if 0 received then restart OpenVPN service
RESULT=`ping -c 2 -W 1 $IP | grep transmitted | awk '{print $4}'`
if [ $? -ne 0 ] && [ $RESULT -eq 0 ]
then
@peelman
peelman / mac_regex.txt
Created August 17, 2016 12:15
regex for mac addresses
(([0-9a-f]{2}:){5}[0-9a-f]{2})
@peelman
peelman / pfsense-backup.sh
Created July 27, 2016 12:03
Backup pfSense firewalls remotely
#!/bin/sh
#
######################################################################################################
#
# Description:
# Backup pfSense 2.3 Firewalls to Local Disk
#
######################################################################################################
#
# Author: Nick Peelman
@peelman
peelman / README.md
Last active March 31, 2017 12:18
A quick Ruby Script to grab the weather from forecast.io and display the current real temp, current apparent temp, and current conditions in GeekTool.

Example:

/Users/peelman/.rbenv/shims/ruby ~/bin/weather.rb --lat 38.9456155 --long -85.8804469 --key da39a3ee5e6b4b0d3255bfef95601890afd80709

@peelman
peelman / puppetlabs.pp
Created July 12, 2016 12:16 — forked from garthk/puppetlabs.pp
Use Puppet to ensure Ubuntu can get the latest Puppet
class puppetlabs {
# Install Puppet repository and call apt-get update
case $operatingsystem {
ubuntu: {
$key = "4BD6EC30"
exec { 'apt-key puppetlabs':
path => "/bin:/usr/bin",
unless => "apt-key list | grep '${key}' | grep -v expired",
command => "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${key}",
}
@peelman
peelman / DashingUnifiVideo.md
Last active January 20, 2016 11:50 — forked from tracstarr/DashingUnifiVideo.md
Dashing UnifiVideo Widget

Dashing.io Widget for UnifiVideo NVR

This method uses API Key access so I suggest you setup a guest account with API access but limited (Visible and View Feed) access. Then login as the guest user, enable API access, and generate a new key. Copy the key for use.

Switch to the Devices tab and open the Configure dialog for the cam. On the Details tab, right-click the thumbnail view and Copy the image URL to the clipboard. It will look similar to the following if pasted to an address bar or text editor: http://192.168.1.105:7443//api/2.0/snapshot/camera/05a2bc63-d1ce-399f-8327-3a19b0cd3e8f?width=%d&force=true

The guid after /camera/ is what you want to use in the unifivideo.rb file.

You can setup as many cameras as you want, just add a name and UUID for each to the secrets/unifi.yml file.