mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 11:17:46 +00:00
Fix grafana cron job. update cron_process_grafana_fn
This commit is contained in:
@@ -363,7 +363,7 @@ COMMENT ON FUNCTION
|
||||
CREATE FUNCTION cron_process_grafana_fn() RETURNS void AS $$
|
||||
DECLARE
|
||||
process_rec record;
|
||||
metadata_rec record;
|
||||
data_rec record;
|
||||
app_settings jsonb;
|
||||
BEGIN
|
||||
-- We run grafana provisioning only after the first received vessel metadata
|
||||
@@ -375,11 +375,14 @@ BEGIN
|
||||
order by stored asc
|
||||
LOOP
|
||||
RAISE NOTICE '-> cron_process_grafana_fn [%]', process_rec.payload;
|
||||
-- as we got data from the vessel we can do the grafana provisioning.
|
||||
-- Gather url from app settings
|
||||
app_settings := get_app_settings_fn();
|
||||
SELECT * INTO metadata_rec FROM api.metadata WHERE id = process_rec.payload;
|
||||
PERFORM grafana_py_fn(metadata_rec.name,metadata_rec.vessel_id,metadata_rec.owner_email,app_settings);
|
||||
SELECT * INTO data_rec
|
||||
FROM api.metadata m, auth.vessels v
|
||||
WHERE id = process_rec.payload::INTEGER
|
||||
AND m.vessel_id = v.vessel_id;
|
||||
-- as we got data from the vessel we can do the grafana provisioning.
|
||||
PERFORM grafana_py_fn(data_rec.name,data_rec.vessel_id,data_rec.owner_email,app_settings);
|
||||
-- update process_queue entry as processed
|
||||
UPDATE process_queue
|
||||
SET
|
||||
|
@@ -827,14 +827,15 @@ BEGIN
|
||||
name LIKE 'app.email%'
|
||||
OR name LIKE 'app.pushover%'
|
||||
OR name LIKE 'app.url'
|
||||
OR name LIKE 'app.telegram%';
|
||||
OR name LIKE 'app.telegram%'
|
||||
OR name LIKE 'app.grafana_admin_uri';
|
||||
END;
|
||||
$get_app_settings$
|
||||
LANGUAGE plpgsql;
|
||||
-- Description
|
||||
COMMENT ON FUNCTION
|
||||
public.get_app_settings_fn
|
||||
IS 'get application settings details, email, pushover, telegram';
|
||||
IS 'get application settings details, email, pushover, telegram, grafana_admin_uri';
|
||||
|
||||
DROP FUNCTION IF EXISTS get_app_url_fn;
|
||||
CREATE OR REPLACE FUNCTION get_app_url_fn(OUT app_settings jsonb)
|
||||
@@ -1914,6 +1915,8 @@ BEGIN
|
||||
-- In correct order
|
||||
perform public.cron_process_new_notification_fn();
|
||||
perform public.cron_process_monitor_online_fn();
|
||||
--perform public.cron_process_grafana_fn();
|
||||
perform public.cron_process_pre_logbook_fn();
|
||||
perform public.cron_process_new_logbook_fn();
|
||||
perform public.cron_process_new_stay_fn();
|
||||
--perform public.cron_process_new_moorage_fn();
|
||||
|
Reference in New Issue
Block a user