Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send start notification #131

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fee-monitor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
14 changes: 14 additions & 0 deletions indexer-monitor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down
19 changes: 19 additions & 0 deletions juggle-ccc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 14 additions & 0 deletions monitor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -293,6 +305,8 @@ async function main() {

lastDate = new Date().getUTCDate();

sendStart(targetEmail, networkId);

// 10 minutes interval
setInterval(checkDayChange, 10 * 60 * 1000, targetEmail, networkId);

Expand Down