chore: updated docker
This commit is contained in:
@@ -139,3 +139,4 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./dockerfiles/power_control.Dockerfile
|
dockerfile: ./dockerfiles/power_control.Dockerfile
|
||||||
|
network_mode: "host"
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ var app = builder.Build();
|
|||||||
|
|
||||||
app.MapPost(
|
app.MapPost(
|
||||||
"/high_power_alert",
|
"/high_power_alert",
|
||||||
(object body) =>
|
async (AlertBody body) =>
|
||||||
{
|
{
|
||||||
Console.WriteLine("high power alert was received.");
|
Console.WriteLine("high power alert was received.");
|
||||||
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(body));
|
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(body));
|
||||||
|
|
||||||
|
using var client = new HttpClient();
|
||||||
|
await client.GetAsync("http://192.168.1.121/control?cmd=heatpump&set_power_mode=off");
|
||||||
return new OkResult();
|
return new OkResult();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -26,3 +29,8 @@ app.MapPost(
|
|||||||
.WithName("Low Power Alert");
|
.WithName("Low Power Alert");
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
|
record AlertBody
|
||||||
|
{
|
||||||
|
string status;
|
||||||
|
}
|
||||||
|
|||||||
51
microservices/power_control/example_body_firing.json
Normal file
51
microservices/power_control/example_body_firing.json
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"receiver": "REST API",
|
||||||
|
"status": "firing",
|
||||||
|
"alerts": [
|
||||||
|
{
|
||||||
|
"status": "firing",
|
||||||
|
"labels": {
|
||||||
|
"alertname": "Alert if peak is too high",
|
||||||
|
"domain": "sensor",
|
||||||
|
"entity_id": "thienpont_serruys_load_grid",
|
||||||
|
"grafana_folder": "Power"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"description": "Disable some devices to lower the peak.",
|
||||||
|
"summary": "Peak is too high!"
|
||||||
|
},
|
||||||
|
"startsAt": "2025-12-29T04:58:50Z",
|
||||||
|
"endsAt": "0001-01-01T00:00:00Z",
|
||||||
|
"generatorURL": "http://localhost:3000/alerting/grafana/ef6m5j923ruv4f/view?orgId=1",
|
||||||
|
"fingerprint": "2c3f0f9ffb7d8c5d",
|
||||||
|
"silenceURL": "http://localhost:3000/alerting/silence/new?alertmanager=grafana\u0026matcher=__alert_rule_uid__%3Def6m5j923ruv4f\u0026matcher=domain%3Dsensor\u0026matcher=entity_id%3Dthienpont_serruys_load_grid\u0026orgId=1",
|
||||||
|
"dashboardURL": "http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984335061",
|
||||||
|
"panelURL": "http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984335061\u0026viewPanel=3",
|
||||||
|
"values": { "B": 4015.25, "C": 1 },
|
||||||
|
"valueString": "[ var=\u0027B\u0027 labels={domain=sensor, entity_id=thienpont_serruys_load_grid} value=4015.25 ], [ var=\u0027C\u0027 labels={domain=sensor, entity_id=thienpont_serruys_load_grid} value=1 ]",
|
||||||
|
"orgId": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groupLabels": {
|
||||||
|
"alertname": "Alert if peak is too high",
|
||||||
|
"grafana_folder": "Power"
|
||||||
|
},
|
||||||
|
"commonLabels": {
|
||||||
|
"alertname": "Alert if peak is too high",
|
||||||
|
"domain": "sensor",
|
||||||
|
"entity_id": "thienpont_serruys_load_grid",
|
||||||
|
"grafana_folder": "Power"
|
||||||
|
},
|
||||||
|
"commonAnnotations": {
|
||||||
|
"description": "Disable some devices to lower the peak.",
|
||||||
|
"summary": "Peak is too high!"
|
||||||
|
},
|
||||||
|
"externalURL": "http://localhost:3000/",
|
||||||
|
"version": "1",
|
||||||
|
"groupKey": "{}/{__grafana_autogenerated__=\u0022true\u0022}/{__grafana_receiver__=\u0022REST API\u0022}:{alertname=\u0022Alert if peak is too high\u0022, grafana_folder=\u0022Power\u0022}",
|
||||||
|
"truncatedAlerts": 0,
|
||||||
|
"orgId": 1,
|
||||||
|
"title": "[FIRING:1] Alert if peak is too high Power (sensor thienpont_serruys_load_grid)",
|
||||||
|
"state": "alerting",
|
||||||
|
"message": "**Firing**\n\nValue: B=4015.25, C=1\nLabels:\n - alertname = Alert if peak is too high\n - domain = sensor\n - entity_id = thienpont_serruys_load_grid\n - grafana_folder = Power\nAnnotations:\n - description = Disable some devices to lower the peak.\n - summary = Peak is too high!\nSource: http://localhost:3000/alerting/grafana/ef6m5j923ruv4f/view?orgId=1\nSilence: http://localhost:3000/alerting/silence/new?alertmanager=grafana\u0026matcher=__alert_rule_uid__%3Def6m5j923ruv4f\u0026matcher=domain%3Dsensor\u0026matcher=entity_id%3Dthienpont_serruys_load_grid\u0026orgId=1\nDashboard: http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984335061\nPanel: http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984335061\u0026viewPanel=3\n"
|
||||||
|
}
|
||||||
53
microservices/power_control/example_body_resolved.json
Normal file
53
microservices/power_control/example_body_resolved.json
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"receiver": "REST API",
|
||||||
|
"status": "resolved",
|
||||||
|
"alerts": [
|
||||||
|
{
|
||||||
|
"status": "resolved",
|
||||||
|
"labels": {
|
||||||
|
"alertname": "Alert if peak is too high",
|
||||||
|
"domain": "sensor",
|
||||||
|
"entity_id": "thienpont_serruys_load_grid",
|
||||||
|
"grafana_folder": "Power"
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"description": "Disable some devices to lower the peak.",
|
||||||
|
"grafana_state_reason": "Updated",
|
||||||
|
"summary": "Peak is too high!"
|
||||||
|
},
|
||||||
|
"startsAt": "2025-12-29T04:58:50Z",
|
||||||
|
"endsAt": "2025-12-29T04:59:25.018228513Z",
|
||||||
|
"generatorURL": "http://localhost:3000/alerting/grafana/ef6m5j923ruv4f/view?orgId=1",
|
||||||
|
"fingerprint": "2c3f0f9ffb7d8c5d",
|
||||||
|
"silenceURL": "http://localhost:3000/alerting/silence/new?alertmanager=grafana\u0026matcher=__alert_rule_uid__%3Def6m5j923ruv4f\u0026matcher=domain%3Dsensor\u0026matcher=entity_id%3Dthienpont_serruys_load_grid\u0026orgId=1",
|
||||||
|
"dashboardURL": "http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984365018",
|
||||||
|
"panelURL": "http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984365018\u0026viewPanel=3",
|
||||||
|
"values": null,
|
||||||
|
"valueString": "[ var=\u0027B\u0027 labels={domain=sensor, entity_id=thienpont_serruys_load_grid} value=3826.9 ], [ var=\u0027C\u0027 labels={domain=sensor, entity_id=thienpont_serruys_load_grid} value=1 ]",
|
||||||
|
"orgId": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groupLabels": {
|
||||||
|
"alertname": "Alert if peak is too high",
|
||||||
|
"grafana_folder": "Power"
|
||||||
|
},
|
||||||
|
"commonLabels": {
|
||||||
|
"alertname": "Alert if peak is too high",
|
||||||
|
"domain": "sensor",
|
||||||
|
"entity_id": "thienpont_serruys_load_grid",
|
||||||
|
"grafana_folder": "Power"
|
||||||
|
},
|
||||||
|
"commonAnnotations": {
|
||||||
|
"description": "Disable some devices to lower the peak.",
|
||||||
|
"grafana_state_reason": "Updated",
|
||||||
|
"summary": "Peak is too high!"
|
||||||
|
},
|
||||||
|
"externalURL": "http://localhost:3000/",
|
||||||
|
"version": "1",
|
||||||
|
"groupKey": "{}/{__grafana_autogenerated__=\u0022true\u0022}/{__grafana_receiver__=\u0022REST API\u0022}:{alertname=\u0022Alert if peak is too high\u0022, grafana_folder=\u0022Power\u0022}",
|
||||||
|
"truncatedAlerts": 0,
|
||||||
|
"orgId": 1,
|
||||||
|
"title": "[RESOLVED] Alert if peak is too high Power (sensor thienpont_serruys_load_grid)",
|
||||||
|
"state": "ok",
|
||||||
|
"message": "**Resolved**\n\nValue: [no value]\nLabels:\n - alertname = Alert if peak is too high\n - domain = sensor\n - entity_id = thienpont_serruys_load_grid\n - grafana_folder = Power\nAnnotations:\n - description = Disable some devices to lower the peak.\n - grafana_state_reason = Updated\n - summary = Peak is too high!\nSource: http://localhost:3000/alerting/grafana/ef6m5j923ruv4f/view?orgId=1\nSilence: http://localhost:3000/alerting/silence/new?alertmanager=grafana\u0026matcher=__alert_rule_uid__%3Def6m5j923ruv4f\u0026matcher=domain%3Dsensor\u0026matcher=entity_id%3Dthienpont_serruys_load_grid\u0026orgId=1\nDashboard: http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984365018\nPanel: http://localhost:3000/d/2990096a-3ff9-4217-a629-2152a260b6b6?from=1766980730000\u0026orgId=1\u0026to=1766984365018\u0026viewPanel=3\n"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user