From e2b479c34fcee4c41009fc9e8fe869831fbd494f Mon Sep 17 00:00:00 2001 From: Gibheer Date: Mon, 12 Aug 2019 14:49:53 +0200 Subject: support new checker api With this, it is now possible to support multiple check instances and balance the load. --- cmd/monwork/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/monwork') diff --git a/cmd/monwork/main.go b/cmd/monwork/main.go index 81bc347..4271213 100644 --- a/cmd/monwork/main.go +++ b/cmd/monwork/main.go @@ -226,13 +226,13 @@ var ( 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, msg, mapping_id) -select c.id, $2, c.intval, c.enabled, case when ac.msg is null then '' else ac.msg end, case when c.mapping_id is not null then c.mapping_id when n.mapping_id is not null then n.mapping_id else 1 end + SQLRefreshActiveCheck = `insert into active_checks(check_id, cmdline, intval, enabled, msg, mapping_id, checker_id) +select c.id, $2, c.intval, c.enabled, case when ac.msg is null then '' else ac.msg end, case when c.mapping_id is not null then c.mapping_id when n.mapping_id is not null then n.mapping_id else 1 end, c.checker_id from checks c left join active_checks ac on c.id = ac.check_id left join nodes n on c.node_id = n.id where c.id = $1 on conflict(check_id) -do update set cmdline = $2, intval = excluded.intval, enabled = excluded.enabled, mapping_id = excluded.mapping_id;` +do update set cmdline = $2, intval = excluded.intval, enabled = excluded.enabled, mapping_id = excluded.mapping_id, checker_id = excluded.checker_id;` SQLUpdateLastRefresh = `update checks set last_refresh = now() where id = $1;` ) -- cgit v1.2.3-70-g09d2