Dear readers,

I recently find myself using Prometheus database,
I found about the perl `binding` Net::Prometheus

Net::Prometheus provides a way to export metrics to
the databases.

The Any::Metrics generalize the concept to make perl code
not 'glued' to Prometheus.

Net::Prometheus provides a few metrics which are linux dependant,
in Net::Prometheus::ProcessCollector::linux
For example , the Package is using the `/proc/$pid/fd` info .

Perl posses an abstract for processes with Proc::ProcessTable::Process
but this , just like the 'ps' command, lacks the amount of file
opened by a process (which could be quite helpful, this resource
is limited).

Personally I will -unless strongly advised against-
write a XS package to get that metric in OpenBSD
with kvm_getfiles.

The only way i currently know to get this info is using `fstat $pid | wc -l`,
fstat , being a lsof in bsds.

BSD::Process does not have this either but is using the 'kvm' system.

Linking all of this may create too many dependencies,
nevertheless I know some perl code could be quite smart to
opt in certains sub routines if the right module is available .
So this could be done through 'soft'  dependencies. - I do not know
what you call those packages that are optional but work together.

Of course i will have to name the package, i saw OpenBSD::Checkpass
so it could be OpenBSD::Kvm_getfiles
But it also is a specific implementation so if
Proc::ProcessTable::Process::Files ( which would be the number of  file open
and maybe some limits info like the one found in the class limits/login.conf )
It would look like Proc::ProcessTable::Process::OpenBSD
which seems way too long.

So i guess OpenBSD::Kvm_getfiles is completely enough
Especially since BSD::Process is not OpenBSD compatible
and  freebsd use procstat_getfiles  while openbsd use kvm_getfiles.

Thank you for reading that far, stay safe and
have a good one.

Reply via email to