-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monitor SQL query result #2342
Comments
Alternatively you can try to use Infracheck with a custom script, expose the endpoint and just ping it using a regular HTTP check in Uptime Kuma. |
I am with @thedatabaseme In my case I would count the rows of a table and return "DOWN" if the count is 0. |
Totally for it. Doesn't seem to be very complicated to implement. |
Is there any condition of the query to return down? or is the query just executed without monitoring the return? |
My understanding of the current implementation is, that there is no actual check for the result of the SQL query. When the query finishes without error, the monitor is up. Else it's down. |
Thanks for the answer. IF NOT EXISTS(.........) BEGIN
THROW 51000, 'ERROR XXXXX.', 1;
END |
Thx to @rogerioadris idea, I could use it at PostgresSQL as well: do
$$
declare
total_errors int2;
err_text text;
begin
select
count(*) as total_errors,
string_agg(p.query || ':\n' || p.context , '\n\n') as x
into
total_errors,
err_text
from
pglog p
where
error_severity != 'LOG'
and application_name = 'pg_cron'
and log_time > now() - interval '1 day';
IF total_errors > 0 THEN
raise 'Failed Queries\n ```%s```', err_text;
end if;
end
$$ |
🏷️ Feature Request Type
New Monitor
🔖 Feature description
Hello,
I would love to see the possibility within Uptime-Kuma, to specify an expected result within a SQL query monitor type (e.g. Postgres).
So a SQL monitor would not only check if it can connect to a database and can execute a query.
Another wish from my side would be, to store the query result in the heartbeat data. You could cut the result to save space, but at least one would have some idea on how the result looked like.
Kind regards
Philip
✔️ Solution
I want to check for the replication status of a Postgres cluster and if a specific cluster member is in recovery or not. So a query like
select * from pg_is_in_recovery();
would return eithert
(true) orf
(false). I would like to have the possibility to monitor for the expected result.❓ Alternatives
If you don't consider to implement this request, at least the result should be exported as a metric so that I can filter on it later. Implementing both options, would be the best solution.
📝 Additional Context
No response
The text was updated successfully, but these errors were encountered: