-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
283 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: v1 | ||
|
||
providers: | ||
- name: prom1 | ||
source: prometheus | ||
uri: /alertmonitor/webhook/prom1 | ||
params: | ||
server: http://prom-1:9090 | ||
sync: 60s | ||
- name: prom2 | ||
source: prometheus | ||
uri: /alertmonitor/webhook/prom2 | ||
params: | ||
server: http://prom-2:9090 | ||
clientPoolSize: 1 | ||
clientReadTimeout: 120s | ||
data: | ||
retention: 7d | ||
sync: | ||
interval: 60s | ||
- name: cluster-1 | ||
source: eventlogger | ||
uri: /alertmonitor/webhook/eventlogger | ||
params: | ||
server: http://prom-1:9090 | ||
sync: 60s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/si/matjazcerkvenik/alertmonitor/model/DataProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package si.matjazcerkvenik.alertmonitor.model; | ||
|
||
import si.matjazcerkvenik.alertmonitor.model.config.ProviderConfig; | ||
import si.matjazcerkvenik.alertmonitor.web.WebhookMessage; | ||
|
||
public class DataProvider { | ||
|
||
private ProviderConfig providerConfig; | ||
|
||
public ProviderConfig getProviderConfig() { | ||
return providerConfig; | ||
} | ||
|
||
public void setProviderConfig(ProviderConfig providerConfig) { | ||
this.providerConfig = providerConfig; | ||
} | ||
|
||
public void processIncomingEvent(WebhookMessage m) { | ||
|
||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/si/matjazcerkvenik/alertmonitor/model/config/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package si.matjazcerkvenik.alertmonitor.model.config; | ||
|
||
import java.util.List; | ||
|
||
public class Config { | ||
|
||
private String version; | ||
|
||
private List<ProviderConfig> providers; | ||
|
||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public void setVersion(String version) { | ||
this.version = version; | ||
} | ||
|
||
|
||
public List<ProviderConfig> getProviders() { | ||
return providers; | ||
} | ||
|
||
public void setProviders(List<ProviderConfig> providers) { | ||
this.providers = providers; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Config{" + | ||
"providers=" + providers + | ||
'}'; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/si/matjazcerkvenik/alertmonitor/model/config/ConfigReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package si.matjazcerkvenik.alertmonitor.model.config; | ||
|
||
import org.yaml.snakeyaml.Yaml; | ||
import org.yaml.snakeyaml.constructor.Constructor; | ||
import si.matjazcerkvenik.alertmonitor.util.LogFactory; | ||
|
||
import java.io.*; | ||
|
||
public class ConfigReader { | ||
|
||
public static void main(String... args) { | ||
ConfigReader.loadYaml("alertmonitor-config.yml"); | ||
} | ||
|
||
public static Config loadYaml(String path) { | ||
Yaml yaml = new Yaml(new Constructor(Config.class)); | ||
File f = new File(path); | ||
InputStream inputStream; | ||
try { | ||
inputStream = new FileInputStream(f); | ||
} catch (FileNotFoundException e) { | ||
LogFactory.getLogger().warn("no alertmonitor-config.yml found at " + path); | ||
return null; | ||
} | ||
Config config = yaml.load(inputStream); | ||
LogFactory.getLogger().info("config loaded: " + config.toString()); | ||
return config; | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/si/matjazcerkvenik/alertmonitor/model/config/ProviderConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package si.matjazcerkvenik.alertmonitor.model.config; | ||
|
||
import java.util.Map; | ||
|
||
public class ProviderConfig { | ||
|
||
private String id; | ||
private String name; | ||
private String source; | ||
private String uri; | ||
private Map<String, Object> params; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public void setSource(String source) { | ||
this.source = source; | ||
} | ||
|
||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
public void setUri(String uri) { | ||
this.uri = uri; | ||
} | ||
|
||
public Map<String, Object> getParams() { | ||
return params; | ||
} | ||
|
||
public void setParams(Map<String, Object> params) { | ||
this.params = params; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ProviderConfig{" + | ||
"id='" + id + '\'' + | ||
", name='" + name + '\'' + | ||
", source='" + source + '\'' + | ||
", uri='" + uri + '\'' + | ||
", params=" + params + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.