Skip to content

Instantly share code, notes, and snippets.

@mbrownnycnyc
mbrownnycnyc / icinga-reporting
Created August 23, 2012 15:08
jasper for icinga-reporting
#!/bin/bash
#
# chkconfig: 345 85 15
# description: init script to handle tomcat and postgres with jasperserver, relying on the packaged scripts for logic.
#branded on freenode
#mbrownnyc everywhere else
# http://mbrownnyc.wordpress.com/technology-solutions/reliability-monitoring-solution/implement-icinga-on-centos6-with-selinux/
#
JASPERCTLSCRIPT="/opt/jasperreports-server-cp-4.5.0/ctlscript.sh "
@mbrownnycnyc
mbrownnycnyc / splunk
Created August 27, 2012 14:16
splunk init script
#!/bin/bash
#
# chkconfig: 345 85 15
# description: init script to splunk
# mbrownnyc on freenode, etc
# http://mbrownnyc.wordpress.com/technology-solutions/reliability-monitoring-solution/implement-splunk-on-centos6-with-selinux/
#
SPLUNKBIN="/opt/splunk/bin/splunk"
@mbrownnycnyc
mbrownnycnyc / generic-trap.cfg
Created August 28, 2012 20:17
generic-trap icinga/nagios definition
define service{
name generic-trap
service_description snmp_traps
is_volatile 1
check_command check_dummy!0
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
active_checks_enabled 0
passive_checks_enabled 1
@mbrownnycnyc
mbrownnycnyc / ex-service.cfg
Created August 30, 2012 20:30
Example service to be used with generic-trap
define service{
host_name SERVERNAME
use generic-trap
contact_groups admins
}
@mbrownnycnyc
mbrownnycnyc / snmptrap_service.cfg
Created August 31, 2012 20:45
an example snmptrap_service.cfg that can be used with snmptrap_template.cfg
define service{
host_name SERVER1
use generic-trap
contact_groups admins
}
define service{
host_name SERVER2
use generic-trap
contact_groups admins
@mbrownnycnyc
mbrownnycnyc / ldaphelper.py
Last active December 10, 2015 15:19
from http://www.packtpub.com/article/python-ldap-applications-ldap-opearations [not totally implemented or tested: to_ldif() doesn't function ?]
import ldif, sys
from StringIO import StringIO
from ldap.cidict import cidict
def get_search_results(results):
#Given a set of results, return a list of LDAPSearchResult objects.
res = []
if type(results) == tuple and len(results) == 2 :
(code, arr) = results
@mbrownnycnyc
mbrownnycnyc / ldap_resmodel.py
Last active December 10, 2015 15:39
a resource model script for use with rundeck, queries an active directory ldap server and returns a resource model in XML form ( http://rundeck.org/docs/manpages/man5/resource-v13.html ). Supports LDAPS via START TLS. Not sure if I followed the documented conventions for resource model plugin scripts.
#! /usr/bin/python
# ex: python ldap_resmodel.py -q -u mbrown@domain.local -p 'password_with_a_trailing_backslash\' -b 'OU=Child OU,DC=domain,DC=local' -f
# see python ldap_resmodel.py -h
#this is written to support python 2.6
# on EL, must yum -y install python-ldap
# you must create /usr/lib/python2.*/ldaphelper.py from https://gist.github.com/raw/4453803/ (see http://www.packtpub.com/article/python-ldap-applications-ldap-opearations)
# curl https://gist.github.com/raw/4453803/ > /usr/lib/python2.6/ldaphelper.py
@mbrownnycnyc
mbrownnycnyc / mtp
Last active December 14, 2015 16:49
Quick and dirty VBscript to audit and delete Media Transfer Protocol device drivers from Windows registry. Combine this with `schtask /ru ""` to schedule a task local or remotely. This would be used in conjunction with a written policy (which is punishable). Device white-listing mechanisms are always the best.
Const HKEY_LOCAL_MACHINE = &H80000002
Dim oReg : Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Dim oShell : Set oShell = CreateObject("WScript.Shell")
Dim sPath, aSub, sKey, aSubToo, sKeyToo, dwValue
sPath = "SYSTEM\CurrentControlSet\Enum\USB"
oReg.EnumKey HKEY_LOCAL_MACHINE, sPath, aSub
'in one level
For Each sKey In aSub
@mbrownnycnyc
mbrownnycnyc / dns.cs
Created March 25, 2013 18:49
beginnings of a fully exposed dns class for c#
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MACE_DataCollector_wrapper
@mbrownnycnyc
mbrownnycnyc / disable_ports.vbs
Created March 27, 2013 12:19
vbscript wrapper for devcon to disable a given list of devices (older script_
'on error resume next
Set objShell = CreateObject("WScript.Shell")
DeviceEnabledList = ""
DEVCONEXEC = ""
Main()
wscript.quit
Function Main()