Skip to content

FireFlyDeveloper/UPtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UPtime

UPtime is a Node.js-based monitoring system designed to track the operational status of a device and notify stakeholders in real-time via email. It provides automated detection of offline devices, boot attempts, and boot failures, ensuring quick awareness and response to any interruptions.

Features

  • Real-time device monitoring: Continuously checks the device's heartbeat to determine if it is online or offline.

  • Automatic email notifications: Sends professional HTML email alerts for:

    • Device offline
    • Boot attempts
    • Boot failures
    • Successful boot
  • Philippine timezone support: All timestamps are automatically converted to Asia/Manila for accurate local tracking.

  • Retry mechanism for emails: Ensures email notifications are delivered reliably even if temporary network or API issues occur.

  • Visual notification design: Emails include a centered, clean container with GitHub profile integration for professional presentation.

  • Secure endpoint: Health check API is protected by a password to prevent unauthorized access.

  • Flexible configuration: Easily configurable using environment variables for Gmail OAuth credentials, target email, and device password.

  • Uses Gmail OAuth 2.0: Email sending is handled through Gmail API using secure OAuth access instead of less-secure app passwords.

Use Cases

  • Monitoring critical IoT devices in real-time.
  • Ensuring servers or embedded devices remain operational.
  • Receiving instant alerts for system failures or downtime.
  • Simplifying remote device management for administrators or support teams.

Device Integration

This server is designed to work with the UPtime for NodeMCU ESP8266 device:

A lightweight ESP8266 project that automatically sends periodic POST requests to a server for health monitoring. Useful for uptime checks, remote power automation, and simple IoT status reporting.

The ESP8266 device regularly sends heartbeat requests to this API, enabling real-time monitoring and automated email notifications.

Notifications Include

  • Device status (online/offline)
  • Boot attempt progress
  • Boot failures after predefined timeouts
  • Successful device boot
  • Localized timestamp in Philippine time for precise logging

Benefits

  • Proactive alerts: Prevent prolonged downtime by immediately notifying the responsible personnel.
  • Professional communication: Emails are visually appealing and informative, with clear status indicators.
  • Reliability: Email retries improve notification success even under temporary failures.
  • Simplicity: Easy to deploy and integrate into existing Node.js environments.

GitHub Integration

Email notifications include a link to the developer’s GitHub profile for credibility and contact reference: FireFlyDeveloper.

Getting Started

  1. Clone the repository

    git clone https://github.com/FireFlyDeveloper/UPtime.git
    cd UPtime
  2. Install dependencies

    npm install
  3. Create a .env file with the following configuration:

    PORT=3000
    PASSWORD=password_here
    EMAIL_USER=email_address_here
    EMAIL_TARGET=target_email_address_here
    GMAIL_CLIENT_ID=xxxx
    GMAIL_CLIENT_SECRET=xxxx
    GMAIL_REFRESH_TOKEN=xxxx
    GMAIL_REDIRECT_URI=xxxx
  4. Start the server

    npm run dev

    The server will start on the port defined in the .env file and begin monitoring device heartbeat.

  5. Health Check Endpoint

    Send a POST request to /health with your password and device status to update heartbeat:

    {
      "password": "your_password",
      "isOnline": true
    }

About

UPtime is a Node.js monitoring system that tracks device status in real-time and sends professional email alerts for offline events, boot attempts, and failures, with Philippine timezone timestamps and reliable retry notifications.

Resources

Stars

Watchers

Forks

Contributors