Skip to content

Instantly share code, notes, and snippets.

View marianogg9's full-sized avatar

marianogg9

View GitHub Profile
#!/usr/bin/env ruby
require 'newrelic_plugin'
require 'getoptlong'
unless $:.include?(File.dirname(__FILE__) + '/../lib/')
$: << File.dirname(__FILE__) + '/../lib'
end
def usage
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs main process (7672) terminated with status 127
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs main process ended, respawning
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs state changed from running to stopping
Feb 5 15:53:10 ip-172-30-1-9 init: Handling stopping event
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs state changed from stopping to killed
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs state changed from killed to post-stop
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs state changed from post-stop to starting
Feb 5 15:53:10 ip-172-30-1-9 init: Handling starting event
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs state changed from starting to pre-start
Feb 5 15:53:10 ip-172-30-1-9 init: newrelic_rs state changed from pre-start to spawned
/path/sensu-handler.rb:88:in `+': no implicit conversion of nil into String (TypeError)
from /path/sensu-handler.rb:88:in `filter_silenced'
from /path/sensu-handler.rb:22:in `filter'
from /path/sensu-handler.rb:40:in `block in <class:Handler>'
{
"timestamp": "2014-02-05T20:12:53.694593+0000",
"level": "info",
"message": "publishing check result",
"payload": {
"client": "server",
"check": {
"name": "check_load",
"issued": 1391631173,
"command": "/path/check_load -w :::c :::load.crit:::",
#!/usr/bin/env /path/ruby
#
# Sensu Twitter Handler
# ===
#
# This handler reports alerts to a configured twitter handler.
# Map a twitter handle to a sensusub value in the twitter.json to get going!
# sensusub == subscription in the client object, not check..
# see twitter.json for required values
#
# Rackspace NewRelic plugin
# This script keeps this service running.
expect fork
start on runlevel [2345]
stop on runlevel [016]
pre-start script
echo '{"name": "service_respawned", "output": "newrelic_rs_dfw service respawned", "status": 2}' | nc localhost 3030
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 state changed from starting to pre-start
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 state changed from pre-start to spawned
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 main process (28341)
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 main process (28341) executable changed
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 main process (28341) executable changed
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 main process (28341) terminated with status 1
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 main process ended, respawning
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 state changed from spawned to post-start
Feb 6 12:06:22 ip-172-30-1-9 init: newrelic_rs_dfw_1 state changed from post-start to running
Feb 6 12:06:22 ip-172-30-1-9 init: Handling started event
{
"checks": {
"check_respawn": {
"handlers": "twitter",
"standalone": true,
"suscribers": "aws"
}
}
}
# Rackspace NewRelic plugin
start on runlevel [2345]
stop on runlevel [016]
#script
#chdir /path/newrelic/newrelic_rs_dfw
#echo "DEBUG: `set`" >> /tmp/myjob.log
{"timestamp":"2014-02-06T17:18:41.237559+0000","level":"info","message":"handling event","event":{"client":{"name":"host","address":"ip","subscriptions":["aws","monitoring_server"],"load":{"warn":"3","crit":"4"},"disk_free":{"warn":"15%","crit":"10%"},"mem_used":{"warn":"90","crit":"95"},"list_count":{"warn":"9000","crit":"10000"},"redis_key":{"value":"logstash"},"timestamp":1391707113},"check":{"name":"check_respawn","output":"Redis-commander service respawned","status":2,"issued":1391707121,"history":["0","2","0","2","2","0","2","0","2","0","2","2","2","0","2","2","0","2","0","2","2"]},"occurrences":2,"action":"create"},"handler":{"type":"pipe","command":"true","name":"default"}}