Giter Club home page Giter Club logo

uptime-monitor's Introduction

Uptime Monitor

Uptime Monitor is a self-hosted web monitoring tool, built with laravel.

Features

  • Monitor your web uptime per minutes (or any time interval)
  • Record response time on each web
  • Show uptime badges in 3 colors: green for up, yellow for warning, red for down, based on response time
  • Send telegram notification when you site down for 5 minutes (based on check periode)

Why I need this?

  • Open-source, modify as you need
  • Self-hosted, deploy on your own server
  • Store and control your monitoring logs yourself
  • Let you know when your websites are down
  • For freelancer/agency, increase your client's trust because you monitor their website

How to Install

Server Requirements

This application can be installed on local server and online server with these specifications:

  1. PHP 8.1 (and meet Laravel 10.x requirements).
  2. MySQL or MariaDB Database.
  3. SQLite (for automated testing).

Installation Steps

  1. Clone repository: git clone https://github.com/nafiesl/uptime-monitor.git
  2. $ cd uptime-monitor
  3. Install PHP dependencies: $ composer install
  4. Install javscript dependencies: $ npm install
  5. Copy .env.example to .env: $ cp .env.example .env
  6. Generate application key: $ php artisan key:generate
  7. Create a MySQL or MariaDB database.
  8. Configure database and environment variables .env.
    APP_URL=http://localhost:8000
    APP_TIMEZOME="Asia/Jakarta"
    
    DB_DATABASE=homestead
    DB_USERNAME=homestead
    DB_PASSWORD=secret
    
    TELEGRAM_NOTIFER_TOKEN=
    
  9. Run database migration: $ php artisan migrate --seed
  10. Build assets: $ npm run build
  11. Run task scheduler: $ php artisan schedule:work
  12. Start server in a separeted terminal tab: $ php artisan serve
  13. Open the web app: http://localhost:8000.
  14. Login using default user credential:
  15. Go to Customer Site menu.
  16. Add some new customer sites (name and URL).
  17. After adding customer sites, go to Dashboard
  18. Click Start Monitoring to update the uptime badge per minute.

Telegram Notifier Setup

In order to get notified in Telegram when the customer sites are down, we need to use a Telegram Bot and a Chat ID

  1. Create a Telegram Bot (how to)
  2. Get a Chat ID of the Telegram Bot (how to)
  3. Update .env file, set TELEGRAM_NOTIFER_TOKEN=your_telegram_bot_token
  4. Set our Chat ID in the Profile Page.
    • Go to User Profile Menu
    • Click Edit Profile
    • Fill the Telegram Chat ID field with your_chat_id
    • Click Update Profile
    • Click Test Telegram Chat to test the telegram configuration
  5. By default, we will have 5 minutes inteval when the customer sites are down. But we can change the interval per customer sites.
    • Go to Customer Site menu
    • Select one of the customer site and click Edit link
    • Set the Notify User Interval field, between 0 to 60.
    • Set the Notify User Interval field to 0 if you don't want to get notified.

Screenshot

Dashboard

screen_2023-12-20_004

Dashboard in mobile device

screen_2023-12-20_009

Monitoring graph on customer site detail

screen_2023-12-20_005

Monitoring log tab on customer site detail

screen_2023-12-20_006

User profile menu

screen_2023-12-20_007

Telegram notification sample

screen_2023-12-20_008

Lisensi

Uptime Monitor project is an open-sourced software licensed under the Lisensi MIT.

uptime-monitor's People

Contributors

nafiesl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

uptime-monitor's Issues

cURL error 60: SSL certificate problem: unable to get local issuer certificate when click Check Now button on detail

Hi @nafiesl what a nice library you have here.
but I ran through this error when try to click the "Check Now" button on detail client

Screenshot 2024-01-09 105329
Request

