Net::Prometheus::ProcessCollector::linux - Process Collector for linux OS


   use Net::Prometheus;
   use Net::Prometheus::ProcessCollector::linux;

   my $prometheus = Net::Prometheus->new;

   $prometheus->register( Net::Prometheus::ProcessCollector::linux->new );


This class provides a Net::Prometheus collector instance to provide process-wide metrics for a process running on the linux operating system.

At collection time, if the requested process does not exist, no metrics are returned.

Other Process Collection

The pid argument allows the collector to collect from processes other than the one actually running the code.

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 process_open_fds metric will not be returned.



   $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:

pid => STR

The numerical PID to collect information about; defaults to the string "self" allowing the exporter to collect information about itself, even over fork calls.

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.


Paul Evans <>