Skip to content

rkonfj/alert4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alert4j

The alert4j is the alertmanager v2 api Java SDK.

Usage

// Create a singleton AlertManagerV2 Client
AlertManagerV2 v2 = new AlertManagerV2("http://10.1.0.2:9093");

// New CPU Alert
PostableAlert alert1 = new PostableAlert();
alert1.labels().add("alertname", "Alert for cpu overheating");
alert1.setStartsAt(LocalDateTime.now().plusMinutes(-2));
alert1.setEndsAt(LocalDateTime.now());

// New Memory Alert
PostableAlert alert2 = new PostableAlert();
alert2.labels().add("alertname", "Alert for memory greater than 70%");
alert2.setStartsAt(LocalDateTime.now().plusMinutes(-2));
alert2.setEndsAt(LocalDateTime.now());

// Alert to AlertManager
v2.alertsManager().createAlerts(Arrays.asList(alert1, alert2));

Contributing

This is a very early version, and you are very welcome to contribute.

Releases

No releases published

Packages

No packages published

Languages