[Nagiosplug-help] retrieve (Storable) can not open files
    Ingo Lantschner 
    ingo.lists at vum.at
       
    Tue Apr 24 22:11:27 CEST 2007
    
    
  
Hi,
writing a script for someone who uses Nagios 2.7 I used the Perl- 
module Storable to save a hash to disk (it's the config of a FC- 
switch) in order to have a reference for further checks. Using this  
plugin from the commandline is ok:
     # su - nagios
     $ /usr/lib/nagios/plugins/check_fabric.pl --host=1.2.3.4
     OK - no change in config since <filedate>
But in Nagios I get: CRITICAL - (No output!)
Only after I put the path for saving the config-hashes onto a  
directory one level above the homedir of Nagios, the check worked  
also, when called from within Nagios.
So I see two questions:
1. What's the difference between calling a check from the command- 
line (as nagios, with "su -" before) compared to calling it as Nagios- 
daemon.
2. Any idea, how this can happen?
For completeness: It must have to do with the retrieve-command from  
Perl::Storable, since:
    ...some code ...
    exit 3;
    my $config = retrieve($filename);
    ... some more code ...
returns UNKNOWN (No output!)
But
     ... some code ...
     my $config = retrieve($filename);
     if (!defined $config) { exit 3}
     print "Blabla after retrieve";
     exit 3;
     ... some more code ...
returns CRITICAL (No output!)
So somehow retrieve kills the program depending on where the files  
are located.
Homedir of nagios: /nfs-storage/nagios2/home/ (not ok to store files  
there, if check run from within Nagios)
This dir worked for storing the files, even when the script was  
called from within Nagios: /nfs-storage/nagios2/
TIA for any hint, Ingo.
-- 
Ingo Lantschner
Vienna/Austria
Mob (+43-664) 143 84 18
    
    
More information about the Help
mailing list