ONO::Core::HostOS

ONO_Core_HostOS is responsible for low level communication with the host operating system.

Using this module in production projects should be avoided whenever possible, try to use ONO::IO or other library / toolbox features instead.

Functions

cpan();

Returns a list of CPAN Perl Modules that are recommended for ONO, and that are required for all ONO features to be fully functional.

Switches:

-H human readable information about requirements (HTML)

ONO::Core::HostOS->cpan( );
returns: ($CPAN,$err1,$err2)

cpu_cores();

Return the number of current CPU cores.

ONO::Core::HostOS->cpu_cores( );
returns: $cores

cpu_load();

Return the current CPU load as an array (UNIX-like format).

ONO::Core::HostOS->cpu_load( );
returns: ($l1,$l2,$l3)

cpu_load_cached();

Return the current CPU load, which is being cached for 5 seconds. This returns a scalar value, which is the current load.

ONO::Core::HostOS->cpu_load_cached( );
returns: $cpu_load_cached

cpu_load_pass();

CPU load threshold test, using the format cpu_load_pass(percent).

Returns 1 if load LOWER than percent Returns 0 if load HIGHER than percent

Example: ONO_Core_HostOS->cpu_load_pass(50) will thus allow to execute code if the ENTIRE load of the system is LOWER than 50 percent

Don't use this function here if possible, use ONO::IO->sysload() instead.

ONO::Core::HostOS->cpu_load_pass( );

cpu_load_percent();

Return the current CPU load as percentage, taking multiple CPU cores and multithreading into consideration.

By default, this returns 3x percentage, 3x absolute, plus the number of cores.

-c current (returns string instead of array)

ONO::Core::HostOS->cpu_load_percent( );

host_os();

Returns the host os type, either BSD/UNIX or MacOS. This is required at the ONO::Core level, as MacOS is different from other systems in some ways. Linux distributions will simply be identified as BSD/UNIX systems.

ONO::Core::HostOS->host_os( );
returns: $HOSTOS

mem();

Return current total memory of the system.

ONO::Core::HostOS->mem( );
returns: $mem

mem_load();

Return current memory load, detailed (total, used, free, percent, percent).

ONO::Core::HostOS->mem_load( );

mem_load_percent();

Return current memory load, as percentage.

ONO::Core::HostOS->mem_load_percent( );

mysql();

Return the current MySQL version.

ONO::Core::HostOS->mysql( );

perl();

Return the current Perl version.

ONO::Core::HostOS->perl( );
returns: "Perl $1"

system();

Returns the host os type, plus some additional system information.

ONO::Core::HostOS->system( );
returns: $SYS

system_status();

Return the current system status, or system health.

Switches:

-h human readable
-H human readable in colored box

ONO::Core::HostOS->system_status( );

who();

List UNIX users who are currently online on the host OS.

ONO::Core::HostOS->who( );
returns: @who

Internal Functions

_cpu_cores();

Internal function, helps to detect CPU cores. Don't use this, use cpu_cores() instead.

&_cpu_cores( );
returns: $cores

Sub-Modules

none

Dependencies