From 8f68307139fb5fd2a898780e9059d66395db3eca Mon Sep 17 00:00:00 2001 From: Park Juhyung Date: Fri, 25 Oct 2019 14:58:35 +0900 Subject: [PATCH 1/4] [fee-monitor] Send start notification --- fee-monitor/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fee-monitor/src/index.ts b/fee-monitor/src/index.ts index 6b2975ff..c633acbd 100644 --- a/fee-monitor/src/index.ts +++ b/fee-monitor/src/index.ts @@ -178,6 +178,8 @@ async function main() { }, 60_000); // 1 minute interval const dog = createWatchdog(30); + slack.sendInfo("start", ""); + email.sendInfo("start", "start"); for (;;) { console.log(); console.log(`BlockNumber: ${blockNumber}`); From 485f9ec917f0918ebd723d5b64f5a8da8b6f215e Mon Sep 17 00:00:00 2001 From: Park Juhyung Date: Fri, 25 Oct 2019 16:39:18 +0900 Subject: [PATCH 2/4] [juggle-ccc] Send start notification --- juggle-ccc/src/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/juggle-ccc/src/index.ts b/juggle-ccc/src/index.ts index b602cbd6..8b03366d 100644 --- a/juggle-ccc/src/index.ts +++ b/juggle-ccc/src/index.ts @@ -116,6 +116,25 @@ async function main() { }, 60_000); } + const startMessage = "start"; + try { + await sendSlackWebHook(slackWebHook, "info", networkId, startMessage); + } catch (err) { + console.error(`Cannot send slack message: ${err.message}`); + } + try { + await sendMail( + sendgridApiKey, + sendgridTo, + "info", + networkId, + startMessage, + startMessage + ); + } catch (err) { + console.error(`Cannot send mail: ${err.message}`); + } + let retry = 0; while (true) { try { From 588d7e4c07da05b9711e2ad09fbab91e9e1fbd59 Mon Sep 17 00:00:00 2001 From: Park Juhyung Date: Fri, 25 Oct 2019 16:45:18 +0900 Subject: [PATCH 3/4] [indexer-monitor] Send start notification --- indexer-monitor/src/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/indexer-monitor/src/index.ts b/indexer-monitor/src/index.ts index 8aec70ea..d678d457 100644 --- a/indexer-monitor/src/index.ts +++ b/indexer-monitor/src/index.ts @@ -7,6 +7,7 @@ import { IndexerAPI, IndexerAPIImpl, TestIndexerAPI } from "./IndexerAPI"; const emailClient = new EmailClient(); type Notification = Notifications.Notification; let lastNotiForTest: Notification | null = null; +const networkId = getConfig("NETWORK_ID"); function colorFromLevel(level: "error" | "warn" | "info"): "danger" | "warning" | undefined { switch (level) { @@ -358,6 +359,19 @@ async function main() { throw err; } + SlackNotification.instance.send({ + title: `[${networkId}] indexer-monitor start`, + text: "", + color: "good", + }); + await emailClient + .sendAnnouncement( + targetEmail, + `[${networkId}] indexer-monitor start`, + "indexer-monitor start", + ) + .catch(console.error); + // 10 minutes interval setInterval(checkDayChange, 10 * 60 * 1000, indexerAPI, targetEmail); From 50750f254748084112251c2a00959ca5a32d295d Mon Sep 17 00:00:00 2001 From: Park Juhyung Date: Fri, 25 Oct 2019 18:07:44 +0900 Subject: [PATCH 4/4] [monitor] Send start notification --- monitor/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/monitor/index.ts b/monitor/index.ts index 9b96c27b..baa386c9 100644 --- a/monitor/index.ts +++ b/monitor/index.ts @@ -54,6 +54,18 @@ function sendNotice(error: Notification, targetEmail: string) { } } +function sendStart(targetEmail: string, networkId: string) { + const message = `[${networkId}] monitor start`; + SlackNotification.instance.send({ + title: message, + text: "", + color: "good" + }); + emailClient + .sendAnnouncement(targetEmail, message, message) + .catch(console.error); +} + const checkDeath = (() => { let prevBestBlockNumber = 0; return async (rpc: Rpc, targetEmail: string, networkId: string) => { @@ -293,6 +305,8 @@ async function main() { lastDate = new Date().getUTCDate(); + sendStart(targetEmail, networkId); + // 10 minutes interval setInterval(checkDayChange, 10 * 60 * 1000, targetEmail, networkId);