A .Net client for the Seyren alerting platform
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.
To install the library from Nuget using the .NET SDK run:
dotnet add package Neutrino.Seyren
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);
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);
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)}");
}
Any feedback or issues can be added to the issues for this project in GitHub.
The repository is hosted at https://github.com/uatec/Neutrino.Seyren
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
This project is licenced under the Apache 2.0 license.