Skip to content

uatec/Neutrino.Seyren

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neutrino.Seyren

A .Net client for the Seyren alerting platform

NuGet version

Introduction

Seyren is an alerting dashboard for graphite which supports many different notification channels.

Checks and subscriptions are managed via the Seyren API.

This library provides a .Net implementation of that API targetting .NET Standard 1.3 and later.

Installation

To install the library from Nuget using the .NET SDK run:

dotnet add package Neutrino.Seyren

Basic Examples

Creating Checks

var client = new SeyrenClient(new HttpClient
{
    BaseAddress = new Uri("http://localhost:8080")
});

Check newCheck = await client.Checks.CreateAsync(new Check
{
    Name = "My CPU Check",
    Description = "Make sure my CPU is not catching fire.",
    Target = "movingMedian(stats.gauges.server_001.cpu, '5m')",
    Warn = 60,
    Error = 80,
    Enabled = true,
    From = "0000",
    Until = "2359"
});

Console.WriteLine(newCheck.Id);

Adding Subscriptions

var client = new SeyrenClient(new HttpClient
{
    BaseAddress = new Uri("http://localhost:8080")
});

Subscription subscription = await client.Subscriptions.Create(checkId, new Subscription
{
    Target = "test@gmail.com",
    Type = SubscriptionType.Email,
    IgnoreWarn = false,
    IgnoreError = false,
    IgnoreOk = false,
    FromTime = "0800",
    ToTime = "1700",
    EnabledOnMonday = true,
    EnabledOnTuesday = true,
    EnabledOnWednesday = true,
    EnabledOnThursday = true,
    EnabledOnFriday = true
});

Console.WriteLine(subscription.Id);

Getting Alerts

var client = new SeyrenClient(new HttpClient
{
    BaseAddress = new Uri("http://localhost:8080")
});

SeyrenResponse<Alert> alerts = await client.Alerts.GetByCheckId(checkId);

foreach ( Alert alert in alerts.Values )
{
    Console.WriteLine($"[{alert.Timestamp:o}] {alert.Target} {Enum.GetName(typeof(AlertType), alert.ToType)}");
}

Feedback

Any feedback or issues can be added to the issues for this project in GitHub.

Repository

The repository is hosted at https://github.com/uatec/Neutrino.Seyren

Contributing

Build status

Compiling the library yourself requires Git and the .NET Core SDK to be installed (version 2.0.0 or later).

To build and test the library locally from a terminal/command-line, run the following set of commands:

git clone https://github.com/uatec/Neutrino.Seyren.git
cd Neutrino.Seyren
dotnet build
dotnet test

Licence

This project is licenced under the Apache 2.0 license.

About

A .Net client for the Seyren alerting platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages