Run CRON jobs to notify on Discord if an HTTP endoint is down
- Requirements
- Clone the project
git clone https://github.com/MikyStar/UpMonitor.git
- Create a configuration file
cp config/config.example.ts config/config.ts
Edit it according to the config file section
- Install dependencies
pnpm i
- Run server
pnpm start
# OR run with pm2, check npm scripts for more
pnpm daemon:start
WARNING:
Discord connection at startup often fails, hence using PM2 for restarts
You should make your own configuration file at config/config.ts based on config/config.example.ts
import { IConfig } from './IConfig'; // Provides IntelliSense
export const config: IConfig = {
discordToken: 'Token',
errorsChannelID: 'Global Discord errors channel ID',
logsChannelID: 'Global Discord logs channel ID',
endpointsConfigs: [
{
name: 'Endpoint name',
url: 'http://url.com',
expectedStatusCode: 200,
channelID: 'Discord Channel ID',
cronJobSchedule: '15 14 1 * *', // At 14:15 on day-of-month 1
// Optional, here are the default values
retry: {
times: 2,
waitSeconds: 30,
}
},
],
};
- Go to Discord developper console
- Create an application
- Generate connexion token
- Go to Bot section
- Reset secret
- Copy
- Invite to channel
- Go to OAuth section
- Go to URL Generator
- Scope > Bot > Send Messages
- Copy URL
- Open URL and follow the invite process
- Go to the channel's settings in Discord App
- Add member and toggle it's permissions so that it can send messages
Using CLI-Manager for task handling.