diff --git a/availability.json b/availability.json deleted file mode 100644 index fe363cc..0000000 --- a/availability.json +++ /dev/null @@ -1 +0,0 @@ -{"responses":[{"_shards":{"failed":0,"skipped":0,"successful":3,"total":3},"aggregations":{"arrakis":{"buckets":[{"doc_count":7010,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":43072706160},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"livebook"},{"doc_count":7009,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":457936032},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"insterra-testing"},{"doc_count":7008,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":4137743538512},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"nas-box"},{"doc_count":7007,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":223143856},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"apm"},{"doc_count":7007,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":1684621920},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"elastic"},{"doc_count":7007,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":1629082992},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"kibana"},{"doc_count":7007,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":286888960},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"minio"},{"doc_count":7007,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":502670816},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"postgresql"},{"doc_count":6977,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":22915831552},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"win11"},{"doc_count":627,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":141514000},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"uplink"},{"doc_count":457,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":122049801248},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"immich"},{"doc_count":457,"filesystem_used_bytes":{"top":[{"metrics":{"system.filesystem.used.bytes":14625002368},"sort":["2025-01-10T05:56:30.214Z"]}]},"key":"ollama"}],"doc_count_error_upper_bound":0,"sum_other_doc_count":0},"filesystem_used_bytes":{"value":4345332738416.0}},"hits":{"hits":[],"max_score":null,"total":{"relation":"gte","value":10000}},"status":200,"timed_out":false,"took":5},{"_shards":{"failed":0,"skipped":0,"successful":3,"total":3},"aggregations":{"arrakis":{"buckets":[{"doc_count":749,"key":"apm","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"elastic","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.001},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"insterra-testing","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"kibana","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.001},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"livebook","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.001},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"minio","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"nas-box","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"postgresql","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.001},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":749,"key":"win11","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":513,"key":"uplink","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":415,"key":"immich","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.001},"sort":["2025-01-10T04:34:00.250Z"]}]}},{"doc_count":415,"key":"ollama","load_norm_5":{"top":[{"metrics":{"system.load.norm.5":0.0},"sort":["2025-01-10T04:34:00.250Z"]}]}}],"doc_count_error_upper_bound":0,"sum_other_doc_count":0},"load_norm_5":{"value":0.005}},"hits":{"hits":[],"max_score":null,"total":{"relation":"eq","value":8084}},"status":200,"timed_out":false,"took":1},{"_shards":{"failed":0,"skipped":0,"successful":3,"total":3},"aggregations":{"arrakis":{"buckets":[{"doc_count":7010,"key":"livebook","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":213258240},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7009,"key":"insterra-testing","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":33275904},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7008,"key":"nas-box","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":206090240},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7007,"key":"apm","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":91762688},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7007,"key":"elastic","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":36014866432},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7007,"key":"kibana","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":612876288},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7007,"key":"minio","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":187273216},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":7007,"key":"postgresql","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":100323328},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":6977,"key":"win11","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":0},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":627,"key":"uplink","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":1126400},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":457,"key":"immich","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":1360203776},"sort":["2025-01-10T05:56:30.214Z"]}]}},{"doc_count":457,"key":"ollama","memory_used_bytes":{"top":[{"metrics":{"system.memory.actual.used.bytes":1026732032},"sort":["2025-01-10T05:56:30.214Z"]}]}}],"doc_count_error_upper_bound":0,"sum_other_doc_count":0},"memory_used_bytes":{"value":39847788544.0}},"hits":{"hits":[],"max_score":null,"total":{"relation":"gte","value":10000}},"status":200,"timed_out":false,"took":6}],"took":7} \ No newline at end of file diff --git a/lib/uplink/availability.ex b/lib/uplink/availability.ex index 8afcb49..0eade8f 100644 --- a/lib/uplink/availability.ex +++ b/lib/uplink/availability.ex @@ -39,9 +39,7 @@ defmodule Uplink.Availability do Metrics.query!(monitor, query) |> case do - %{status: 200, body: %{"responses" => responses} = body} -> - File.write!("availability.json", Jason.encode!(body)) - + %{status: 200, body: %{"responses" => responses}} -> resources = nodes |> Response.parse(responses) diff --git a/test/uplink/availability/router_test.exs b/test/uplink/availability/router_test.exs index bc7b0e4..03cf400 100644 --- a/test/uplink/availability/router_test.exs +++ b/test/uplink/availability/router_test.exs @@ -57,6 +57,7 @@ defmodule Uplink.Availability.RouterTest do File.read!("test/fixtures/elastic/availability.json") Cache.delete(:cluster_members) + Cache.delete({:monitors, :metrics}) {:ok, bypass: bypass, diff --git a/test/uplink/availability_test.exs b/test/uplink/availability_test.exs index 6c41fd9..79f84e9 100644 --- a/test/uplink/availability_test.exs +++ b/test/uplink/availability_test.exs @@ -46,6 +46,7 @@ defmodule Uplink.AvailabilityTest do File.read!("test/fixtures/elastic/availability.json") Cache.delete(:cluster_members) + Cache.delete({:monitors, :metrics}) {:ok, bypass: bypass,