sm

package module
v0.0.0-...-97c9760 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2018 License: MIT Imports: 22 Imported by: 0

README

sm - SEV Manager

Build Status CodeCov Go Report Card GoDoc Sourcegraph

A simple SEV Manager (Site Event Management) that lets you create and communicate real-time information for critical infrastructure events brining all communication, tracking and resolution in once place.

Status: Early alpha stages, in heavy development.

Features

  • Simple HTTP API
  • Simple command-line client
  • UNIX friendly

Install

$ go install github.com/prologic/sm/...

Usage

Run the sm daemon/server:

$ sm -d
INFO[0000] sm 0.0.1-dev (HEAD) listening on 0.0.0.0:8000

...

License

sm is licensed under the MIT License

Documentation

Index

Constants

View Source
const (
	// Default SEV Level
	DefaultSEVLevel = 3
)

Variables

View Source
var (
	// Version release version
	Version = "0.0.1"

	// Build will be overwritten automatically by the build system
	Build = "dev"

	// GitCommit will be overwritten automatically by the build system
	GitCommit = "HEAD"
)
View Source
var DefObjectives = map[float64]float64{
	0.50: 0.05,
	0.90: 0.01,
	0.95: 0.005,
	0.99: 0.001,
}

DefObjectives ...

View Source
var (
	ErrNotExist = errors.New("key does not exist")
)

Functions

func FullVersion

func FullVersion() string

FullVersion returns the full version, build and commit hash

func SafeParseInt

func SafeParseInt(s string, d int) int

SafeParseInt ...

func SafeParseUint64

func SafeParseUint64(s string, d uint64) uint64

SafeParseUint64 ...

Types

type BoltStore

type BoltStore struct {
	// contains filtered or unexported fields
}

func (*BoltStore) All

func (store *BoltStore) All() (events []*Event, err error)

func (*BoltStore) Close

func (store *BoltStore) Close() error

func (*BoltStore) Find

func (store *BoltStore) Find(ids ...ID) (events []*Event, err error)

func (*BoltStore) Get

func (store *BoltStore) Get(id ID) (*Event, error)

func (*BoltStore) NextId

func (store *BoltStore) NextId() ID

func (*BoltStore) Save

func (store *BoltStore) Save(event *Event) error

func (*BoltStore) Search

func (store *BoltStore) Search(q string) (events []*Event, err error)

type Event

type Event struct {
	sync.RWMutex

	ID            ID        `json:"id"`
	Title         string    `json:"title"`
	Summary       string    `json:"summary"`
	RootCause     string    `json:"root_cause"`
	AffectedAreas []string  `json:"affected_areas"`
	Tags          []string  `json:"tags"`
	Level         int       `json:"level"`
	State         State     `json:"state"`
	CreatedAt     time.Time `json:"created"`
	MitigatedAt   time.Time `json:"mitigated"`
	FixedAt       time.Time `json:"fixed"`
	ClosedAt      time.Time `json:"closed"`
}

Event ...

func NewEvent

func NewEvent(title string, level int) (event *Event, err error)

func (*Event) Close

func (e *Event) Close() error

func (*Event) Id

func (e *Event) Id() ID

type ID

type ID uint64

func ParseId

func ParseId(s string) ID

func (ID) String

func (id ID) String() string

type IdGenerator

type IdGenerator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*IdGenerator) Next

func (id *IdGenerator) Next() ID

type KeyError

type KeyError struct {
	Key ID
	Err error
}

func (*KeyError) Error

func (e *KeyError) Error() string

type MemoryStore

type MemoryStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*MemoryStore) All

func (store *MemoryStore) All() (events []*Event, err error)

func (*MemoryStore) Close

func (store *MemoryStore) Close() error

func (*MemoryStore) Find

func (store *MemoryStore) Find(ids ...ID) (events []*Event, err error)

func (*MemoryStore) Get

func (store *MemoryStore) Get(id ID) (event *Event, err error)

func (*MemoryStore) NextId

func (store *MemoryStore) NextId() ID

func (*MemoryStore) Save

func (store *MemoryStore) Save(event *Event) error

func (*MemoryStore) Search

func (store *MemoryStore) Search(q string) (events []*Event, err error)

type Metrics

type Metrics struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Metrics ...

func InitMetrics

func InitMetrics(name string) *Metrics

func NewMetrics

func NewMetrics(namespace string) *Metrics

NewMetrics ...

func (*Metrics) Counter

func (m *Metrics) Counter(subsystem, name string) prometheus.Counter

