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 $$
|
CREATE FUNCTION cron_process_grafana_fn() RETURNS void AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
process_rec record;
|
process_rec record;
|
||||||
metadata_rec record;
|
data_rec record;
|
||||||
app_settings jsonb;
|
app_settings jsonb;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- We run grafana provisioning only after the first received vessel metadata
|
-- We run grafana provisioning only after the first received vessel metadata
|
||||||
@@ -375,11 +375,14 @@ BEGIN
|
|||||||
order by stored asc
|
order by stored asc
|
||||||
LOOP
|
LOOP
|
||||||
RAISE NOTICE '-> cron_process_grafana_fn [%]', process_rec.payload;
|
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
|
-- Gather url from app settings
|
||||||
app_settings := get_app_settings_fn();
|
app_settings := get_app_settings_fn();
|
||||||
SELECT * INTO metadata_rec FROM api.metadata WHERE id = process_rec.payload;
|
SELECT * INTO data_rec
|
||||||
PERFORM grafana_py_fn(metadata_rec.name,metadata_rec.vessel_id,metadata_rec.owner_email,app_settings);
|
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 entry as processed
|
||||||
UPDATE process_queue
|
UPDATE process_queue
|
||||||
SET
|
SET
|
||||||
|
@@ -827,14 +827,15 @@ BEGIN
|
|||||||
name LIKE 'app.email%'
|
name LIKE 'app.email%'
|
||||||
OR name LIKE 'app.pushover%'
|
OR name LIKE 'app.pushover%'
|
||||||
OR name LIKE 'app.url'
|
OR name LIKE 'app.url'
|
||||||
OR name LIKE 'app.telegram%';
|
OR name LIKE 'app.telegram%'
|
||||||
|
OR name LIKE 'app.grafana_admin_uri';
|
||||||
END;
|
END;
|
||||||
$get_app_settings$
|
$get_app_settings$
|
||||||
LANGUAGE plpgsql;
|
LANGUAGE plpgsql;
|
||||||
-- Description
|
-- Description
|
||||||
COMMENT ON FUNCTION
|
COMMENT ON FUNCTION
|
||||||
public.get_app_settings_fn
|
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;
|
DROP FUNCTION IF EXISTS get_app_url_fn;
|
||||||
CREATE OR REPLACE FUNCTION get_app_url_fn(OUT app_settings jsonb)
|
CREATE OR REPLACE FUNCTION get_app_url_fn(OUT app_settings jsonb)
|
||||||
@@ -1914,6 +1915,8 @@ BEGIN
|
|||||||
-- In correct order
|
-- In correct order
|
||||||
perform public.cron_process_new_notification_fn();
|
perform public.cron_process_new_notification_fn();
|
||||||
perform public.cron_process_monitor_online_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_logbook_fn();
|
||||||
perform public.cron_process_new_stay_fn();
|
perform public.cron_process_new_stay_fn();
|
||||||
--perform public.cron_process_new_moorage_fn();
|
--perform public.cron_process_new_moorage_fn();
|
||||||
|
Reference in New Issue
Block a user