npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aura-uptime

v1.0.1

Published

Aura Uptime for uptime projects

Downloads

11

Readme

Aura Uptime

Aura Uptime is a powerful Node.js module designed to monitor the uptime of websites with high efficiency. Leveraging HTTP/2 and request compression, this module ensures requests are sent faster, making it highly suitable for uptime monitoring tasks. With extensive customization options and a JSON database, Aura Uptime is a top choice for those needing quick, reliable, and scalable uptime monitoring.

Features

  • High-Speed Monitoring: Utilizes HTTP/2 with request compression to enhance request speed, allowing for multiple simultaneous requests.
  • Customizable Monitoring Settings: Configure timeout durations, request counts, success codes, and more to tailor the monitoring to your needs.
  • Multiple Subscriptions: Choose between different subscription levels (Basic, Premium, Ultimate) to control request frequency and concurrent request limits.
  • JSON Database: All project data is saved in a JSON file, providing easy access and modifications.
  • Concurrency Control: Supports making multiple requests at the same time, significantly boosting the monitoring speed.
  • Flexible Project Management: Easily add, edit, and remove projects with simple commands.
  • Manual Requests: Perform manual checks on specific URLs to verify their status on demand.
  • Proxy Support: We support HTTP, SOCKS4 and SOCKS5 proxies.

Installation

npm install aura-uptime

Usage

Here’s an example of how to use Aura Uptime in your Node.js application:

const { UptimeClient } = require('aura-uptime');

// Client configuration
const client = new UptimeClient({
    name: "Aura Uptime",
    timeoutTime: 10000,
    requestCountInSameTime: 5,
    successRequestCodes: [200],
    database: "uptime/database.json",
    maxProjects: 500,
    maxRequestsToSave: 5,
    debug: true,
    subscriptions: [
        {
            name: "Basic",
            uptimeTime: 30000, // 30 seconds
            requestCountInSameTime: 3, // Sending requests in same time
        },
        {
            name: "Premium",
            uptimeTime: 15000, // 15 seconds
            requestCountInSameTime: 10, // Sending requests in same time
        },
        {
            name: "Ultimate",
            uptimeTime: 5000, // 5 seconds
            requestCountInSameTime: 20, // Sending requests in same time
        }
    ],
    proxies: [
        'Enter HTTP, SOCKS4 or SOCKS5 proxy to here'
    ] // Not required
});

async function run() {
    await client.initialize();

    // Adding a project
    const addProjectResult = await client.addProject({
        user: "817239812378123",
        url: "https://google.com",
        subscription: "Ultimate"
    });
    console.log("Add project result:", addProjectResult);

    // Editing a project
    const editProjectResult = await client.editProject({
        user: "817239812378123",
        url: "https://google.com",
        edit: { subscription: "Premium" }
    });
    console.log("Edit project result:", editProjectResult);

    // Fetching project information
    const project = await client.getProject({
        user: "817239812378123",
        url: "https://google.com"
    });
    console.log("Project info:", project);

    // Fetching all projects for a user
    const userProjects = await client.getUser('817239812378123');
    console.log("User Projects:", userProjects);

    // Making a manual request
    const manuelRequestResult = await client.manuelRequest({
        urls: ["https://google.com"],
        method: "GET"
    });
    console.log("Manual request result:", manuelRequestResult);

    // Removing a project
    const removeProjectResult = await client.removeProject({
        user: "817239812378123",
        url: "https://google.com"
    });
    console.log("Remove project result:", removeProjectResult);

    // Editing client settings
    const editClientResult = await client.editClient({
        timeoutTime: 15000,
        maxProjects: 1000
    });
    console.log("Edit client result:", editClientResult);

    // Start monitoring
    client.startMonitoring();

    // Stop monitoring after a specific time
    setTimeout(() => {
        client.stopMonitoring();
        console.log("Monitoring stopped.");
    }, 30000); // Stops monitoring after 30 seconds
}

run().catch(console.error);

Configuration Options

  • timeoutTime: Sets the timeout for each request.
  • requestCountInSameTime: Specifies the number of requests that can be made at the same time.
  • successRequestCodes: List of HTTP status codes considered as successful requests.
  • database: Path to the JSON database file where project data is stored.
  • maxProjects: Limits the maximum number of projects that can be added.
  • maxRequestsToSave: Determines how many recent requests will be saved in the database.
  • debug: Logs messages to console.
  • proxies: Uses proxies for requests

Subscription Levels

  • Basic: 10-minute interval between checks with up to 3 simultaneous requests.
  • Premium: 15-second interval between checks with up to 10 simultaneous requests.
  • Ultimate: 5-second interval between checks with up to 20 simultaneous requests.

Database Structure

  • name: The name of the monitoring service (e.g., "Aura Uptime").
  • timeoutTime: Timeout setting for requests.
  • successRequestCodes: Accepted HTTP status codes.
  • database: Path to the JSON database file.
  • subscriptions: Details of subscription plans, including uptimeTime and requestCountInSameTime.
  • projects: List of monitored projects, each containing:
    • user: The user's ID.
    • online: Status of the project (true/false).
    • lastCheck: Timestamp of the last check.
    • url: The monitored URL.
    • subscription: The subscription level.
    • requests: History of requests with details like online status, HTTP code, request ID, speed, and timestamp.

License

Apache 2.0 License