Skip to content

Instantly share code, notes, and snippets.

View faxm0dem's full-sized avatar
⌨️
Typing…

Fabien Wernli faxm0dem

⌨️
Typing…
View GitHub Profile
@faxm0dem
faxm0dem / gist:f4ebf04fe2fe98b4a0c2
Created June 25, 2014 06:08
collectd-syslog_ng plugin oneliner hack
while DATE=$(date +%s); do syslog-ng-ctl stats | awk -vhost=$HOSTNAME -F\; 'NR!=1 && $1 != "src.none" {if ($2 == "") { t=$3 } else {t=$2} printf "PUTVAL %s/syslog_ng-%s/derive-%s %s:%s\n",host,t,$5,systime(),$6}'; sleep 10; done | socat - UNIX-CLIENT:/var/run/collectd/sock
@faxm0dem
faxm0dem / node
Created January 24, 2014 09:47
node.js fedora style init script
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="node"
@faxm0dem
faxm0dem / gist:7928492
Last active December 31, 2015 03:38 — forked from mayhem/gist:7928414
{
"order" : 0,
"template" : "*stash-*",
"mappings" : {
"properties" : {
"useragent" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
@faxm0dem
faxm0dem / gist:4714159
Created February 5, 2013 12:26
collectd-5.2.1 buildperl
diff -ur collectd-5.2.0.ori/bindings/Makefile.am collectd-5.2.0/bindings/Makefile.am
--- collectd-5.2.0.ori/bindings/Makefile.am 2012-11-17 23:23:21.000000000 +0100
+++ collectd-5.2.0/bindings/Makefile.am 2012-11-20 13:54:11.000000000 +0100
@@ -48,7 +48,7 @@
buildperl/Makefile: .perl-directory-stamp buildperl/Makefile.PL \\
$(top_builddir)/config.status
- cd buildperl && @PERL@ Makefile.PL INSTALL_BASE=$(DESTDIR)$(prefix) @PERL_BINDINGS_OPTIONS@
+ cd buildperl && @PERL@ Makefile.PL @PERL_BINDINGS_OPTIONS@
@faxm0dem
faxm0dem / gist:4343759
Created December 20, 2012 08:19
Plugin df
LoadPlugin df
<Plugin df>
MountPoint "/afs"
MountPoint "/"
MountPoint "/boot"
MountPoint "/usr"
MountPoint "/var/core"
FSType "nfs"
FSType "tmpfs"
@faxm0dem
faxm0dem / gist:4109897
Created November 19, 2012 09:53
INSTALLDIRS
# apparently combining INSTALL_BASE and INSTALLDIRS doesn't work (as with PREFIX+INSTALLDIRS):
# pwd
/tmp/pff/collectd-5.2.0/bindings/perl
# perl Makefile.PL PREFIX=/tmp/test INSTALLDIRS=vendor
Writing Makefile for Collectd
# make install
Skip blib/lib/Collectd/Plugins/OpenVZ.pm (unchanged)
Skip blib/lib/Collectd/Unixsock.pm (unchanged)
Skip blib/lib/Collectd/Plugins/Monitorus.pm (unchanged)
Skip blib/lib/Collectd.pm (unchanged)
@faxm0dem
faxm0dem / gist:4088110
Created November 16, 2012 15:18
urxvt insecure font size
@1353079018/~(0)$ a=$(printf '\e]710;?\a')
@1353079038/~(0)$ echo $a | xxd
0000000: 1b5d 3731 303b 3f07 0a .]710;?..
@1353079046/~(0)$ $a
bash: $'\E]710;?\a': command not found
@1353079049/~(0)$
@faxm0dem
faxm0dem / gist:4059786
Created November 12, 2012 14:43
collectd unquote filter
<Chain PreCache>
<Rule unquote>
<Match regex>
Plugin "^GenericJMX$"
</Match>
<Target replace>
PluginInstance "\"" ""
</Target>
</Rule>
</Chain>
@faxm0dem
faxm0dem / gist:4025272
Created November 6, 2012 15:05
collectd ipmi chain
LoadPlugin "target_set"
<Chain "PreCache">
<Rule "ipmi_temperature">
<Match "regex">
Plugin "^ipmi$"
Type "^temperature$"
TypeInstance "(FCB Ambient1|Dom A FP Temp system_board|Ambient Temp system_board)"
</Match>
<Target "set">
@faxm0dem
faxm0dem / gist:3812144
Created October 1, 2012 14:33
log::contextual
# Setup Logger (source: L<Log::Contextual/LOGGER CODEREF>
my @caller_info;
my $logref = sub {
chomp($_[0]);
warn "$_[0] at $caller_info[1] line $caller_info[2].\\n"
};
my $var_log = Log::Contextual::SimpleLogger->new({
levels_upto => LEVEL->[$opt->verbose],
coderef => $logref,
});