@Test public void testAlert() throws Exception { Incident incident = alertSender.sendTestAlert(abstractAlerterTest.createSubscription(elasticsearchAlerter), CheckResult.Status.ERROR); refresh(); Collection<Incident> allIncidents = elasticsearchClient.getAll("/stagemonitor/alerts", 10, Incident.class); Assert.assertEquals(1, allIncidents.size()); Assert.assertEquals(incident, allIncidents.iterator().next()); }
@Override public void alert(AlertArguments alertArguments) { String target = alertArguments.getSubscription().getTarget(); if (StringUtils.isEmpty(target)) { target = "/stagemonitor/alerts"; } httpClient.send(HttpRequestBuilder.<Integer>jsonRequest("POST", corePlugin.getElasticsearchUrl() + target, alertArguments.getIncident()).build()); }
ElasticsearchAlerter extends Alerter { @Override public void alert(AlertArguments alertArguments) { String target = alertArguments.getSubscription().getTarget(); if (StringUtils.isEmpty(target)) { target = "/stagemonitor/alerts"; } httpClient.send(HttpRequestBuilder.<Integer>jsonRequest("POST", corePlugin.getElasticsearchUrl() + target, alertArguments.getIncident()).build()); } }
ElasticsearchAlerter extends Alerter { @Override public void alert(AlertArguments alertArguments) { String target = alertArguments.getSubscription().getTarget(); if (StringUtils.isEmpty(target)) { target = "/stagemonitor/alerts"; } httpClient.send(HttpRequestBuilder.<Integer>jsonRequest("POST", corePlugin.getElasticsearchUrl() + target, alertArguments.getIncident()).build()); } ElasticsearchAlerter(ConfigurationRegistry configuration, HttpClient httpClient); }
ElasticsearchAlerter extends Alerter { @Override public void alert(AlertArguments alertArguments) { String target = alertArguments.getSubscription().getTarget(); if (StringUtils.isEmpty(target)) { target = "/stagemonitor/alerts"; } httpClient.send(HttpRequestBuilder.<Integer>jsonRequest("POST", corePlugin.getElasticsearchUrl() + target, alertArguments.getIncident()).build()); } ElasticsearchAlerter(ConfigurationRegistry configuration, HttpClient httpClient); @Override void alert(AlertArguments alertArguments); @Override String getAlerterType(); @Override boolean isAvailable(); @Override String getTargetLabel(); }
ElasticsearchAlerter extends Alerter { @Override public void alert(AlertArguments alertArguments) { String target = alertArguments.getSubscription().getTarget(); if (StringUtils.isEmpty(target)) { target = "/stagemonitor/alerts"; } httpClient.send(HttpRequestBuilder.<Integer>jsonRequest("POST", corePlugin.getElasticsearchUrl() + target, alertArguments.getIncident()).build()); } ElasticsearchAlerter(ConfigurationRegistry configuration, HttpClient httpClient); @Override void alert(AlertArguments alertArguments); @Override String getAlerterType(); @Override boolean isAvailable(); @Override String getTargetLabel();  }