This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/sensu/embedded/bin/ruby | |
require 'rubygems' if RUBY_VERSION < '1.9.0' | |
require 'sensu-plugin/check/cli' | |
require 'net/http' | |
require 'json' | |
# Scenario: you are shipping logs to the ES cluster and you want periodically look for errors | |
# the script will run any query and count the occurences, with the flags -c (critical) and -w (warning) you can trigger SENSU alarms | |
# the following example will look for Fatal errors occurred between 017-02-12 and 017-02-12 and raise a critical alert if at least one is found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# No Frills script with basic dependencies | |
# | |
require 'rubygems' if RUBY_VERSION < '1.9.0' | |
require 'sensu-plugin/check/cli' | |
require 'socket' | |
require 'timeout' | |
class PingRedis < Sensu::Plugin::Check::CLI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This yaml formated config file handles setting | |
## logger information. The values that are necessary to be set | |
## are seen at the bottom. The top '_log' are only used to remove | |
## redundency in a syslog and fallback-to-file case. | |
## | |
## The 'log_cfgs' entry defines a list of logger configs | |
## Each entry in the list is tried, and the first one that | |
## works is used. If a log_cfg list entry is an array, it will | |
## be joined with '\n'. | |
_log: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.5 | |
LABEL type=proxy-in | |
MAINTAINER Zerolatency - Mauro Rappa | |
RUN apk --update --no-cache add lua luarocks gcc make lua-dev musl-dev openssl | |
RUN luarocks-5.1 install copas | |
# remove fairness in copas client handling | |
RUN sed -i 's/90/0/' /usr/local/share/lua/5.1/copas.lua | |
RUN wget -O proxy-in.lua https://gist.githubusercontent.com/maurorappa/0e92df25be62bbb48535a5e0c8a8b965/raw/feb4bc8e4b8fddb41e16410ce85f9eada9f06833/proxy-in.lua | |
CMD ["lua","proxy-in.lua","*:8080","127.0.0.1:80"] | |
EXPOSE 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:latest | |
MAINTAINER The CentOS Project <[email protected]> | |
LABEL Vendor="CentOS" | |
RUN yum -y install sensu erlang rabbitmq-server redis | |
# rename sample config | |
RUN mv /etc/sensu/config.json.example /etc/sensu/config.json | |
# setup rabbitmq | |
RUN echo $HOSTNAME && /etc/init.d/rabbitmq-server start && rabbitmqctl add_vhost /sensu && rabbitmqctl add_user sensu sensu && rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*" | |
#start all services | |
ENTRYPOINT redis-server --daemonize yes && /etc/init.d/rabbitmq-server start && /etc/init.d/sensu-server start && /etc/init.d/sensu-api start && /etc/init.d/sensu-client start && bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ # cat r.lua | |
local f = io.open('/dev/random',"rb") | |
while true do | |
local content = f:read(16) | |
local time = os.date() | |
print(time .. " : " ..content) | |
end | |
[root@localhost ~]# lua r.lua |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have two artemis goodies: | |
1) to see how many messages went in the broker | |
curl -s http://$BROKER_IP:8161/jolokia/read/org.apache.activemq.artemis:brokerName=\%22default\%22,module=JMS,name=*,serviceType=Queue,type=Broker/MessagesAdded,MessageCount,Name%7Cjq '.[]' | awk '/MessagesAdded/ { sum+=$2}END {print sum}' | |
you run before and after the test and you know how much c**p flew around | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'time' | |
require 'yaml' | |
require 'json' | |
require "net/http" | |
require "uri" | |
# Variables | |
dryrun = ARGV[0] | |
verbose = ARGV[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//simple usage go run dns_scraper.go -h=0.uk.pool.ntp.org -s=3 | |
import ( | |
"flag" | |
"fmt" | |
"github.com/bogdanovich/dns_resolver" | |
"io/ioutil" | |
"math/rand" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script generates flowlog stats for the local traffic | |
package main | |
import ( | |
"fmt" | |
"github.com/google/gopacket" | |
"github.com/google/gopacket/layers" | |
"github.com/google/gopacket/pcap" | |
"log" |