Description of problem: Calling check_file_age is broken: # /usr/lib64/nagios/plugins/check_file_age Can't locate utils.pm in @INC (you may need to install the utils module) (@INC contains: . /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /usr/lib64/nagios/plugins/check_file_age line 30. Version-Release number of selected component (if applicable): # rpm -q nagios-plugins-file_age nagios-plugins-file_age-2.1.1-1.fc24.x86_64 How reproducible: Steps to Reproduce: See above. Additional info: Upstream fix: https://github.com/nagios-plugins/nagios-plugins/pull/106/commits/d46c3a8d263f2936fb79df3d02cd0f855dd94a13
Created attachment 1191856 [details] Patch to 2.1.2 An update to 2.1.2 fixes this. Proposed patch for the .spec attached.
Any news on this? It's still broken.
nagios-plugins-2.1.4-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-8ada3d2a1f
nagios-plugins-2.1.4-2.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-dc9e470823
nagios-plugins-2.1.4-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f30fae0f67
nagios-plugins-2.1.4-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-8586235698
nagios-plugins-2.1.4-2.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-17165c490b
nagios-plugins-2.1.4-2.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-17165c490b
nagios-plugins-2.1.4-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-8ada3d2a1f
nagios-plugins-2.1.4-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f30fae0f67
nagios-plugins-2.1.4-2.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-dc9e470823
nagios-plugins-2.1.4-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-8586235698
nagios-plugins-2.1.4-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
nagios-plugins-2.1.4-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
nagios-plugins-2.1.4-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.
nagios-plugins-2.1.4-2.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.
Please kindly note that nagios-plugins-2.1.4-2.el6 is BROKEN. Just try to crate a dummy file ( > test.ok ) and test it. You will get File not found, CRIT. error. (I'm fixing this for 2h now, thats to all auto-appliend ERATAs, 12 serveers done, 5 to go) --- # ls -al /usr/lib64/nagios/plugins/check_file_age -rwxr-xr-x. 1 root root 3843 Dec 17 00:09 /usr/lib64/nagios/plugins/check_file_age # grep "print_revision" /usr/lib64/nagios/plugins/check_file_age print_revision($PROGNAME, '2.1.4'); # > test.ok # ls test.ok test.ok # /usr/lib64/nagios/plugins/check_file_age -c 0 -w 0 -f ./test.ok FILE_AGE CRITICAL: File not found - "./test.ok"
I am facing the same issue like "xsoft" told before. Last night the package "nagios-plugins-file_age" was updated to version "2.1.4-2.el6.x86_64". Now the Service-Check is broken in Nagios. Nagios-Output: Status Information: CRIT - FILE_AGE CRITICAL: File not found - "/var/lib/puppet/state/last_run_report.yaml" File does exist: ls -la /var/lib/puppet/state/last_run_report.yaml => -rw-r----- 1 root root 407130 Jan 4 08:08 /var/lib/puppet/state/last_run_report.yaml Check should return: OK Steps to reproduce: touch /var/tmp/steven.txt ls -la /var/tmp/steven.txt => -rw-r--r-- 1 root root 0 Jan 4 08:22 /var/tmp/steven.txt /usr/lib64/nagios/plugins/check_file_age -f "/var/lib/puppet/state/last_run_report.yaml" => FILE_AGE CRITICAL: File not found - "/var/lib/puppet/state/last_run_report.yaml" Regards, Steven
(In reply to Steven Schlegel from comment #18) > I am facing the same issue like "xsoft" told before. Last night the package > "nagios-plugins-file_age" was updated to version "2.1.4-2.el6.x86_64". Now > the Service-Check is broken in Nagios. > > Nagios-Output: > Status Information: CRIT - FILE_AGE CRITICAL: File not found - > "/var/lib/puppet/state/last_run_report.yaml" > > File does exist: > ls -la /var/lib/puppet/state/last_run_report.yaml > => > -rw-r----- 1 root root 407130 Jan 4 08:08 > /var/lib/puppet/state/last_run_report.yaml > > Check should return: OK > > > Steps to reproduce: > touch /var/tmp/steven.txt > > ls -la /var/tmp/steven.txt > => > -rw-r--r-- 1 root root 0 Jan 4 08:22 /var/tmp/steven.txt > > /usr/lib64/nagios/plugins/check_file_age -f > "/var/lib/puppet/state/last_run_report.yaml" > => > FILE_AGE CRITICAL: File not found - > "/var/lib/puppet/state/last_run_report.yaml" > > > Regards, > Steven Steps to reproduce (fixed typo): touch /var/tmp/steven.txt ls -la /var/tmp/steven.txt => -rw-r--r-- 1 root root 0 Jan 4 08:22 /var/tmp/steven.txt /usr/lib64/nagios/plugins/check_file_age -f "/var/tmp/steven.txt" => FILE_AGE CRITICAL: File not found -"/var/tmp/steven.txt"
I found out that the filename contains another char at the beginning and on the end: # /usr/lib64/nagios/plugins/check_file_age -w 7200 -c 10800 /var/tmp/steven.txt => $VAR1 = '"/var/tmp/steven.txt"'; FILE_AGE CRITICAL: File not found - "/var/tmp/steven.txt" So I made a quick change to the script (cut off all quotation marks from $filename): [...] foreach $filename (@filelist) { print Dumper($filename); $filename =~ s/"//g; print Dumper($filename); unless (-e $filename) { [...] } After running the script again, the output changed from CRITICAL to OK: # /usr/lib64/nagios/plugins/check_file_age -w 7200 -c 10800 /var/tmp/steven.txt => $VAR1 = '"/var/tmp/steven.txt"'; <--- before regex (print Dumper) $VAR1 = '/var/tmp/steven.txt'; <--- after regex (print Dumper) FILE_AGE OK: /var/tmp/steven.txt is 5 seconds old and 0 bytes | age=5s;7200;10800 size=0B;0;0;0 I think the quotation mark (") is used as a part of the filename, so I would suggest to include a regex to remove that char from $filename. Regards, Steven
(In reply to Steven Schlegel from comment #20) > I found out that the filename contains another char at the beginning and on > the end: ... > FILE_AGE CRITICAL: File not found - "/var/tmp/steven.txt" The quotations marks seems to be added quite deliberately in the code: --- begin code snippet --- $opt_f = shift unless ($opt_f); if (! $opt_f) { print "FILE_AGE UNKNOWN: No file specified\n"; exit $ERRORS{'UNKNOWN'}; } $opt_f = '"' . $opt_f . '"'; --- end code snippet --- So removing the line at the end of the code snippet above should work, but before doing that it would be interesting to know why it was added in the first place...
Easy fix (bad escaping, white space) # diff check_file_age check_file_age.working 80c80 < #$opt_f = '"' . $opt_f . '"'; --- > $opt_f = '"' . $opt_f . '"';
i think this bug is not related to this specific bug, but anyway, quickfix is: [root@anr ~]# diff check_file_age check_file_age.fixed 80c80 < #$opt_f = '"' . $opt_f . '"'; --- > $opt_f = '"' . $opt_f . '"';
(In reply to Kent Engström from comment #21) > (In reply to Steven Schlegel from comment #20) > > I found out that the filename contains another char at the beginning and on > > the end: > ... > > FILE_AGE CRITICAL: File not found - "/var/tmp/steven.txt" > > The quotations marks seems to be added quite deliberately in the code: > > --- begin code snippet --- > $opt_f = shift unless ($opt_f); > > if (! $opt_f) { > print "FILE_AGE UNKNOWN: No file specified\n"; > exit $ERRORS{'UNKNOWN'}; > } > > $opt_f = '"' . $opt_f . '"'; > --- end code snippet --- > > So removing the line at the end of the code snippet above should work, but > before doing that it would be interesting to know why it was added in the > first place... When using "glob", perl needs double-quotes around the filename. See: http://perldoc.perl.org/functions/glob.html Quotation ---> "Note that glob splits its arguments on whitespace and treats each segment as separate pattern." <--- Quotation So removing / uncommenting the line "$opt_f = '"' . $opt_f . '"';" is not an option to me, because it breaks / splits the filename at every whitespace: touch Steven\ Test.txt ls -la Steven\ Test.txt => -rw-r--r-- 1 root root 0 6. Jan 08:01 Steven Test.txt /usr/lib64/nagios/plugins/check_file_age -f /root/Steven\ Test.txt => FILE_AGE CRITICAL: File not found - /root/Steven So I made the following changes to check_file_age to be able to check files with whitespaces and without: --- begin code snippet --- $opt_f = '"' . $opt_f . '"'; # Check that file(s) exists (can be directory or link) $perfdata = ""; $output = ""; @filelist = glob($opt_f); foreach $filename (@filelist) { if ($filename !~ /^\./i) { $filename =~ s/"//g; } unless (-e $filename) { --- end code snippet --- If $filename contains a whitespace in it's name, then we want to keep double-quotes around it. If $filename does not have any whitespace in it's name, then we trim off all double-quotes. Test with whitespace: /usr/lib64/nagios/plugins/check_file_age -f /root/Steven\ Test.txt => FILE_AGE OK: /root/Steven Test.txt is 11 seconds old and 0 bytes | age=11s;240;600 size=0B;0;0;0 Test without whitespace: /usr/lib64/nagios/plugins/check_file_age -f /root/mysql_install.log => FILE_AGE OK: /root/mysql_install.log is 15 seconds old and 32187 bytes | age=15s;240;600 size=32187B;0;0;0 I am not an expert, I just want to share my thoughts with you. ;) diff /home/sschlegel/check_file_age /home/sschlegel/check_file_age.fixed 87a88,90 > if ($filename !~ /^\./i) { > $filename =~ s/"//g; > } 115d117 < I think we should create another bug-ticket, because it's not related to this one (like "jan horacek" said). Regards, Steven
There already is another bug roport already filed for the current problem https://bugzilla.redhat.com/show_bug.cgi?id=1410039 Upstreams fix is almost identical to what "Steven Schlegel" proposed