Wednesday, May 1, 2013

**ePN /usr/lib/nagios/plugins/check_hpasm: "Use of uninitialized value $_ in scalar chomp at (eval 21) line 340,".

We are running stock Nagios  on a Ubuntu 10.04 LTS server:

jemurray@nagios:/usr/lib/nagios/plugins$ /usr/sbin/nagios3 --version

Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL

We have been running the check_hpasm check script from for years with no problems.

After we installed and started running the F5 check script from:

All our HP ASM checks were failing with the error:

**ePN /usr/lib/nagios/plugins/check_hpasm: "Use of uninitialized value $_ in scalar chomp at (eval 21) line 340,". 

After verifying we had all the latest versions of the check_* scripts, we found the built in Perl interpreter to be the problem.   To fix the problem, you have to force Nagios to use the system Perl interpreter instead of the Nagios built in one.   To do this locate the check_nwc_health and check_hpasm script and add the following line towards the top of the script:
# nagios: -epn

For example here is the first 10 lines of the script:

#! /usr/bin/perl -w
# nagios: -epn
package Nagios::MiniPlugin;
use strict;
use Getopt::Long qw(:config no_ignore_case bundling);

After this update, everything started working fine again.