GithubHelp home page GithubHelp logo

isabella232 / sensu-1.x-filter-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sensu/sensu-1.x-filter-wrapper

0.0 0.0 0.0 33 KB

Proof-of-concept ruby gRPC extension for wrapping evaluation of sensu 1.x filters in 2.x

License: MIT License

Ruby 100.00%

sensu-1.x-filter-wrapper's Introduction

Vagrant quickstart

vagrant up

This will install sensu-backend, agent, and cli, and create a handler and an extension called ruby-grpc that calls the gRPC service for filtering. The gRPC service itself is not started automatically.

Start the Ruby gRPC service

vagrant ssh -c 'cd /shim && bundle console /shim/test-filters.json'

bundle console imports the gem which in turn starts the gRPC service on port 50051. The gRPC service is defined in server.rb, and uses handlers defined in extension_server.rb. It takes one command line argument, which is the path to the 1.x filters json that's being wrapped.

Example output:

expression       :  require 'net/http'; value == nil || '200' == Net::HTTP.get_response(URI.parse(value.to_s)).code rescue false
evaluated against: http://unreachable.local
returns          : false
expression       :  require 'net/http'; value == nil || '200' == Net::HTTP.get_response(URI.parse(value.to_s)).code rescue false
evaluated against: https://www.google.com/
returns          : true

Hit Ctrl+C to stop the gRPC service.

Hack on the filter

Edit code in the filter_event method of lib/mai-ogi/extension-server.rb. Restart the gRPC service to apply changes.

Watch the backend logs

(from another console)

vagrant ssh -c 'sudo journalctl -fu sensu-backend'

gRPC handled check runs every 5 seconds.

Known issues

  • No deep merge on event attributes for filters.
  • Filter negate attribute is ignored.
  • Filter expression evaluation is NOT ran in a sandbox

sensu-1.x-filter-wrapper's People

Contributors

sinthetix avatar teekennedy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.