SysMonitoring
  • Introduction
  • Installation
  • Configuration
  • Troubleshooting
  • Functions
    • startServer()
    • stopServer()
    • getCpuLoad()
    • getMemoryUsage()
    • getPing()
  • API
    • /cpu
    • /memory
    • /ping
  • Terminal Commands
    • echo
    • time
    • help
    • stats
Powered by GitBook
On this page
  • Overview
  • Endpoint
  • Example
  • Response
  • Description
  1. API

/memory

/api/memory

Overview

The /api/memory endpoint returns the current memory usage of the system in the form of a JSON response.

Endpoint

GET /api/memory

Example

fetch('/api/memory')
  .then(response => response.json())
  .then(data => {
    console.log(`Memory Usage: ${data.memoryUsage}%`);
  });

Response

The response will return a JSON object containing the memoryUsage value:

{
  "memoryUsage": "72.35"
}

Description

  • /api/memory provides the current memory usage as a percentage of active memory.

  • It uses the getMemoryUsage() function internally to fetch the data.

  • The result is returned as a floating-point number with two decimal places, representing the percentage of memory used.

Previous/cpuNext/ping

Last updated 5 months ago