Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Check if a string or a chain provided by -s option is present in a file which is critical when the number of founded line(s) is bigger than one provided by -c option. It works with local file or with file on cifs sharing with smb protocol, in the futur, it would be on nfs, sftp, ftp etc ... This plugin requires that perl, perl-Filesys-SmbClient package are installed on the system. Under RHEL/CentOS or Fedora : yum --enablerepo=rpmforge install perl-Filesys-SmbClient Exit 0 on success, providing some information Exit 2 on failure.
Current Version
1.2
Last Release Date
2013-06-18
Owner
Alexandre Frandemiche
Website
http://www.slobberbone.net/dotclear/index.php?pages/check_file_content
Download URL
http://sourceforge.net/projects/nagioschkflcont/files/check_file_content.pl/download
License
GPL
Compatible With
Usage: ./check_file_content.pl -f <file> -P <protocol> [-u <user> -p <password> -d <domain>] -s <"search_expression"> -t <check_type> [-w <warn_level> -c <crit_level>] -V -h, --help print this help message -f, --filepath=PATHTOFILENAME full path to file to analyze -P, --protocol=PROTOCOL protocol used to acess file : LOCAL for local file (default), SMB for CIFS file -u, --user=USER user to login -p, --password=PASSWORD password -d, --domain=DOMAIN domain name -s, --search="EXPRESSION", expression to search in the specified file if check_type INCLUDE, if not, this is the expression to not find -x, --exception="EXPRESSION", exception expression to search in the specified file if check_type INCLUDE, if not, this is the expression to not search -t, --check_type=TYPE Type of search : INCLUDE for include at least the critical option, then the warning option EXCLUDE for exclude with a maximum of founded expression smaller than critical option -w, --warn=INTEGER number that will cause a warning -c, --critical=INTEGER number that will cause an error (Default: 1) -V, --version prints version number Note : The script will return * With warn and critical options: OK if we are able to found expression and the count result respect <warn_level> and depending check_type, WARNING if we are able to found expression and the count result unrespect <warn_level> and depending check_type, CRITICAL if we are able to found expression and the count result unrespect <crit_level> and depending check_type, UNKNOWN if we aren't able to read the file
Commands.cfg :
# 'check_file_content' command definition define command{ command_name check_file_content command_line $USER1$/check_file_content.pl -f $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$ -t $ARG6$ -s $ARG7$ -w $ARG8$ -c $ARG9$ }
# 'check_file_content_with_exception' command definition define command{ command_name check_file_content_with_exception command_line $USER1$/check_file_content.pl -f $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$ -t $ARG6$ -s $ARG7$ -x $ARG8$ -w $ARG9$ -c $ARG10$ }
Services.cfg :
define service{ use generic-service host_name my_file_server service_description Include at least 4 instances of "Provider : OK" in mytest.log check_command check_file_content!smb://server/dir/file.log!SMB!user!password!domain!INCLUDE!"Provider : OK"!5!3 normal_check_interval 10 }
define service{ use generic-service host_name my_file_server service_description Include at least 4 instances of "Provider : OK" in mytest.log with an exception check_command check_file_content_with_exception!smb://server/dir/file.log!SMB!user!password!domain!INCLUDE!"Provider : OK"!"Provider : OK but i m not sure"!5!3 normal_check_interval 10 }
For more informations : http://www.slobberbone.net/dotclear/index.php?pages/check_file_content
Where can i find: smb_file_contend?
./check_smb_file_content -f smb://w.x.y.z/Directory/file.txt -P SMB -u login -p password -s search_expression -t INCLUDE -w 1 -c 10
This plugin needs small patch: --- check_file_content.pl.orig 2015-09-15 13:44:43.941945012 +0200 +++ check_file_content.pl 2015-09-15 13:42:31.572945415 +0200 @@ -56,7 +56,7 @@ my $o_user= undef; # user my $o_password= undef; # password my $o_domain= undef; # domain -my @o_search= undef; # word or chain we search +my @o_search= (); # word or chain we search my @o_exception= undef; # exception word or chain we not search my $o_check_type= undef; # check type my $o_version= undef; # print version @@ -288,7 +288,7 @@ # Should match foreach (@o_search) { - if ($line =~ m/@o_search/) { + if ($line =~ m/$_/) { if ($exception==1) { if ($line =~ m/@o_exception/) { $found=0;
You must be logged in to submit a review.
To:
From: