monwork - fix an issue with configuration generation
New checks were not added to the active_checks, because they were never touched before.
This commit is contained in:
parent
6c2bea5365
commit
a6ac232392
|
@ -161,11 +161,13 @@ var (
|
|||
SQLGetConfigUpdates = `select c.id, co.command, c.options
|
||||
from checks c
|
||||
join commands co on c.command_id = co.id
|
||||
where c.last_refresh < c.updated
|
||||
where c.last_refresh < c.updated or c.last_refresh is null
|
||||
limit 1
|
||||
for update of c skip locked;`
|
||||
SQLRefreshActiveCheck = `insert into active_checks(check_id, cmdline, intval, enabled, notify)
|
||||
select id, $2, intval, enabled, notify from checks where id = $1
|
||||
SQLRefreshActiveCheck = `insert into active_checks(check_id, cmdline, intval, enabled, notify, msg)
|
||||
select id, $2, c.intval, c.enabled, c.notify, case when ac.msg is null then '' else ac.msg end from checks c
|
||||
left join active_checks ac on c.id = ac.check_id
|
||||
where id = $1
|
||||
on conflict(check_id)
|
||||
do update set cmdline = $2, intval = excluded.intval, enabled = excluded.enabled, notify = excluded.notify;`
|
||||
SQLUpdateLastRefresh = `update checks set last_refresh = now() where id = $1;`
|
||||
|
|
Loading…
Reference in New Issue
Block a user