computeEngineGauge = Gauge.build()
.name("sonarqube_heath_compute_engine_status")
- .help("Tells whether Compute Engine is up (healthy, ready to take tasks) or down. 0 for up, 1 for down")
+ .help("Tells whether Compute Engine is up (healthy, ready to take tasks) or down. 1 for up, 0 for down")
.register();
elasticsearchGauge = Gauge.build()
.name("sonarqube_heath_elasticsearch_status")
- .help("Tells whether Elasticsearch is up or down. 0 for Up, 1 for down")
+ .help("Tells whether Elasticsearch is up or down. 1 for Up, 0 for down")
.register();
}
}
public void setComputeEngineStatusToGreen() {
- computeEngineGauge.set(0);
+ computeEngineGauge.set(1);
}
public void setComputeEngineStatusToRed() {
- computeEngineGauge.set(1);
+ computeEngineGauge.set(0);
}
public void setElasticSearchStatusToGreen() {
- elasticsearchGauge.set(0);
+ elasticsearchGauge.set(1);
}
public void setElasticSearchStatusToRed() {
- elasticsearchGauge.set(1);
+ elasticsearchGauge.set(0);
}
}
assertThat(CollectorRegistry.defaultRegistry.getSampleValue("gitlab_config_ok")).isZero();
assertThat(CollectorRegistry.defaultRegistry.getSampleValue("bitbucket_config_ok")).isZero();
assertThat(CollectorRegistry.defaultRegistry.getSampleValue("azure_config_ok")).isZero();
- assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_compute_engine_status")).isZero();
- assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_elasticsearch_status")).isZero();
+ assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_compute_engine_status")).isPositive();
+ assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_elasticsearch_status")).isPositive();
}
@Test
assertThat(CollectorRegistry.defaultRegistry.getSampleValue("gitlab_config_ok")).isEqualTo(1);
assertThat(CollectorRegistry.defaultRegistry.getSampleValue("bitbucket_config_ok")).isEqualTo(1);
assertThat(CollectorRegistry.defaultRegistry.getSampleValue("azure_config_ok")).isEqualTo(1);
- assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_compute_engine_status")).isEqualTo(1);
- assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_elasticsearch_status")).isEqualTo(1);
+ assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_compute_engine_status")).isZero();
+ assertThat(CollectorRegistry.defaultRegistry.getSampleValue("sonarqube_heath_elasticsearch_status")).isZero();
}
@Test
public class SafeModeMonitoringMetricAction implements MonitoringWsAction {
- protected static final Gauge isWebUpGauge = Gauge.build().name("sonarqube_heath_web_status").help("Tells whether web service is up").register();
+ protected static final Gauge isWebUpGauge = Gauge.build().name("sonarqube_heath_web_status")
+ .help("Tells whether Web process is up or down. 1 for up, 0 for down").register();
private final SystemPasscode systemPasscode;
private final BearerPasscode bearerPasscode;
@Override
public void define(WebService.NewController context) {
context.createAction("metrics").setHandler(this);
- isWebUpGauge.set(0D);
+ isWebUpGauge.set(1D);
}
@Override