check_portstatus.pl exiting OK, but Nagios whines

Hi all -

I have a perl script called check_portstatus.pl

This script checks for the last-used time on a Cisco switchport, and tells you how many ports are link-down, and for how long.
config details for those interested:
it-slav.net/blogs/2009/11/24 … 5-monitor/

This is what it does, when you run it manually:
[root@nagiosserver objects]# /usr/lib/nagios/plugins/check_portstatus.pl -H

That returns:
*OK: 12 of 53 ports available, 0 down, click here to view the report.
*

This is the error that I get when running the service.
MB-3560-2nd Portstatus CRITICAL 08-16-2011 14:57:30 21d 2h 38m 17s 3/3 (Service check did not exit properly)

So according to the manual output, I’m getting a normal value back, but Nagios is still saying that the service didn’t exit properly.

This used to work, btw –

System details:

Running: nagios-3.2.3-3.el5.rf

Service:
define service{
use generic-service
host_name MB-3560-2nd
service_description Portstatus
check_command check_portstatus
}

Command:
define command{
command_name check_portstatus
command_line $USER1$/check_portstatus.pl -H $HOSTADDRESS$
}

Most of the time when I’ve seen this kind of error it has to do with using the embedded Perl interpreter for Nagios.
Try explicitly stating Perl with

command_line perl $USER1$/check_portstatus.pl -H $HOSTADDRESS$

That was it!

Just made the change to use the system perl, and away we went!

Weird -

Now I just have to track down a reporting problem in the data – for some reason, the webpage only shows 3 days max for each port.
But when I run the command on the switch, the correct data is there.
Need to look at the /var/spool/portstatus data and see if it’s right, and then I’ll know whether it’s check_portstatus.pl or portstatus.php
that’s truncating data…