Giter VIP home page Giter VIP logo

sensu-go's Introduction

Sensu Go

CircleCI: CircleCI Build Status

Sensu is an open source monitoring tool for ephemeral infrastructure and distributed applications. It is an agent based monitoring system with built-in auto-discovery, making it very well-suited for cloud environments. Sensu uses service checks to monitor service health and collect telemetry data. It also has a number of well defined APIs for configuration, external data input, and to provide access to Sensu's data. Sensu is extremely extensible and is commonly referred to as "the monitoring router".

To learn more about Sensu, please visit the website and read the documentation.

What is Sensu Go?

Sensu Go is a complete rewrite of Sensu in Go, with new capabilities and reduced operational overhead. It eliminates several sources of friction for new and experienced Sensu users.

The original Sensu required external services like Redis or RabbitMQ. Sensu Go can rely on an embedded etcd datastore for persistence, making the product easier to get started with. External etcd services can also be used, in the event that you already have them deployed.

Sensu Go replaces Ruby expressions with JavaScript filter expressions, by embedding a JavaScript interpreter.

Unlike the original Sensu, Sensu Go events are always handled, unless explicitly filtered.

Installation

Sensu Go installer packages are available for a number of computing platforms (e.g. Debian/Ubuntu, RHEL/Centos, etc), but the easiest way to get started is with the official Docker image, sensu/sensu.

See the installation documentation to get started with one of Sensu's supported packages.

NOTE: Starting with Sensu Go version 6.0, for instances built from source, the web UI is now a standalone product — it is no longer included with the Sensu backend. To build the web UI from source, use the installation instructions in the Sensu Go Web repository.

Building from source

The various components of Sensu Go can be manually built from this repository. You will first need Go >= 1.18 installed. Then, you should clone this repository outside of the GOPATH since Sensu Go uses Go Modules:

$ git clone https://github.com/sensu/sensu-go.git
$ cd sensu-go

To compile and then run Sensu Go within a single step:

$ go run ./cmd/sensu-agent
$ go run ./cmd/sensu-backend
$ go run ./cmd/sensuctl

To build Sensu Go binaries and save them into the bin/ directory:

$ go build -o bin/sensu-agent ./cmd/sensu-agent
$ go build -o bin/sensu-backend ./cmd/sensu-backend
$ go build -o bin/sensuctl ./cmd/sensuctl

To build Sensu Go binaries with the version information:

# sensu-agent
$ go build -ldflags '-X "github.com/sensu/sensu-go/version.Version=5.14.0" -X "github.com/sensu/sensu-go/version.BuildDate=2019-10-08" -X "github.com/sensu/sensu-go/version.BuildSHA='`git rev-parse HEAD`'"' -o bin/sensu-agent ./cmd/sensu-agent

# sensu-backend
$ go build -ldflags '-X "github.com/sensu/sensu-go/version.Version=5.14.0" -X "github.com/sensu/sensu-go/version.BuildDate=2019-10-08" -X "github.com/sensu/sensu-go/version.BuildSHA='`git rev-parse HEAD`'"' -o bin/sensu-backend ./cmd/sensu-backend

# sensuctl
$ go build -ldflags '-X "github.com/sensu/sensu-go/version.Version=5.14.0" -X "github.com/sensu/sensu-go/version.BuildDate=2019-10-08" -X "github.com/sensu/sensu-go/version.BuildSHA='`git rev-parse HEAD`'"' -o bin/sensuctl ./cmd/sensuctl

Contributing

For guidelines on how to contribute to this project, how to hack on Sensu, and information about what we require from project contributors, please see CONTRIBUTING.md.

Sensu is and always will be open source, and we continue to highly value community contribution. The packages we’re releasing for new versions are from our Enterprise repo; Sensu Go is the upstream for Sensu Enterprise (as they’d say in the Go community: Sensu Go is vendored into the Sensu Enterprise Go repo). We encourage you to download new versions, as the functionality will be identical to what you find in the public repo, and access to the enterprise-only features can be unlocked with a license key. Because these releases are in our Enterprise repo, there may be times that you don’t see the actual work being done on an issue you open, but that doesn’t mean we’re not working on it! Our team is committed to updating progress on open issues in the sensu-go repo, even if that work is being done in our Enterprise repo.

sensu-go's People

Contributors

10xjs avatar agm650 avatar amdprophet avatar apaskulin avatar arnaldomf avatar c-kruse avatar ccressent avatar dabria avatar echlebek avatar fguimond avatar gbolo avatar grepory avatar hillaryfraley avatar jadiunr avatar jamesdphillips avatar mcorbin avatar mercul3s avatar mjiderhamn avatar nixwiz avatar obfuscurity avatar palourde avatar portertech avatar preed avatar realpy avatar roganartu avatar tarcinil avatar teekennedy avatar treydock avatar vooon avatar wesleycyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sensu-go's Issues

Agent StatsD listener

The Sensu agent needs to accept Sensu events and telemetry data.

