Skip to content

Instantly share code, notes, and snippets.

View marianogg9's full-sized avatar

marianogg9

View GitHub Profile
# Rackspace NewRelic plugin
# This script keeps this service running.
start on runlevel [2345]
stop on runlevel [016]
script
pushd /opt/turner/services/newrelic/newrelic_rs_dfw
# redis-commander
#
# This service maintains redis-commander service up and running.
# Redis-commander is the Redis web console (redis.cloud-turner.com.ar).
respawn
env SSL_CERT_FILE=/etc/sensu/handlers/cacert.pem
pre-start script
"check":{
"output":"HTTP CRITICAL: HTTP/1.1 503 Service Temporarily Unavailable - pattern not found - 593 bytes in 0.001 second response time |time=0.000500s;;;0.000000 size=593B;;;0\n",
bla bla
I need to get the first text before the "|". Tried this:
def foo
@event['check']['output'].split(' | ').first
end
# Rackspace NewRelic plugin
start on runlevel [2345]
stop on runlevel [016]
pre-start script
echo '{"name": "check_respawn", "output": "newrelic_rs_dfw service respawned", "status": 2, "handlers": ["twitter"], "subscribers": "aws"}' | nc localhost 3030
end script
respawn
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test goal changed from stop to start
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test state changed from waiting to starting
Feb 11 18:59:14 ip- init: Handling starting event
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test state changed from starting to pre-start
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test pre-start process (29024)
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test pre-start process (29024) exited normally
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test state changed from pre-start to spawned
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test main process (29027)
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test state changed from spawned to post-start
Feb 11 18:59:14 ip- init: newrelic_rs_dfw_test state changed from post-start to running
Check failed to run: Connection reset by peer
tail -f /var/log/rabbitmq/rabbit\@rabbitmqserver.log
=ERROR REPORT==== 11-Feb-2014::19:46:57 ===
closing AMQP connection <0.13440.2> (my_ip -> rabbitmq_server_ip:5672):
{bad_header,<<"GET /api">>}
{
"checks": {
"check_redis-ML": {
"handlers": [ "twitter" ],
"command": "/etc/sensu/plugins/check_redis.rb -c 20 -w 10 -h redis_server -k logstash-ML",
"interval": 60,
"refresh": 120,
"flapping": false,
"subscribers": [ "server_name" ]
}
{
"handlers": {
"twitter": {
"type": "pipe",
"command": "/etc/sensu/handlers/twitter.rb"
}
}
}
{
"timestamp": "2014-02-12T14:21:39.059281+0000",
"level": "info",
"message": "handling event",
"event": {
"client": {
"name": "server",
"address": "server_ip",
"subscriptions": [
"foo",
#!/usr/bin/env /opt/sensu/embedded/bin/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
#