check_logs.pl gets 'uninitilized value'

Bret Goodfellow Bret.Goodfellow at questar.com
Thu Nov 13 00:08:48 CET 2008


Hi all,

I have been running a perl plugin, check_logs.pl, on a RHEL server for several months (no changes to my knowledge).  But, this week the plugin is having trouble.  When it runs, an 'uninitialized value' warning is produced.  Below is the shell output:

[root at twin plugins]# ./check_logs.pl -c /etc/nagios/check_logs_linux.cfg
Use of uninitialized value in numeric ne (!=) at ./check_logs.pl line 81.
messages => (1): Nov 12 10:39:23 twin root: HELLO THERE!;
[root at twin plugins]#

This same code is running just fine on 29 other RHEL servers.  How do I eliminate the 'uninitialized value' message?  Below is the code starting from line 73:

73    # Open log file
74    open LOG_FILE, $cnf->{'file_name'} || die "Unable to open log file $cnf->{'file_name'}: $!";
75    # Try to open log seek file.  If open fails, we seek from beginning of
76    # file by default.
77    if (open(SEEK_FILE, $seek_file)) {
78        chomp(@seek_pos = <SEEK_FILE>);
79        close(SEEK_FILE);
80        #  If file is empty, no need to seek...
81        if ($seek_pos[0] != 0) {
82            # Compare seek position to actual file size.  If file size is smaller
82            # then we just start from beginning i.e. file was rotated, etc.
84            ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat(LOG_FILE);
85            if ($seek_pos[0] <= $size) {
86                seek(LOG_FILE, $seek_pos[0], 0);
87            }
88        }
89    }

Any ideas?

Regards,

Bret Goodfellow

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list