NAME

Sys::Monitor::Lite - Lightweight system monitoring toolkit with JSON output

SYNOPSIS

use Sys::Monitor::Lite qw(collect_all to_json);
print Sys::Monitor::Lite::to_json(Sys::Monitor::Lite::collect_all());

DESCRIPTION

A minimal system monitor that outputs structured JSON data for easy automation and integration with jq-lite.

FUNCTIONS

collect_all

my $data = Sys::Monitor::Lite::collect_all();

Collects all available metrics and returns a hash reference keyed by metric name. This is a convenience wrapper around "collect" with no arguments.

collect

my $subset = Sys::Monitor::Lite::collect(['cpu', 'mem']);

Collects the metrics listed in the array reference (or list). Unknown metrics are ignored. The returned value matches the structure of "collect_all" but contains only the requested keys.

available_metrics

my @names = Sys::Monitor::Lite::available_metrics();

Returns a sorted list of metric names that the module can collect.

to_json

my $json = Sys::Monitor::Lite::to_json($data, pretty => 1);

Serialises the supplied data structure to a JSON string using JSON::PP. Pass pretty => 1 to enable human-readable output.

EXPORT

This module does not export any symbols by default. Functions can be called with their fully-qualified names, e.g. Sys::Monitor::Lite::collect_all().

SEE ALSO

"sys-monitor-lite" in script – command-line interface for this module.

AUTHOR

Shingo Kawamura <kpannakoota1@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2025 by Shingo Kawamura.

This is free software; you can redistribute it and/or modify it under the same terms as the MIT license included with this distribution.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 338:

Non-ASCII character seen before =encoding in '–'. Assuming UTF-8