Skip to content

ibadeeCodes/prometheus-grafana-nodejs-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus, Grafana, and Node.js Server

This project demonstrates a simple Node.js Express server integrated with Prometheus for metrics collection and Grafana for visualization.

🚀 Features

  • Express Server: Simple API with standard and slow endpoints.
  • Prometheus Integration: Uses prom-client to expose metrics at /metrics.
  • Dockerized Monitoring: Prometheus and Grafana are set up via Docker Compose.

🛠️ Prerequisites

🏃 Getting Started

1. Start the Node.js Server

Install dependencies and start the server:

npm install
npm run dev

The server will be running at http://localhost:3002.

2. Start Monitoring (Prometheus & Grafana)

To start Prometheus and Grafana, use the following command:

docker-compose up -d

Docker Command specifically for Grafana

If you want to run Grafana separately using Docker:

docker run -d --name=grafana -p 3000:3000 grafana/grafana:latest

📊 Endpoints

  • GET /: Basic "Server is up and running" response.
  • GET /slow: A mock slow endpoint (1-3s delay) with a 20% error rate for testing latency and error metrics.
  • GET /metrics: Prometheus metrics endpoint.

📈 Monitoring Dashboards

⚙️ Configuration

  • index.js: Main server logic and metrics definitions.
  • prometheus-config.yml: Prometheus scrape configuration (targets the Node.js server).
  • docker-compose.yml: Docker services for Prometheus and Grafana.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors