してみる

#!/usr/bin/perl

use strict;
use warnings;
use Unix::Lsof;
use Unix::PID;

my $pid = Unix::PID->new();
my $red5_pid = $pid->get_pidof('search for a process by this string');
unless ( $red5_pid ) {
    print '0';
    exit;
}

my ( $output, $error ) = lsof( '-p', $red5_pid, '-w' );
my @vals = values %{$output};
print scalar @{ $vals[0]{files} };

snmpd.conf に

exec fd_mon /path/to/fd_mon.pl

mrtg.cfg に

Target[fd]: .1.3.6.1.4.1.2021.8.1.101.1&.1.3.6.1.4.1.2021.8.1.101.1:public@localhost  
MaxBytes[fd]: 2000  
YLegend[fd]: File Descriptors  
ShortLegend[fd]:  
LegendI[fd]: / File Descriptors  
LegendO[fd]: /  
Legend1[fd]: / File Descriptors  
Legend2[fd]: /  
Title[fd]: File Descriptors  
PageTop[fd]:

# File Descriptors