AutoMonitor is a monitoring tool designed to check the status of Kafka and Camunda services. It notifies users via email if any service or Camunda job fails.
- Node.js
- npm
- TypeScript
-
Clone the repository:
- Clone it by:
git clone https://github.com/AbdallahElmallah/autoMonitor.git
- Navigate to the directory by:
cd automonitor
-
Install dependencies:
- To install dependencies, run:
npm install
-
Configure the application:
- Update the API endpoints and other constants in the
constants.ts
file located insrc/constants
. - Create a
.env
file in the root directory and add the following environment variables:EMAIL_USER= EMAIL_PASSWORD= EMAIL_RECEIVER= CAMUNDA_USER= CAMUNDA_PASSWORD=
- Update the API endpoints and other constants in the
-
To schedule the application to run periodically using cron:
- Copy the
cronjob
file from the project directory to/etc/cron.d/
:sudo cp cronjob /etc/cron.d/cronjob
- Set appropriate permissions for the cronjob file:
sudo chmod 0644 /etc/cron.d/cronjob
- Install the cronjob by running:
sudo crontab /etc/cron.d/cronjob
- Copy the
To start AutoMonitor, run:
npm start
This command compiles TypeScript files and starts the application.
AutoMonitor uses the following packages:
- axios: "^1.6.7"
- dotenv: "^16.4.5"
- nodemailer: "^6.9.11"
- typescript: "^5.3.3"
- Email Configuration: You can configure the email settings by modifying the
serverConfig
property that belongs toZohoEmailService
class insrc/services/zohoEmailService.ts
. Customize it to use a different SMTP server and port if needed.
To dockerize the application, follow these steps:
-
Build the Docker image:
sudo docker build -t automonitor .
-
Run the Docker container in detached mode:
sudo docker run -d --name automonitor automonitor
This will build the Docker image named automonitor
and run the container in detached mode with the name automonitor
.
To view the application logs, follow these steps:
-
Enter the Docker container using the
docker exec
command.docker exec -it automonitor /bin/bash
This command will open a bash shell within the Docker container.
-
Once inside the container, use the
cat
command to view the contents of thehealthCheck.log
file:cat logs/healthCheck.log
This command will display the contents of the
healthCheck.log
file located in the/usr/src/app/logs/
directory within the container.
This project is licensed under the ISC License.