Skip to content

Instantly share code, notes, and snippets.

View jspaleta's full-sized avatar
🥌
🥌 🥌 🥌 🥌

Jef Spaleta jspaleta

🥌
🥌 🥌 🥌 🥌
View GitHub Profile
@jspaleta
jspaleta / simple_proxy_example
Created June 17, 2018 18:29
simple_sensu_proxy_check_example
Very simple staticly defined sensu proxy check using ping command.
source attribute value be used in the check result to replace the client name.
replace <<HOST>> with hostname want
{
"checks": {
"ping-<<HOST>>": {
"command": "ping <<HOST>>",
"subscribers": [
"ping-proxy"
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /usr/share/nginx/html;
# enable ssl encryption
ssl on;
ssl_certificate /etc/ssl/certs/nginx-proxy-selfsigned.crt;
@jspaleta
jspaleta / sensu_sudo_remediate.md
Last active March 28, 2019 19:32
Using sudo with sensu user for Sensu Go handlers

1. Setup sudoer using visudo on system hosting sensu-go backend

sudo visudo

2. Add sudo directives to allow sensu group to use a command without password

Ex: control nginx service

### Allow sensu group to control nginx service without requiring a password
%sensu ALL=NOPASSWD:/usr/bin/systemctl stop  nginx.service
%sensu ALL=NOPASSWD:/usr/bin/systemctl stop  nginx
@jspaleta
jspaleta / sensu_go_ruby_assets_in_containers.md
Last active April 19, 2019 22:43
Quick Start for Sensu Ruby Plugin Checks in Sensu Go Agent containers using Sensu Assets

Quick Start

Setup Sensu Containers

Start Sensu Backend Container

docker run -v /tmp/sensu:/var/lib/sensu -d --name sensu-backend -p 2380:2380 -p 3000:3000 -p 8080:8080 -p 8081:8081 sensu/sensu:latest sensu-backend start

Note 1: this will mount your hosts /tmp/sensu directory into the container's /var/lib/sensu. Replace the host directory as needed for your environment. I use /tmp/sensu here to make it easy to clean up and get back to an unconfigured state.

Note 2: The sensu-backend service exposes all necessary ports to the local host so that you can interact with it as if it were running as a local service instead of a container.

@jspaleta
jspaleta / namespace-RBAC-setup.yaml
Last active June 26, 2020 18:38
Generic Sensu Namespace RBAC Configuration
---
type: Namespace
api_version: core/v2
metadata: {}
spec:
name: <<namespace>>
---
type: Role
api_version: core/v2
metadata:
@jspaleta
jspaleta / asset_example
Last active June 18, 2019 22:02
Multiple Build Asset Strawman
---
type: Asset
api_version: core/v2
metadata:
name: jspaleta/monitoring-plugins
namespace: default
spec:
# Existing attributes -> added as build entry for backwards compatibility
sha512: asdasdas
url: http/what.up/asset.tar.gz
@jspaleta
jspaleta / ruby-runtime-asset-notes.txt
Created August 20, 2019 21:22
Steps to test ruby-runtime-asset in multiple containers
Build asset tarball place in staging directory
include test script in staging directory
include additional asset tarballs for test into staging directory
run test script on target os container mount staging directory
Test script functionality:
unpack asset tarball(s)
set PATH and LD_LIBRARY_PATH to mimick asset environment
run test check
look for errors
@jspaleta
jspaleta / check_status_as_metric.sh
Created August 29, 2019 00:08
Sensu Check Status to Metric Mutator
#!/bin/sh
#
# check_status_as_metric.sh
# optionally set measurement, field
# Ex:
# check_status_as_metric.sh measurement="${entity_name}" field="${check_name}.status"
#
event=$(cat /dev/stdin)
@jspaleta
jspaleta / exec_start_pre.conf
Created October 11, 2019 22:13
Populate Sensu Agent Name from EC2 metadata
# Extend the sensu-agent service init to call the update_name.sh script
# place this file in: /etc/systemd/system/sensu-agent.service.d
# With systemd you don't have to edit the vendor provided service init script.
# local admins can extend/override vendor settings by using correctly named extension directory structures
# Ex: /etc/systemd/system/sensu-agent.service.d/
# This .d directory will be parsed for systemd directives to extend/override the vendor supplied sensu-agent.service
# For now all we want to do is add an ExecStartPre directive,
@jspaleta
jspaleta / system-profile-linux-dashboard.json
Created November 4, 2019 06:00
Linux System Profile Metrics Example Dashboard
{
"__inputs": [
{
"name": "DS_INFLUXDB",
"label": "InfluxDB",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}