Giter VIP home page Giter VIP logo

self-hosted-monitor's Introduction

Self-Hosted Monitor

This repository provides scripts to help you set up a self-hosted monitoring system for your VPS using Prometheus, Node Exporter, and Grafana. This setup enables you to collect and visualize metrics, and create alerts to monitor the health and performance of your servers.

What are Prometheus, Node Exporter, and Grafana?

  • Prometheus: An open-source monitoring system with a time series database. It collects and stores metrics as time series data, allowing users to query and alert on this data.
  • Node Exporter: A Prometheus exporter that collects a choice of hardware and OS metrics exposed by *NIX kernels based on config.
  • Grafana: An open-source platform for monitoring and observability. It allows you to visualize and alert on your metrics, with support for various data sources, including Prometheus.
Screenshot 2024-03-16 at 00 23 37

Recommended System Requirements for a Basic Monitor

  • 2 CPU cores
  • 4 GB of memory
  • 20 GB of free disk space

Setting Up the Monitoring Server

Prerequisites

  • Ensure you have root access or sufficient permissions to install packages and make network configurations.
  • The instructions are tailored for Debian/Ubuntu systems. Adapt commands accordingly for other distributions.

1. Install Git

Git is required to clone the repository containing the necessary scripts.

apt install git

2. Clone the Repository

Clone the repository to download the scripts to your server.

git clone https://github.com/ExploreNYM/self-hosted-monitor ~/self-hosted-monitor

3. Setup Prometheus

Execute the script to install and configure Prometheus.

chmod +x ~/self-hosted-monitor/prometheus.sh && ~/self-hosted-monitor/prometheus.sh

4. Setup Grafana

Run the script to install Grafana, which will be used for visualizing the data collected by Prometheus.

chmod +x ~/self-hosted-monitor/grafana.sh && ~/self-hosted-monitor/grafana.sh

5. Decide on Access Method for Grafana

Option A: HTTP Access (not recommended since it is unencrypted)

For accessing Grafana via HTTP:

ufw allow 3000

Then, access Grafana at http://your-ip-address:3000.

Option B: HTTPS Access via Personal Domain

If you prefer HTTPS access using your domain, ensure your domain DNS is pointing to your server's IP and then run the script to set up Nginx and Certbot for SSL:

chmod +x ~/self-hosted-monitor/nginx-certbot.sh && ~/self-hosted-monitor/nginx-certbot.sh

6. Add Scrape Target (can be run multiple times)

To monitor a new server, use this script to add it as a target to Prometheus.

chmod +x ~/self-hosted-monitor/prometheus-target.sh && ~/self-hosted-monitor/prometheus-target.sh

Setting Up the Target Server

These steps should be followed on the server you wish to monitor.

1. Install Git

apt install git

2. Clone the Repository

git clone https://github.com/ExploreNYM/self-hosted-monitor ~/self-hosted-monitor

3. Setup Node Exporter

This script installs Node Exporter, which will collect metrics to be scraped by Prometheus.

chmod +x ~/self-hosted-monitor/node-exporter.sh && ~/self-hosted-monitor/node-exporter.sh

Verification and Troubleshooting

  • After each installation step, verify that the service is running correctly. For example, check if Prometheus and Grafana services are active using systemctl status prometheus systemctl status grafana-server systemctl status node_exporter. Screenshot 2024-03-16 at 01 31 53
  • Access the Grafana UI by navigating to http://your-ip-address:3000 or https://your-domain based on your setup and confirm that the Prometheus data source is connected.
  • If you encounter issues, check the respective service logs for detailed error messages (e.g., journalctl -u prometheus).

Additional Resources

Need Help?

If you need help or want to contribute to the project, feel free to open an issue or a pull request in the repository.

self-hosted-monitor's People

Contributors

pawnflake avatar

Stargazers

Noisk8 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.