Your code states:
my $accepts = -1;
my $handled = -1;
my $requests = -1;
And your output is:
nginx_active:-1 nginx_reading:-1 nginx_writing:-1 nginx_waiting:-1
Therefore, because you test:
$content[2] =~ /^\s+(\d+)\s+(\d+)\s+(\d+)\s*$/
... it follows that $content[2]
does not contain the information your regular expression demands. Have you tried adding print $content[2] . "\n";
to help debug your script?
The Debugger
Please consider use of the Perl debugger. It will answer obvious problems very quickly for you.
Start your script using the -d
flag. Then step through your code one line at a time using n
to go to the next line, l
to list the code at the current point, and x @content
(for example) to list the contents of variables each step of the way.