Skip to content

Instantly share code, notes, and snippets.

View cwjohnston's full-sized avatar

Cameron Johnston cwjohnston

View GitHub Profile
@cwjohnston
cwjohnston / Requirements.md
Last active October 17, 2017 17:57
Minimum Viable Sensu with Vagrant

In order to complete the Minimum Viable Sensu workshop on your own computer, please install the following:

With these applications installed, and the Vagrantfile copied an otherwise empty directory, run vagrant up to download the required Vagrant box and start the VM.

Once the box file is downloaded and the VM is running, use vagrant ssh to log in to the VM via ssh.

@cwjohnston
cwjohnston / gist:7912e34174888d0cf275911e3a82601f
Created May 9, 2017 17:44
this check definition should raise a validation error as the interval is not an integer
[root@localhost vagrant]# cat /etc/sensu/conf.d/check_fail.json | jq .
{
"checks": {
"check-memory-percent": {
"command": "check-memory-percent.rb -w :::memory.warning|70::: -c :::memory.critical|80:::",
"subscribers": [
"ALL",
" data-server",
"Gitlab",
"Kennedy",
@cwjohnston
cwjohnston / rubocop-offenses-count.txt
Created March 20, 2017 17:01
Rubocop offenses summary for Sensu as of 0.29-pre
76 Lint/ShadowingOuterLocalVariable
49 Lint/UnusedBlockArgument
38 Style/ColonMethodCall
34 Style/Documentation
30 Style/AlignParameters
19 Style/IfUnlessModifier
18 Metrics/PerceivedComplexity
17 Style/GuardClause
16 Style/DotPosition
14 Style/PreferredHashMethods
$ curl -s http://repositories.sensuapp.org/yum/6/x86_64/repodata/repomd.xml | md5
c4db553efa8fc62df16d61bd86582491
$ curl -s http://core.sensuapp.com/yum/6/x86_64/repodata/repomd.xml | md5
db91796d3a3d8f25e8f2829ba961e6e2
{"timestamp":"2017-01-17T20:04:16.796000+0000","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/relay.json"}
{"timestamp":"2017-01-17T20:04:16.796000+0000","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/relay.json","changes":{"handlers":{"relay":[null,{"type":"tcp","socket":{"host":"127.0.0.1","port":3002}}]}}}
@cwjohnston
cwjohnston / api_result.txt
Created December 7, 2016 22:49
redaction example
$ curl -s localhost:4567/results/ec2-35-165-186-85/check_redaction_test | jq .
{
"check": {
"type": "standard",
"status": 0,
"interval": 30,
"command": "echo :::custom_secret_stuff.password::: > /dev/null",
"standalone": true,
"name": "check_redaction_test",
"issued": 1481150815,
EXTENSION_DIR=/etc/sensu/extensions
PLUGINS_DIR=/etc/sensu/plugins
HANDLERS_DIR=/etc/sensu/handlers
PATH=/opt/sensu/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sensu/plugins:/etc/sensu/handlers
GEM_PATH=/opt/sensu/embedded/lib/ruby/gems/2.3.0
LOG_LEVEL=warn
@cwjohnston
cwjohnston / bash.sh
Last active October 4, 2016 16:16
test_check_result.json
echo '{
"handler": "mailer-ses",
"enable_deprecated_filtering": false,
"output": "this is only a test",
"name": "test_check_result",
"command": "a command which should have succeeded but instead has failed",
"status": 2
}' | nc localhost 3030
{
"checks": {
"disk_check": {
"type": "metric",
"command": "check-disk-usage.rb -w 0 -c 0",
"subscribers": [
"servers"
],
"interval": 10,
"handler": "mailer-ses",
@cwjohnston
cwjohnston / list_plugins.sh
Last active August 11, 2017 15:27
checks in need of sensu-plugin dependency update, by order of number of downloads
sensu-plugins-snmp
sensu-plugins-chrony
sensu-plugins-eventstore
sensu-plugins-rancher-service
sensu-plugins-influxdb-q
sensu-plugins-megaraid
sensu-plugins-cpu-usage
sensu-plugins-docker-checks
sensu-plugins-monit
sensu-plugins-uptime