1
0

Fix prometheus query

This commit is contained in:
clerie 2023-02-04 00:01:26 +01:00
parent c0cb8db954
commit b89910f649

View File

@ -184,7 +184,7 @@ async fn check(State(app_state): State<AppState>, Query(params): Query<HashMap<S
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let prometheus_req = match client.get(format!("{}/api/v1/query?query=nixos_nixos_current_system_hash{{{}}}", app_state.prometheus_url, app_state.prometheus_query_tag_template.clone().replace("{}", target))) let prometheus_req = match client.get(format!("{}/api/v1/query?query=nixos_current_system_hash{{{}}}", app_state.prometheus_url, app_state.prometheus_query_tag_template.clone().replace("{}", target)))
.header("Accept", "application/json") .header("Accept", "application/json")
.send().await { .send().await {
Ok(req) => req, Ok(req) => req,
@ -260,6 +260,6 @@ async fn check(State(app_state): State<AppState>, Query(params): Query<HashMap<S
return ( return (
StatusCode::OK, StatusCode::OK,
format!("nixos_current_system_valid{{{}}} {}\n", app_state.prometheus_query_tag_template.clone().replace("{}", target), status) format!("nixos_current_system_valid{{}} {}\n", status)
).into_response(); ).into_response();
} }