Net::P...:linux(3pm)
π NAME π
ok so bestie, this is "Net::Prometheus::ProcessCollector::linux" β a Process Collector for the linux OS. yes the quotes are literally part of the name in the manpage, we keep them, we don't question them. periodt. β¨
πΈ SYNOPSIS πΈ
the whole vibe, verbatim, no notes:
use Net::Prometheus;
use Net::Prometheus::ProcessCollector::linux;
my $prometheus = Net::Prometheus->new;
$prometheus->register( Net::Prometheus::ProcessCollector::linux->new );
that's it. that's the whole glow-up. π¦
π DESCRIPTION π
okay so this class hands you a Net::Prometheus collector instance whose entire job is to serve up process-wide metrics for a process running on the linux operating system. linux girlies rise π
and here's the cute part: at collection time, if the requested process does not exist, no metrics are returned. like, zero. nothing. ghosted. π
π Other Process Collection π
the pid argument lets the collector collect from processes other than the one actually running the code. main character energy is not required β you can stan someone else's process fr fr.
but bestie, heads up: scraping processes owned by other users may not be possible for non-root users. in particular, most systems do not let non-root users see the/proc/self/fddirectory of processes they don't own. in this case, theprocess_open_fdsmetric will not be returned. no metric, no apology, that's just the permission vibe check. π
β¨ CONSTRUCTOR β¨
new
$collector = Net::Prometheus::ProcessCollector::linux->new( %args )
as well as the default arguments supported by Net::Prometheus::ProcessCollector, the following extra named arguments are recognised β yes, just one, she's an icon:
pid => STRβ the numerical PID to collect information about; defaults to the string"self"allowing the exporter to collect information about itself, even overforkcalls.
and here's the fine print, pay attention: if the collector is collecting from "self" or from a numerical PID that matches its own PID, then it will subtract 1 from the count of open file handles, to account for the readdir() handle being used to collect that count. if it is collecting a different process, it will not. the math is mathing, but only for yourself. π₯
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the legend, the moment, the whole origin story. π«Ά
and that's the tea, bestie π β this absolute gem lives in the perl v5.42.3 docs, dated 2026-08-20, filed under Net::P...:linux(3pm). go forth and collect. slay. πβ¨π
π¦ where this page comes from
- ubuntu stonking: libnet-prometheus-perl 0.16-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms