Blog

Luis Majano

July 16, 2024

Spread the word


Share your thoughts

BoxLang has received a powerful boost with the introduction of bx-oshi, a revolutionary module that unveils the most intricate details of your system! Envision your BoxLang applications transforming into hardware experts, capable of uncovering hidden information about your CPU, memory, and even sensors like temperature and battery life.

What is BX-OSHI

We are so excited to release bx-oshi our newest module for BoxLang. This module is based on the great work of the oshi library https://github.com/oshi/oshi?tab=readme-ov-file#documentation. You can use this module to get information about the Operating System and Hardware of the machine you are running on. This is a great way to even get sensor information or embedded system information like battery, raspberry pi, android, etc. This is another step forward for our multi-runtime platform of BoxLang where you will be able to get deep insights into the runtime operating system and hardware.

OSHI is a free JNA-based (native) Operating System and Hardware Information library for Java. It does not require the installation of any additional native libraries and aims to provide a cross-platform implementation to retrieve system information, such as OS version, processes, memory and CPU usage, disks and partitions, devices, sensors, etc.

Installation

Installing the module is very easy. Let's start with an operating system install using our install-bx-module binary.

install-bx-module bx-oshi

If you are using BoxLang as a CommandBox server, then use Commandbox:

install bx-oshi

Supported Features

  • Computer System and firmware, baseboard
  • Operating System and Version/Build
  • Physical (core) and Logical (hyperthreaded) CPUs, processor groups, NUMA nodes
  • System and per-processor load, usage tick counters, interrupts, uptime
  • Process uptime, CPU, memory usage, user/group, command line args, thread details
  • Physical and virtual memory used/available
  • Mounted filesystems (type, usable and total space, options, reads and writes)
  • Disk drives (model, serial, size, reads and writes) and partitions
  • Network interfaces (IPs, bandwidth in/out), network parameters, TCP/UDP statistics
  • Battery state (% capacity, time remaining, power usage stats)
  • USB Devices
  • Connected displays (with EDID info), graphics and audio cards
  • Sensors (temperature, fan speeds, voltage) on some hardware

Contributed Capabilities

Here are the contributed functions in this module:

The following are also contributed functions provided by convenience:

  • getCpuUsage( [interval] ) : Gets the CPU usage of the system with a custom interval
  • getFreeSpace( path ) : Gets the free space of a drive
  • getTotalSpace( path ) : Gets the total space of a drive
  • getSystemFreeMemory() : Gets the free memory of the operating system
  • getSystemTotalMemory() : Gets the total memory of the operating system
  • getJVMFreeMemory() : Gets the free memory of the JVM
  • getJVMTotalMemory() : Gets the total memory of the JVM
  • getJVMMaxMemory() : Gets the max memory of the JVM

Please note that with access to the hardware and operating system, you can get a lot more information. Please visit the OSHI documentation for more information: https://www.oshi.ooo/oshi-core-java11/apidocs/com.github.oshi/oshi/package-summary.html

What is BoxLang?

BoxLang is a modern dynamic JVM language that can be deployed on multiple runtimes: operating system (Windows/Mac/*nix/Embedded), web server, lambda, iOS, android, web assembly, and more. BoxLang combines many features from different programming languages, including Java, ColdFusion, Python, Ruby, Go, and PHP, to provide developers with a modern and expressive syntax.

It is also a drop-in replacement for Adobe ColdFusion and Lucee Engines.

How to get started?

Visit our docs at https://boxlang.ortusbooks.com and get coding today. If you want to try it out on the web then go to our online REPL at https://try.boxlang.io. You can also checkout our YouTube playlist: https://www.youtube.com/playlist?list=PLNE-ZbNnndB-40LvAbeSeT2Oi3V2gm_B8

Add Your Comment

Recent Entries

TestBox Latest Updates and News!

TestBox Latest Updates and News!

We’re thrilled to have launched the new TestBox website and TestBox 6.0! If you haven’t had a chance to explore yet, visit TestBox to discover updated documentation, powerful resources, and features that make testing more efficient than ever.

Maria Jose Herrera
Maria Jose Herrera
November 21, 2024
Is Your ColdFusion Application Ready for the Future?

Is Your ColdFusion Application Ready for the Future?

In a rapidly evolving digital world, maintaining performance, security, and scalability for ColdFusion applications is more challenging than ever. Whether you're using Lucee or Adobe ColdFusion, legacy systems can become a bottleneck for growth, innovation, and user satisfaction. The need to future-proof your ColdFusion applications has never been more critical.

But where do you start?


The Hidden Costs of an Outdated ColdFusion Application

As you...

Cristobal Escobar
Cristobal Escobar
November 21, 2024
The Hidden Costs of In-House Database Management

The Hidden Costs of In-House Database Management

The Hidden Costs of In-House Database Management


Opting for in-house database management involves more than just a salary. Here are some often-overlooked costs associated with maintaining your own DBA team.



1. High Salaries and Benefits


Hiring skilled DBAs is expensive. According to industry reports, the average salary of a DBA in the U.S. can range from $85,000 to over $130,000 per year, depending on experience and expertise. When you add ...

Cristobal Escobar
Cristobal Escobar
November 20, 2024