#!/usr/bin/perl # # iostat_gmetric: # # simple script to parse iostat output # and push the data into ganglia # # iostat -x 20 | iostat_gmetric # iostat -d 20 | iostat_gmetric # # tkimball Tue Apr 26 17:46:18 EDT 2011 use strict; use warnings; my $gmetric = '/usr/bin/gmetric'; my $gconf = '/etc/ganglia/gmond.conf'; if ( ! -x $gmetric ) { print "ERROR: Unable to execute $gmetric, exiting.\n"; exit 1; } if ( !
Today is: 8 January, 2012
Check todays hot topics
Iostat for ganglia
Unscramble script for irssi
An irssi script to automatically unscramble words and output them to a channel when an eggdrop is using the following tcl provided by egghelp dot org:
http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&id=1451
#!/usr/bin/perl use strict; use warnings; use vars qw($VERSION %IRSSI); use Irssi qw(command_bind signal_add); use HTTP::Request::Common; use LWP::UserAgent; $VERSION = '0.01'; %IRSSI = ( authors => 'Taylor Kimball', contact => 'taylor@linuxhq.org', name => 'Unscramble', description => 'Cheating', license => 'GPL', );
Patch for Alien::SVN for RPM Builds
--- inc/My/SVN/Builder.pm 2007-12-26 21:30:26.000000000 -0800 +++ inc/My/SVN/Builder.pm.tkimball 2010-03-25 12:57:02.402926000 -0700 @@ -90,7 +90,6 @@ $Config{siteprefix}; my %args = ( - prefix => $prefix, libdir => File::Spec->catdir( $self->install_destination('arch'), 'Alien', 'SVN' ), @@ -161,10 +160,10 @@ _chdir_to_svn; - $self->_run("make install-lib") + $self->_run("make install-lib DESTDIR=\$RPM_BUILD_ROOT") or do { warn "installing libs failed"; return 0 };
Card Shuffler in C
There are a lot of card shuffling examples out there, I guess to show examples of rand(). 20 minutes and some ghetto code later, here is one with card structures defined. It takes one argument, which is the number of decks you want to shuffle. Read the code to learn more.
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> struct card { char sname; char lname[12]; char suit[12]; }; char snames[14] = "A23456789TJQK\0"; char *lnames[14] = { "Ace", "Two", "Three", "Four", "Five", "Six", "Seven",
Generate DNS A/PTR Records from DHCPd config
#!/usr/bin/perl # # Genreate A/PTR records off dhcpd config # # Assumes the following layout # # host host1-vlan1 { # hardware ethernet 00:16:3e:10:11:b3; # fixed-address 10.74.17.29; # } # # host host2-vlan2 { # hardware ethernet 00:16:3e:12:ee:79; # fixed-address 10.74.17.30; # } use strict; use warnings; use constant DOMAIN => 'domain.com'; use constant LINES_BETWEEN_MATCHES => 2; my $file = '/etc/dhcpd.conf'; if (( ! -e $file ) || ( ! -r $file )) { print STDERR "Unable to read/open dhcpd config.\n";
MountedFS Plugin for Spine (http://code.ticketmaster.com)
# -*- mode: perl; cperl-continued-brace-offset: -4; indent-tabs-mode: nil; -*- # vim:shiftwidth=2:tabstop=8:expandtab:textwidth=78:softtabstop=4:ai: # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
RestartServices plugin patch for Spine (http://code.ticketmaster.com/)
--- /usr/lib/spine/Spine/Plugin/RestartServices.pm 2009-04-07 12:17:40.000000000 -0700 +++ RestartServices.pm 2009-08-18 15:29:00.000000000 -0700 @@ -48,10 +48,9 @@ { my $c = shift; my $rval = 0; + my %rshash; my $start_time = $c->getval('c_start_time'); - my $service_bin = $c->getval('service_bin'); - my $startup = $c->getvals('startup'); my $restart_deps = $c->getvals('restart_deps'); my $touch = File::Touch->new( no_create => 1 ); @@ -68,22 +67,23 @@ foreach my $entry (@{$restart_deps}) {
Nagios check for log filesizes
#!/usr/bin/perl # # This is a very simple file size checking script. It scans all files in # a specified directory for files which pass the specified thresholds. The # default notifications are 4GB for warning, and 5GB for critical. Both # the thresholds and directory can be overwritten via the command line. # # Note that bz2, gz, and pid extensions are automatically ignored. # # $Id: check_local_logs,v 1.4 2007-08-28 22:26:05 taylor Exp $ # use warnings; use strict; use File::Glob ':glob'; use File::stat; use Getopt::Long;
Netapp IOPS/NFSOPS Statisitic Gatherer
#!/usr/bin/perl # # filerops: Gather statistics on NetApp filers use strict; use warnings; use File::Basename; use Getopt::Long; sub usage { my $script = basename($0); print <<USAGE $script -f <filer> -i <minutes> <-n|-s> [-o] -f <filer> filer to gather stats from -h this elite help menu, hack the planet -i <min> interval in minutes before gathering data -n gather nfsops statistics netapp: nfsstat
DenyHosts reporting script (sshd/httpd)
#!/usr/bin/perl # # dhreport.pl: grab sshd/httpd versions from owned hosts # return ownage if possible? :) # use strict; use warnings; use File::Basename; use Getopt::Long; use IO::Socket::INET; use LWP::UserAgent; sub usage { my $script = basename($0); print <<USAGE $0 [ -f <file> -t <timeout> ] -f hosts.deny file to read from default: /etc/hosts.deny -t timeout for outbound connections default: 4 NOTE: hosts.deny file assumes 'sshd: <host>' format USAGE ; exit 0; } my $opt = {}; GetOptions( $opt,