Skip to content

Instantly share code, notes, and snippets.

gcp-compliance ➤ cat controls/example.rb
describe google_compute_instance(project: 'my-proj', zone: 'us-east1-b', name: 'inspec-test') do
it { should exist }
its('name') { should eq 'inspec-test' }
its('machine_type') { should eq 'f1-micro' }
its('cpu_platform') { should match 'Intel' }
its('status') { should eq 'RUNNING' }
end
gcp-compliance ➤ cat inspec.yml
@gpendler
gpendler / gist:4722190
Last active December 12, 2015 05:28
Rabbitmq HA issues
[greg@hop ~]$ ssh eventmq01 sudo /usr/sbin/rabbitmqctl cluster_status
Cluster status of node rabbit@eventmq01 ...
[{nodes,[{disc,[rabbit@eventmq01]},{ram,[rabbit@eventmq02]}]},
{running_nodes,[rabbit@eventmq02,rabbit@eventmq01]},
{partitions,[]}]
...done.
[greg@hop ~]$ ssh eventmq02 sudo /usr/sbin/rabbitmqctl cluster_status
Cluster status of node rabbit@eventmq02 ...
[{nodes,[{disc,[rabbit@eventmq01]},{ram,[rabbit@eventmq02]}]},
{running_nodes,[rabbit@eventmq01,rabbit@eventmq02]},
{"version"=>"0.9.8-1", "rabbitmq"=>{"host"=>"sensu.XXXXXX.com", "port"=>5671, "ssl"=>{"cert_chain_file"=>"/etc/sensu/ssl/cert.pem", "private_key_file"=>"/etc/sensu/ssl/key.pem"}, "vhost"=>"/sensu", "user"=>"sensu", "password"=>"XXXX", "heartbeat"=>20}, "redis"=>{"host"=>"localhost", "port"=>6379}, "api"=>{"host"=>"localhost", "port"=>4567}, "dashboard"=>{"host"=>"localhost", "port"=>8080, "user"=>"admin", "password"=>"XXXX"}, "client"=>{"name"=>"sensu.XXXX.com", "address"=>"10.X.XX.21", "subscriptions"=>["Base", "Redis", "SensuServer"]}, "checks"=>{"chef_client"=>{"notification"=>"Chef client daemon is not running.", "interval"=>60, "custom_attribute_here"=>"value", "subscribers"=>["sensu_client", "Base"], "command"=>"/etc/sensu/plugins/check-procs.rb -p chef-client -W 1 -w 2 -c 3"}, "disk_usage"=>{"notification"=>"Disk usage is too high.", "interval"=>60, "subscribers"=>["Base"], "command"=>"/etc/sensu/plugins/check-disk.rb -w 90 -c 95 -x nfs,tmpfs,fuse -i /boot,/mnt/data_imports"}, "redis_memory"=>{"notific
[root@sensu handlers]# cat /tmp/data | /etc/sensu/handlers/mailer.rb
Loading precompiled parsers from ruby source
/etc/sensu/handlers/mailer.rb:27:in `handle': undefined method `[]' for nil:NilClass (NoMethodError)
from /opt/sensu/embedded/lib/ruby/gems/1.9.1/gems/sensu-plugin-0.1.5/lib/sensu-handler.rb:41:in `block in <class:Handler>'
[root@sensu handlers]# more mailer.json
{
"mailer": {
"mail_from": "sensu@XXX.com",
"mail_to": "greg@XXXX.com",
"smtp_address": "localhost",
"smtp_port": "25",
"smtp_domain": "XXXX.com"
}
}
{
"version": "0.9.8-1",
"rabbitmq": {
"host": "sensu.XXXX.com",
"port": 5671,
"ssl": {
"cert_chain_file": "/etc/sensu/ssl/cert.pem",
"private_key_file": "/etc/sensu/ssl/key.pem"
},
"vhost": "/sensu",
@gpendler
gpendler / knife
Created July 27, 2012 19:47 — forked from nukemberg/knife.sh
bash completion for Chef's knife command (updated for 0.10)
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab:
# Author: Avishai Ish-Shalom <avishai@fewbytes.com>
# We need to specify GNU sed for OS X, BSDs, etc.
if [[ "$(uname -s)" == "Darwin" ]]; then
SED=gsed
else
SED=sed
fi