Skip to content

Instantly share code, notes, and snippets.

View donjohnson's full-sized avatar

Don Johnson donjohnson

View GitHub Profile
$ ./configure
[...]
checking for strchr... yes
checking for strrchr... yes
checking for memcpy... yes
checking for memmove... yes
checking for strcmp... yes
checking for closedir... yes
checking for opendir... yes
checking for readdir... yes
@donjohnson
donjohnson / gist:1271244
Created October 7, 2011 20:10
puppet scope/graph issue
this server gets the "mco" class from the node script definition.
class mco{
include virtual::packages::mco
#etc
}
there is then a "virtual" (name) module, mostly for virtual resources, with a packages.pp:
class virtual::packages {
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule ^/.* - [E=downgrade-1.0:1]
RewriteRule ^/.* - [L,E=force-response-1.0:1]
</IfModule>
@donjohnson
donjohnson / gist:1350003
Created November 9, 2011 01:22
splunk :(
[root@vm-splunk01.sf ~]# export SPLUNK_HOME="/opt/splunk"
[root@vm-splunk01.sf ~]# $SPLUNK_HOME/bin/splunk help commands
ERROR: pid 24401 terminated with signal 6
Splunk is not running, and it must be for this operation. To start splunk, run "splunk start".
[root@vm-splunk01.sf ~]# $SPLUNK_HOME/bin/splunk help
ERROR: pid 24411 terminated with signal 6
Splunk is not running, and it must be for this operation. To start splunk, run "splunk start".
[root@vm-splunk01.sf ~]# $SPLUNK_HOME/bin/splunk
Not enough arguments. Please specify a valid command from this list:
curl -d 'track=#BlackFriday' -uUSER:PASS -s -o - https://stream.twitter.com/1/statuses/filter.json | perl -mJSON -e '$|++; my $json = new JSON; while (<>) {m/\{/ or next ; my $json_text = $json->allow_nonref->utf8->relaxed->decode($_) ; $i++ ; print "\@" . $json_text->{user}{screen_name} . " " . $json_text->{text} . "\n";}'
$source = "puppet:///modules/sitefiles/ipmiserver/"
$conserver_files = ['/etc/conserver.cf', '/etc/conserver.passwd', '/etc/console.cf']
file { $conserver_files:
source => "$source/$name", #<---would like to use $name here
ensure => present,
require => Package['conserver'],
}
#!/bin/bash
#TODO: actual callouts
### BEGIN LOCKING CODE
### The following non-reinvented wheel is from http://wiki.bash-hackers.org/howto/mutex.
# lock dirs/files
LOCKDIR="/tmp/statsgen-lock"
PIDFILE="${LOCKDIR}/PID"
[usr]$ time /opt/ruby/bin/puppet -V
2.7.13
real 0m0.525s
user 0m0.423s
sys 0m0.096s
[usr]$ time /opt/ruby/bin/ruby -v
ruby 1.9.3p194 (2012-04-20) [x86_64-linux]
real 0m0.006s
@donjohnson
donjohnson / gist:2513850
Created April 27, 2012 22:15
mysql slow query log to opentsdb using maatkit/percona query digester
pt-query-digest mysql.slow.log --no-report --filter 'print "put mysql.slowqueries $event->{timestamp} $event->{Query_time} query_md5=" . make_checksum($event->{fingerprint}) . " host=$event->{host} db=$event->{db} dbuser=$event->{user}\n"'|nc opentsdb 4242
format:
put mysql.slow.query 1335559893 1.889435 query_md5=AECBE3F75D62FCA4 host=api1 db=prod dbuser=app
[root@ps7.p ~]# date;puppet agent --onetime --test --noop
Thu May 3 01:16:16 EDT 2012
info: Caching catalog for ps7.p
info: Applying configuration version '1336022164'
notice: Finished catalog run in 0.10 seconds
[root@ps7.p ~]# date;puppet agent --onetime --test --noop
Thu May 3 01:16:19 EDT 2012
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template sitefiles/motd/default: Could not find value for 'ys_catalog_version' at 7:/etc/puppet/modules/site/sitefiles/templates/motd/default at /etc/puppet/modules/dist/motd/manifests/init.pp:6 on node ps7.p
warning: Not using cache on failed catalog