Initial ideas include:

  • HTTP /events (with basic authentication or full RBAC?)
  • TCP line protocol (utilize the websocket protocol? Do we need this?)
  • Statsd TCP/UDP listeners (the only protocol that doesn't use the Sensu event structure)

Refactor HTTP API

  • Add test coverage for every router endpoint
  • Conform to Daemon spec (apid)
  • Split router endpoints up into separate files

Create sensu-cli

The Sensu CLI needs to "modes" of operation:

  • Invoked as a single command with several arguments
  • Interactive - prompting for user input
  • Accept JSON via STDIN (with support for legacy configuration translation when needed)

Raw examples (ideas):

$sensu-cli ACTION THING
$sensu-cli create check -n foobar -i 60 -s webserver,api -c 'check-http.rb -u https://localhost/health'
$sensu-cli create check 
What is the name of the check?
foobar
...
$cat some.json | sensu-cli import

The CLI tool will eventually need to handle authentication and authorization. For now we can no-op.

backend cleanup

backend.go is getting out of control.

  • Refactor transport.Server
    • websocket listener moved into it
    • configuration for listener port, etc.
    • Start()/Err() pattern applied to it
    • Monitor Err() in backend Run()
  • Error handling in backend.Run()
    • Fix not-often hit race on errChan
    • Separate channel for receiving errors from monitored processes / returning an error via Err()
    • Figure out how to prevent send to closed errChan that isn't tedious

Add Windows to builds

  • update unit tests that are Linux platform specific (e.g. write binary replacement for cat)

Backend processes should conform to an interface

Right now we have several backend processes, and they all sort of conform to the same interface that looks a little like:

type Daemon interface {
    Start() error
    Stop() error
    Err() <-chan error
    Status() bool
}

Make things actually adhere to this interface.

Sensu Type validators

The Sensu Type Validate() functions need to be improved, for example, they should use regular expressions to validate certain field string values (e.g. name).

The current Sensu Settings validators can be used as a reference. Sensu Go doesn't currently implement many features of Ruby Sensu and therefor doesn't have certain fields, they can be left out for the time being.

Sensu Settings check validator: https://github.com/sensu/sensu-settings/blob/master/lib/sensu/settings/validators/check.rb#L179

TODO

  • Update types/* Validate() functions

Implement basic API /mutators & /handlers endpoints

This work will lay the foundations for the traditional Sensu pipeline configuration.

  • store.go mutators
  • http_api.go mutators
  • store.go handlers
  • http_api.go handlers

See #40 for example implementation.

We may need to refactor http_api.go, splitting up/out the endpoints.

Agent entity system facts

The Sensu agent needs to discover some facts about its system and publish them in keepalives (tags).

Facts to send:

  • hostname
  • network interfaces (more than one address)
  • os
  • platform
  • platform family
  • platform version
  • uptime

Could use a library like:

https://github.com/shirou/gopsutil

Sensu event pipe handler

depends on:

#8

  • determine if an event indicates an incident or metric
  • fork/exec a pipe handler command and write the JSON event data to child process STDIN
  • capture and log pipe handler command STDOUT

WizardBus should not serialize/deserialize in-memory messages

The current MessageBus interface should be replaced as such:

// MessageBus is the interface to the internal messaging system. It must be
// safe to be used by multiple goroutines.
type MessageBus interface {
	daemon.Daemon

	// Subscribe allows a consumer to subscribe to a topic,
	// binding a read-only channel to the topic. Topic messages
	// are delivered to the channel as simple byte arrays. Consumers should
	// use type assertions to convert the incoming messages to a pointer to an
	// appropriate value.
	Subscribe(topic string, consumer string, channel chan<- interface{}) error

	// Unsubscribe allows a consumer to unsubscribe from a topic,
	// removing its read-only channel from the topic's bindings.
	// The channel is not closed, as it may still having other
	// topic bindings.
	Unsubscribe(topic string, consumer string) error

	// Publish sends a message to a topic. Publishers should be sure to pass by
	// reference as this is intended to be used by multiple goroutines.
	Publish(topic string, message interface{}) error
}```

Improve test coverage and tooling

  • Measure and track coverage
  • Improve general coverage until we are comfortable
  • Store "fake" (mix of fixtures and mock)
  • Apply benchmark utility to another component

Finalize configuration file format

The Sensu Go agent and backend services will support configuration via several means, by command arguments, environment variables, and a SINGLE configuration file. We have yet to declare what the configuration file format is.

Some possible formats:

  • TOML
  • JSON
  • YAML

Me must keep in mind "custom" nested configuration options (attributes).

One we settle on a configuration file format, the Sensu Go services must be updated to support it (if necessary).

Discuss: multitenancy & RBAC

We are fast approaching the time we MUST introduce some level of authentication and authorization (RBAC). RBAC applies to agent -> backend connections and every Sensu API query (e.g. CLI or dashboard).

We need to look at how others have implemented such capabilities, i.e. Hosted Chef platform.

Chef uses node environment and API resources as the basis for RBAC, we could do something similar with the addition of agent/check subscriptions. This would allow a Sensu backend cluster to be shared by several groups within an organization, allowing certain agents and users access to one or more environments and API resources.

Create list of UI technologies

This issue serves the purpose of collecting/creating a list of our favourite UI technologies.

To add to the list, please comment on this issue.

embedded NSQ

  • Run an embedded NSQ process within sensu-backend

Create list of favourite UIs

This issue serves the purpose of collecting/creating a list of our favourite user interfaces.

To add to the list, please comment on this issue.

Standardize logging

Using log.println all over the place is pretty crumby. Also, etcd has its own logger. We should standardize on structured logging and get everything logging in the same way.

agent keepalives

  • create agent keepalive data
  • agent keepalive interval timer
  • agent keepalive publishing
  • backend keepalive consumer

Dockerfile

  • sensu-backend
  • sensu-agent

Expose cli arguments and ENV variables.

sensu check execution

  • api post /checks
  • backend check request interval timers
  • backend check request publishing
  • agent check request consumer
  • agent check execution
  • agent event publishing
  • backend event consumer
  • api get /events/:entity/:check ?

Rework testing fixtures

I want us to move to an Interface + Mock methodology for unit testing. So instead of having an in-memory fixture store that's incapable of easily simulating all interactions with a Store (i.e. simulating error cases is brittle and/or non-trivial), I'd like us to move back to the mock store that was there before + testify.mock behavior simulation in faked methods per test. (We can develop some reusable faked methods if this ends up being super copypasta).

The key being that the mock should simulate behavio

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.