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

servius

v1.1.4

Published

Servius is a comprehensive npm package for server monitoring,providing tracking of CPU load, free memory, disk usage, process count, and other important system resources. It also offers details on CPU, server uptime, last boot time, OS, disk partitions,pr

Downloads

14

Readme

Servius

Servius is a comprehensive npm package for server monitoring,providing tracking of CPU load, free memory, disk usage, process count, and other important system resources. It also offers details on CPU, server uptime, last boot time, OS, disk partitions,process management and Much More.

Supported Operating Systems

  • Linux

Example Usage

System Info

Uptime

const servius = require('servius')

// The function returns the amount of time that the system has been running.

const uptime = servius.uptime()

console.log(uptime)

/* Example Output =>
 * 3 weeks, 4 days, 1 hour, 27 minutes
 */

GetOS

const servius = require('servius')

// The `getOS` function retrieves information about the operating system running on the current system and returns an object containing details such as the distributor, name, version, and codename.

const os = servius.GetOS()

console.log(os)

/* Example Output => 
 *  {
 *   distributor: 'Ubuntu',
 *   name: 'Ubuntu 20.04.5 LTS',
 *   version: '20.04',
 *   codename: 'focal'
 *  }
 */

Boot Time

const servius = require('servius')

// The bootTime function retrieves the system's boot time .By Default This Function returns boot time in the format of `YYYY-MM-DD HH:MM:SS`, but if the `raw` parameter is true it will return the boot time in  the format of a Unix timestamp. The bootTime function can be useful for monitoring system performance and diagnosing issues related to system uptime.

const time = servius.bootTime(false) //here raw is false

console.log(time)

/* Example Output => 
 * 2023-02-22T14:24:16.000Z
 */

Get User

const servius = require('servius')

// The `getUsers` function retrieves information about currently logged-in users on the system and returns an array of objects, with each object containing details such as the user's name, terminal (tty), login date and time, and host. This function can be useful for monitoring system activity and identifying who is currently using the system.

const users = servius.getUsers()

console.log(users)

/* Example Output => 
 * [
 *      {
 *          name: 'root',
 *          tty: 'pts/5',
 *          date: '2023-03-19',
 *          time: '14:59',
 *          host: 'xxx.xxx.xxx.xxx'
 *      }
 *  ]
 */

Memory

Virutal Memory

const servius = require('servius')

// The `VirtualMemory` function retrieves information about the virtual memory usage of the current system, including the total amount of virtual memory available, the amount of virtual memory currently used, and the amount of virtual memory currently available for use etc. This function can be useful for monitoring system performance and diagnosing issues related to memory usage.

const mem = servius.VirtualMemory(false) // here raw is false

console.log(mem)

/* Example Output => 
 * {
 *     total: '31.87 GB',
 *     free: '15.89 GB',
 *     shared: '29.83 MB',
 *     chached: '3.82 GB',
 *     available: '22.76 GB'
 * }
 * Note: `Used` Has Been Removed For A While Will Be Added In Future Versions
 */

Swap Memory

const servius = require('servius')

/* The `SwapMemory` function retrieves information about the swap memory usage of the current system. The output includes the total amount of swap memory available, the amount of swap memory currently used, and the amount of swap memory currently available for use, as well as additional information about shared, cached memory, and availability.

This function can be useful for monitoring system performance and diagnosing issues related to memory usage. It provides information about the usage of swap memory, which is used when physical memory is full or when a process needs more memory than is physically available. */

const swapmem = servius.SwapMemory(false) // here raw is false

console.log(swapmem)

/* Example Output => 
 * {
 *     total: '0',
 *     used: '0',
 *     free: '0',
 *     shared: '0',
 *     chached: '0',
 *     available: '0'
 * }
 * **Note** This Only Works With System That Have Swap Enabled Otherwise It Will Return `0`
 */ 

Disk

VirtualDisk

const servius = require('servius')

/* The `VirtualDisk` function retrieves information about the usage of the disk space of the current system, including the total amount of disk space available, the amount of disk space currently used, the amount of disk space available for use, and the percentage of disk space used. This function can be useful for monitoring disk space usage and diagnosing issues related to storage. */

const disk = servius.VirtualDisk(false) // here raw is false

console.log(disk)

/* Example Output => 
 * {
 *    total: '496.03 GB',
 *    used: '96.34 GB',
 *    available: '399.68 GB',
 *    used_perc: '20%'
 * }
 */ 

DiskPart

const servius = require('servius')

/* The `DiskPart` function retrieves information about the disk partitions on the current system, including the partition name, filesystem type, size, and mount point. This function can be useful for inspecting the available disk space and identifying the location of specific files or directories. */

const diskpart = servius.DiskPart()

console.log(diskpart)

/* Example Output => 
 * [
  {
    name: 'sda',
    fstype: 'hfs',
    size: 512G,
    mountpoint: /dev
  },
  {
    name: 'sda1',
    fstype: 'hfs',
    size: '511.9G',
    mountpoint: /etc/hosts
  }
]
 */ 

Cpu

cpuTimes

const servius = require('servius')

/* Returns a Object That Contains The Time Taken By Cpu To Execute a Specefic Process. */

const cputimes = servius.cpuTimes()

console.log(cputimes)

/* Example Output => 
* {
*     user: '73.80',
*     system: '0.00',
*     nice: '0.00',
*     idle: '0.00',
*     steal: '0.00'
*  }*/ 

cpuCount

const servius = require('servius')

/* Returns the number of the logical cpu cores. */

const cpucount = servius.cpuCount()

console.log(cpucount)

/* Example Output => 
* 16
*/

cpu

const servius = require('servius')

/* The cpu function retrieves information about the CPU of the current system, including the CPU name, CPU speed, number of cores, and load average. This function can be useful for monitoring system performance and diagnosing issues related to CPU usage. */

const cpuinf = servius.cpu()

console.log(cpuinf)

/* Example Output => 
* {
*     name: 'Intel(R) Core(TM) i5 CPU 12400F @ 4.40GHz',
*     speed: 2826,
*     cores: 8,
*     loadAvg: [ 0.1, 0.2, 0.1]
*  }
*/