Skip to content

Instantly share code, notes, and snippets.

View marianogg9's full-sized avatar

marianogg9

View GitHub Profile
rs0:PRIMARY> rs.status()
{
"set" : "rs0",
"date" : ISODate("2017-01-13T14:34:14.190Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "primary_hostname:27017",
"health" : 1,
rs0:PRIMARY> rs.status()
{
"set" : "rs0",
"date" : ISODate("2017-01-11T20:36:56.579Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "primary_hostname:27017",
"health" : 1,
@marianogg9
marianogg9 / gist:8673758
Created January 28, 2014 18:52
/var/log/sensu/sensu-api.log
{"timestamp":"2014-01-28T18:51:23.550594+0000","level":"info","message":"GET /stash/silence/host01","remote_address":"IP","user_agent":"Ruby","request_method":"GET","request_uri":"/stash/silence/host01","request_body":""}
{"timestamp":"2014-01-28T18:51:23.557813+0000","level":"info","message":"GET /stash/silence/host01/frontend_http_check","remote_address":"IP","user_agent":"Ruby","request_method":"GET","request_uri":"/stash/silence/host01/frontend_http_check","request_body":""}
{"timestamp":"2014-01-28T18:51:23.565828+0000","level":"info","message":"GET /stash/silence/all/frontend_http_check","remote_address":"IP","user_agent":"Ruby","request_method":"GET","request_uri":"/stash/silence/all/frontend_http_check","request_body":""}
@marianogg9
marianogg9 / gist:8648489
Created January 27, 2014 13:22
/etc/sensu/handlers/sensu-handler-input-example.json
{
"client":{
"name":"host01",
"address":"10.2.1.11",
"subscriptions":[
"all",
"env_qa",
"frontend",
"proxy",
"apache"
@marianogg9
marianogg9 / gist:8648480
Created January 27, 2014 13:21
cat sensu-handler-input-example.json | ./twitter.rb
{"twitterhandle"=>{"sensusub"=>"aws", "consumer_key"=>"my_key", "consumer_secret"=>"my_secret_key", "oauth_token"=>"my_oauth_token", "oauth_token_secret"=>"my_oauth_secret"}}
@marianogg9
marianogg9 / gist:8648455
Created January 27, 2014 13:19
/etc/sensu/handler/twitter.rb
#!/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
#
@marianogg9
marianogg9 / gist:8648427
Created January 27, 2014 13:18
/etc/sensu/conf.d/twitter.json
{
"twitter": {
"twitterhandle": {
"sensusub": "aws",
"consumer_key": "my_key",
"consumer_secret": "my_secret_key",
"oauth_token": "my_oauth_token",
"oauth_token_secret": "my_oauth_token_secret"
}
}
$ curl http://localhost:4567 -d prueba.json
where localhost:4567 is my sensu-api address and prueba.json is:
{"timestamp":"2014-01-23T04:22:31.183892+0000","level":"info","message":"publishing check result","payload":{"client":"server01","check":{"name":"check_vmstat","issued":1390278111,"command":"/etc/sensu/plugins/check_ntp_time -H 0.amazon.pool.ntp.org -w 30 -c 60","handlers":["mailer-ses","mailer"],"interval":60,"occurrences":1,"refresh":1800,"flapping":true,"subscribers":["monitoring_server"],"executed":1390278145,"output":"NTP CRITICAL: No response from NTP server\n","status":2,"duration":5.702}}}
{"timestamp":"2014-01-21T17:04:46.500540+0000","level":"info","message":"GET /info","remote_address":"x.x.x.x","user_agent":null,"request_method":"GET","request_uri":"/info","request_body":""}
@marianogg9
marianogg9 / gist:8225681
Created January 2, 2014 20:01
example.json
{
"checks": {
"check_ntp": {
"handlers": [
"twitter",
"mailer-ses",
"mailer"
],
"command": "/etc/sensu/plugins/check_ntp_time -H 0.pool.ntp.org -w 30 -c 60",
"interval": 60,