curl "http://localhost:8000/customer_sites/1/check_now" \
   -X POST \
   -H 'host: localhost:8000' \
   -H 'connection: keep-alive' \
   -H 'content-length: 47' \
   -H 'cache-control: max-age=0' \
   -H 'sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"' \
   -H 'sec-ch-ua-mobile: ?0' \
   -H 'sec-ch-ua-platform: "Windows"' \
   -H 'upgrade-insecure-requests: 1' \
   -H 'origin: http://localhost:8000' \
   -H 'content-type: application/x-www-form-urlencoded' \
   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \
   -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
   -H 'sec-fetch-site: same-origin' \
   -H 'sec-fetch-mode: navigate' \
   -H 'sec-fetch-user: ?1' \
   -H 'sec-fetch-dest: document' \
   -H 'referer: http://localhost:8000/customer_sites/1' \
   -H 'accept-encoding: gzip, deflate, br' \
   -H 'accept-language: en-US,en;q=0.9' \
   -H 'cookie: _ga=GA1.1.1322664234.1703033577; _fbp=fb.0.1703033579313.1311267758; _ga_7VCYHHC85N=GS1.1.1703048711.3.1.1703049107.0.0.0; remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d=eyJpdiI6IlJQU2xicG91ZUxobWJ3c1gvSFRWT1E9PSIsInZhbHVlIjoiM3VsVDhXWS9yNzkvYTRvWXVYQUl6amVmbUVkRmd3NU9RZmFwRTUzaHlrN0RjNko4VXdTQ0toY1J5c1R6MHFLbkJBd05XTTZMb1Q5VkhSL0ZpTzhnU1M0ZWVIUC9YbU5Zd2hRU0JtV3FBRjdMdjlRaXNuMFhGL3E1eFRDdW9ObklWOUVPT01DcDBkRVNNczVLT3NIVEplektKZ25LUXU4TmdROXNqeVRudzZtRUxuQlFidStKd3RKcTBqRXBvSUhXQTBRNTk0YldNN2hJNWtWbExmVXdlVDBlSkZrNjFrU0tMSWN0NGVqOTVLQT0iLCJtYWMiOiIzMzVlOGI1NjhjMmM5NzkyYjcxYTc4ZTRkMzVlMTYwNGVmYjI4MTRkMmIxZGIxNzQ1OTJlZmY4Zjk2NGQ2OTNmIiwidGFnIjoiIn0%3D; XSRF-TOKEN=eyJpdiI6IkFObUJUbU9DdTRycEx6MmZNV1FRM2c9PSIsInZhbHVlIjoidENteXhQSENKOWxNbjVJcVcrWVNSSjB6Z0JEMGVia0JkeEpOaXZRRXFZZmNmQlo1M1ZxNzBmQ2d0VzZYdk1INjhSZ1RnV0hPNkVyemUzK1pkMFgwMDR5UENFclFDMkNUZ3E3ZE5tcXp1V1VjTHhpdUZ3b1A4b3lWdFlHc2lrYmgiLCJtYWMiOiIxNWIwNzJlMzg3ZmYzYTcwODhhMjc3Nzg5NDdhNzYxZmM2MTJmMjhiMjhhZjhkZWZhZjA1ODZhNmM0MjgzMjBhIiwidGFnIjoiIn0%3D; uptime_monitor_session=eyJpdiI6IjNUZjJFcWNDaVRxdGZVUHQwWXZGaXc9PSIsInZhbHVlIjoiSjUzN2ROMDd0Vy8zKzVrUHJTRWtGbG9EakFydG1pTzAvM0dEVlhLZmJZOE5nYkdRZ2RoQngzZmM3M0xxU1A2QlVWWmpudUMwZWJlZzdkVHpwZTRjK0sxRkR5eFo5NHVOSTFFZ2YwVzcxMytZbUF5MUZ4VmRWQ2oySnFxY2FPc3YiLCJtYWMiOiI4NmYwMDNkODM0MjliMGNmOTE0MTgzNzhjY2VmMDk0NjkyZjIzODliY2ZiYjBiZjMxMDRiNWFhMGZhOTczYWYzIiwidGFnIjoiIn0%3D' \
   -F '_token=WI9wQioA8zuO604f9o0Dypd00cUO3lLzBVnF1PSw'

do you know what causing this error and what should I do to prevent this? thanks

Proposal: Telegram Chat Test Button

Goal

After setting up the Telegram Bot Token and Chat ID from this documentation, some users asking me how they can ensure that the telegram configuration works. Because currently, the telegram chat will only be sent by the system when our customer sites are down.

So we need a "test notification" button on the user profile page. When user click the button, they will get the notification from their telegram bot.

Checklist

  • A "Test Notification" button on the user profile page
  • The Telegram bot will send a message "Test from Uptime Monitor" when user click the button.
  • Show error messages that return from the telegram API response

Performance Improvement for the URL Check Task Schedule

Goal

We are relying on the task scheduler to check our website URL uptime. As we know, the task scheduler will be run every minute (based on the cron configuration). Imagine having hundreds of customer sites, there might be more than 1 minute. If we estimate 1 URL check needs 500ms, then 1 minute will only be for 120 URLs (customer sites), maybe more.

In order to make hundreds of customer site checks possible, we can use Laravel queue system.

Here is the possible workaround.

  1. We enable the laravel queue configuration, the easiest way is using the database queue driver
  2. The task scheduler only needs to dispatch the RunCheck job to the queue.
  3. The customer site check will be done in the background
  4. If we are using ubuntu (or other linux distro), we can utilize Supervisor to run the queue:work command (check the docs).
  5. The more processes we set (numprocs), the more run checks can be run in parallel.

Checklist

Here are what to do:

  • Add laravel queue table migration
  • Configure and test the queue locally
  • Write documentation of how to use it locally (in localhost).
  • Write documentation of how to run it in production.

Notes

  1. This might work for VPS deployment
  2. But might not work for shared hosting deployment.

Proposal: Add Check Now button on Customer Site Detail page

Goal

Sometimes we need to check the URL immediately without waiting for the scheduler (every minutes). So we need to have a button for check the URL manually.

Checklist

  • Add a "Check Now" button on the customer detail page
  • Refresh the customer detail page after clicking button

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.