Skip to content

Instantly share code, notes, and snippets.

View nstielau's full-sized avatar

Nick Stielau nstielau

  • Red Hat
  • San Francisco
View GitHub Profile
@nstielau
nstielau / client.sh
Created September 27, 2012 23:22
Sensu Push Example
echo '{
"handlers": ["debug"],
"name": "push_woot_test",
"output": "woot!",
"status": 0
}' | nc -w1 127.0.0.1 3030
Executing 'journalctl --no-pager -a MESSAGE_ID=72395a954c4e4449921c42a5faab671c --since=-10minutes' Match: -- Logs begin at Thu 2016-03-03 02:42:33 UTC, end at Thu 2016-03-17 19:39:37 UTC. -- Ignoring: -- Logs begin at Thu 2016-03-03 02:42:33 UTC, end at Thu 2016-03-17 19:39:37 UTC. -- Match: Mar 17 19:32:20 endpoint091c557c.xhios.panth.io chef_solo_slow_converge[14314]: Orphaned binding detected: b517d0d6ad3d45f4b5eeba63be6f454a, this will cause slow convergence to eventually back up. Match: Mar 17 19:33:11 endpointac9c557c.xhios.panth.io chef_solo_slow_converge[14314]: Orphaned binding detected: 473199549e5844f097ae750c299837ec, this will cause slow convergence to eventually back up. CheckJournal WARNING: 2 matches found for .* in `journalctl --no-pager -a MESSAGE_ID=71395a954c4e4449921c42a5faab671c --since=-10minutes` (threshold 1)
CheckJournal WARNING: 2 matches found for Orphaned binding in journal (warn 1/crit 10)
Orphaned binding detected: a417d0d6ad3d45f4b5eeba63be6f454a, this will cause slow convergence to eventually back up.
Orphaned binding detected: 473199549e5844f097ae750c299837ec, this will cause slow convergence to eventually back up.
@nstielau
nstielau / packer_fedora_bounty.md
Last active December 26, 2015 05:49
Packer for Fedora Vagrant box

WANTED: Automated Fedora Vagrant Box Creation

Deliverables

  • Public Github Repo with Packer VirtualBox templates for Fedora 19, 20
  • Script capable of creating box, testing, and uploading to S3 on success (to be run via CI)
  • Bare-bones Vagrantfile example

Box Requirements

@nstielau
nstielau / check-load-debug.rb
Last active December 26, 2015 05:39
check_load.rb with debugging output
#!/usr/bin/env ruby
#
# Check Linux system load
# ===
#
# Copyright 2012 Sonian, Inc <chefs@sonian.net>
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
@nstielau
nstielau / I_exit_clean.coffee
Created May 23, 2013 18:31
Coffeescript zero exit status snippet
# For some reason, coffee appears to exit with
# non-zero status (1) when it recieves a SIGTERM
# by default. This doesn't play nice with process
# managers like systemd. This simple two-liner
# will allow your coffee scripts to exit cleanly.
process.on 'SIGTERM', ->
process.exit()
@nstielau
nstielau / config.json
Last active December 17, 2015 08:08
Check syntax for triggering remediation (publish:false) actions. If occurrences is 1 or 2, and the severity is 1 (warning), the light_remediation will be triggered. If occurrences is 3 through 10, and the severity is 1 (warning), the medium_remediation will be triggered. If occurrences is above 2, and the severity is 2 (critical), the heavy_reme…
{
"handlers": {
"remediator": {
"type": "pipe",
"command": "/etc/sensu/handlers/remediator.rb"
},
},
"checks": {
"fail_with_remediation": {
"command": "/bin/false",
@nstielau
nstielau / queue_checks.json
Created March 6, 2013 11:47
Example Sensu check, which only alerts after 10 failures on a 60 second interval, and won't alert on nights or weekends.
{
"checks": {
"noisy_queue_check": {
"handler": "default",
"command": "/etc/sensu/plugins/check-queue-length.rb",
"interval": 60,
"refresh": 60,
"occurrences": 10,
"subscribers": [ "workers" ],
"subdue" : {
@nstielau
nstielau / execute_insecure.rb
Last active December 10, 2015 18:48
Chef Symlink Vector Example
execute "say_hello_to_bob" do
command "echo 'hello again' >> /home/bob/hello.txt"
end
@nstielau
nstielau / gist:3373649
Created August 16, 2012 21:03
Remove an unreachable node from Cassandra via JMX
wget http://jmxsh.googlecode.com/files/jmxsh-R5.jar
java -jar jmxsh-R*.jar -h localhost -p 7199
% [Hit Enter to go into Browse Mode]
Select a domain: [Enter number for org.apache.cassandra.net]
Select an mbean: [Enter number for org.apache.cassandra.net:type=Gossiper]
Select an attribute or operation: [Enter number for unsafeAssassinateEndpoint(String p1)]
p1 (String): [Enter IP address of problem node]
It may also be possible to run it directly (untested):
% jmx_invoke -m org.apache.cassandra.net:type=Gossiper unsafeAssassinateEndpoint <STALE-IP-ADDRESS>