Counter ...

func (*Metrics) CounterVec

func (m *Metrics) CounterVec(subsystem, name string) *prometheus.CounterVec

CounterVec ...

func (*Metrics) Gauge

func (m *Metrics) Gauge(subsystem, name string) prometheus.Gauge

Gauge ...

func (*Metrics) GaugeVec

func (m *Metrics) GaugeVec(subsystem, name string) *prometheus.GaugeVec

GaugeVec ...

func (*Metrics) Handler

func (m *Metrics) Handler() http.Handler

Handler ...

func (*Metrics) NewCounter

func (m *Metrics) NewCounter(subsystem, name, help string) prometheus.Counter

NewCounter ...

func (*Metrics) NewCounterFunc

func (m *Metrics) NewCounterFunc(subsystem, name, help string, f func() float64) prometheus.CounterFunc

NewCounterFunc ...

func (*Metrics) NewCounterVec

func (m *Metrics) NewCounterVec(subsystem, name, help string, labels []string) *prometheus.CounterVec

NewCounterVec ...

func (*Metrics) NewGauge

func (m *Metrics) NewGauge(subsystem, name, help string) prometheus.Gauge

NewGauge ...

func (*Metrics) NewGaugeFunc

func (m *Metrics) NewGaugeFunc(subsystem, name, help string, f func() float64) prometheus.GaugeFunc

NewGaugeFunc ...

func (*Metrics) NewGaugeVec

func (m *Metrics) NewGaugeVec(subsystem, name, help string, labels []string) *prometheus.GaugeVec

NewGaugeVec ...

func (*Metrics) NewSummary

func (m *Metrics) NewSummary(subsystem, name, help string) prometheus.Summary

NewSummary ...

func (*Metrics) NewSummaryVec

func (m *Metrics) NewSummaryVec(subsystem, name, help string, labels []string) *prometheus.SummaryVec

NewSummaryVec ...

func (*Metrics) Run

func (m *Metrics) Run(addr string)

Run ...

func (*Metrics) Summary

func (m *Metrics) Summary(subsystem, name string) prometheus.Summary

Summary ...

func (*Metrics) SummaryVec

func (m *Metrics) SummaryVec(subsystem, name string) *prometheus.SummaryVec

SummaryVec ...

type Options

type Options struct {
}

Options ...

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server ...

func NewServer

func NewServer(bind string, options *Options) *Server

NewServer ...

func (*Server) AddRoute

func (s *Server) AddRoute(method, path string, handler http.Handler)

func (*Server) CloseHandler

func (s *Server) CloseHandler() httprouter.Handle

CloseHandler ...

func (*Server) CreateHandler

func (s *Server) CreateHandler() httprouter.Handle

CreateHandler ...

func (*Server) IndexHandler

func (s *Server) IndexHandler() httprouter.Handle

IndexHandler ...

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

ListenAndServe ...

func (*Server) SearchHandler

func (s *Server) SearchHandler() httprouter.Handle

SearchHandler ...

func (*Server) Shutdown

func (s *Server) Shutdown()

type State

type State int

State ...

const (
	STATE_CREATED State
	STATE_MITIGATED
	STATE_FIXED
	STATE_CLOSED
)

func ParseState

func ParseState(s string) State

func (State) String

func (s State) String() string

type Store

type Store interface {
	Close() error
	NextId() ID
	Save(*Event) error
	Get(id ID) (*Event, error)
	Find(id ...ID) ([]*Event, error)
	All() ([]*Event, error)
	Search(q string) ([]*Event, error)
}

func InitDB

func InitDB(uri string) (Store, error)

func NewBoltStore

func NewBoltStore(dbpath string) (Store, error)

func NewMemoryStore

func NewMemoryStore() (Store, error)

type URI

type URI struct {
	Type string
	Path string
}

func ParseURI

func ParseURI(uri string) (*URI, error)

func (*URI) String

func (u *URI) String() string

Directories

Path Synopsis
cmd
sev
sm
Package codec contains sub-packages with different codecs that can be used to encode and decode entities in Storm.
Package codec contains sub-packages with different codecs that can be used to encode and decode entities in Storm.
gob
Package gob contains a codec to encode and decode entities in Gob format
Package gob contains a codec to encode and decode entities in Gob format
json
Package json contains a codec to encode and decode entities in JSON format
Package json contains a codec to encode and decode entities in JSON format
msgpack
Package msgpack contains a codec to encode and decode entities in msgpack format
Package msgpack contains a codec to encode and decode entities in msgpack format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL