diff --git a/migrate/20240619_lantern_doctor_queries.rb b/migrate/20240619_lantern_doctor_queries.rb new file mode 100644 index 000000000..278162924 --- /dev/null +++ b/migrate/20240619_lantern_doctor_queries.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +Sequel.migration do + up do + # percent toward transaction wraparound + sql = < 85 FROM per_database_stats; +SQL + DB[:lantern_doctor_query].insert( + id: "98cf148c-a88c-85b7-9bec-dbc912b022be", + name: "Percent towards tx wraparound is >85%", + db_name: "postgres", + schedule: "45 */10 * * *", + condition: "unknown", + sql: sql, + type: "system", + response_type: "bool", + severity: "warning" + ) + end +end diff --git a/model/lantern/lantern_doctor_query.rb b/model/lantern/lantern_doctor_query.rb index 49d9ceca2..a066c87d7 100644 --- a/model/lantern/lantern_doctor_query.rb +++ b/model/lantern/lantern_doctor_query.rb @@ -169,6 +169,7 @@ def check_disk_space_usage(_db, _query_user) server_type = serv.primary? ? "primary" : "standby" output += "#{server_type} server - usage #{usage_percent}%\n" end + rescue end output.chomp end