.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::Prometheus::ProcessCollector::linux 3pm" .TH Net::Prometheus::ProcessCollector::linux 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "Net::Prometheus::ProcessCollector::linux" \- Process Collector for linux OS .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Net::Prometheus; \& use Net::Prometheus::ProcessCollector::linux; \& \& my $prometheus = Net::Prometheus\->new; \& \& $prometheus\->register( Net::Prometheus::ProcessCollector::linux\->new ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This class provides a Net::Prometheus collector instance to provide process-wide metrics for a process running on the \fIlinux\fR operating system. .PP At collection time, if the requested process does not exist, no metrics are returned. .SS "Other Process Collection" .IX Subsection "Other Process Collection" The \f(CW\*(C`pid\*(C'\fR argument allows the collector to collect from processes other than the one actually running the code. .PP Note also that 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/fd" directory of processes they don't own. In this case, the \&\f(CW\*(C`process_open_fds\*(C'\fR metric will not be returned. .SH CONSTRUCTOR .IX Header "CONSTRUCTOR" .SS new .IX Subsection "new" .Vb 1 \& $collector = Net::Prometheus::ProcessCollector::linux\->new( %args ) .Ve .PP As well as the default arguments supported by Net::Prometheus::ProcessCollector, the following extra named arguments are recognised: .IP "pid => STR" 4 .IX Item "pid => STR" The numerical PID to collect information about; defaults to the string \&\f(CW"self"\fR allowing the exporter to collect information about itself, even over fork calls. .Sp If the collector is collecting from \f(CW"self"\fR 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 \f(CWreaddir()\fR handle being used to collect that count. If it is collecting a different process, it will not. .SH AUTHOR .IX Header "AUTHOR" Paul Evans