Skip to content

Instantly share code, notes, and snippets.

View englishm's full-sized avatar
🎯
Focusing

Mike English englishm

🎯
Focusing
View GitHub Profile
@englishm
englishm / _.md
Created October 26, 2012 03:42
just another inlet to tributary
s = TCPSocket.new("zabbixserver", 10051)
s.write message.to_s
response_header = s.recv(5)
if not response_header == "ZBXD\1"
puts "response: #{response_header}"
raise 'Got invalid response'
end
response_data_header = s.recv(8)
response_length = response_data_header[0,4].unpack("i")[0]
response_raw = s.recv(response_length)
@englishm
englishm / gist:3946902
Created October 24, 2012 15:54
zabbix send message builder
require 'json'
msg = {
"request" => "sender data",
"data" => [
{
"host" => "myappserver",
"key" => "mydata",
"value" => "1",
}]
...
host_list=(<%= wemux_hosts %>)
...
@englishm
englishm / init.pp
Created September 4, 2012 20:20
wemux module manifest
class wemux($wemux_hosts = 'foobar'){
package{"epel-release":
provider => rpm,
source => "http://linux.mirrors.es.net/fedora-epel/6/i386/epel-release-6-7.noarch.rpm",
ensure => installed,
}
package{"tmux":
ensure => installed,
require => Package["epel-release"],
}
class{"wemux":
wemux_hosts => "vagrant"
}
@englishm
englishm / site.pp
Created September 4, 2012 19:10
Yuck.
exec{"configure-wemux":
command => "/bin/sed -i -e 's/change_this/vagrant/g' /usr/local/etc/wemux.conf && touch /etc/wemux-configured",
creates => "/etc/wemux-configured",
require => Exec["cp-wemux-conf"],
}
exec{"clone-wemux-repo":
command => "/usr/bin/git clone git://github.com/zolrath/wemux.git /usr/local/share/wemux",
creates => "/usr/local/share/wemux",
}
exec{"symlink-wemux-into-path":
command => "/bin/ln -s /usr/local/share/wemux/wemux /usr/local/bin/wemux",
creates => "/usr/local/bin/wemux",
}
exec{"install-tmux":
command => "/usr/bin/yum install -y tmux",
creates => "/usr/bin/tmux",
require => Exec["install-epel"],
}
[vagrant@localhost ~]$ rvmsudo puppet apply /etc/puppet/site.pp
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
notice: /Stage[main]//Exec[install-tmux]/returns: executed successfully
notice: Finished catalog run in 18.55 seconds
[vagrant@localhost ~]$