NAME
Sys::Monitor::Lite - Lightweight system monitoring toolkit with JSON/YAML 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 or YAML data for easy automation and integration with jq-lite, yq, or other tools that consume structured logs.
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.
to_yaml
my $yaml = Sys::Monitor::Lite::to_yaml($data);
Serialises the supplied data structure to a YAML string using a minimal built-in emitter.
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().
AUTHOR
Shingo Kawamura <pannakoota1@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.