The Monitoring Server Application (MSA) is part of a distributed server health monitoring system. It's a Node.js application designed to receive, forward, and store system metrics.
These instructions will help you get the project up and running on your local machine for development and testing purposes.
- Node.js v14.0.0 or later
- npm v6.0.0 or later
First, clone the repository to your local machine:
git clone https://github.com/your-username/monitoring-server-application.git
cd monitoring-server-application
Then, install the project dependencies:
npm install
Create a .env file in the project root to configure the application. You can use .env.example as a reference. Here are the environment variables you need to set:
LEADER_SERVER_URL: The URL of the leader server to which this application should forward metrics (if not a leader itself). SERVER_ID: The unique identifier for this server. PORT: The port on which this application will run.
To start the server, run:
npm start
The application will start running at http://localhost:${PORT}
.
POST /api/metrics
: Endpoint for sending server metrics to the application.
You can use a tool like Postman to test the API endpoints. Send a POST request with a JSON body to http://localhost:${PORT}/api/metrics.
- Node.js - JavaScript runtime
- Express.js - Web application framework
- Winston - Logging library