Bladeren bron

check_flexlm: use `LM_LICENSE_FILE` environment variable

Fix for issue #118

If `-F <license file>` is not specified, it will loog for and use
the `LM_LICENSE_FILE` environment variable.
John C. Frickson 9 jaren geleden
bovenliggende
commit
766d141780
2 gewijzigde bestanden met toevoegingen van 10 en 4 verwijderingen
  1. 3 0
      NEWS
  2. 7 4
      plugins-scripts/check_flexlm.pl

+ 3 - 0
NEWS

@@ -1,6 +1,9 @@
 This file documents the major additions and syntax changes between releases.
 
 2.x.x xxxx-xx-xx
+	ENHANCEMENTS
+	check_flexlm: if `-F <license file>` is not specified, will use `LM_LICENSE_FILE` environment var
+
 	FIXES
 	check_http: -e breaks -f
 	check_mrtg: Add state to status output

+ 7 - 4
plugins-scripts/check_flexlm.pl

@@ -70,9 +70,12 @@ unless (defined $opt_t) {
 if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
 
 unless (defined $opt_F) {
-	print "Missing license.dat file\n";
-	print_usage();
-	exit $ERRORS{'UNKNOWN'};
+	$opt_F = $ENV{'LM_LICENSE_FILE'};
+	unless (defined $opt_F) {
+		print "Missing license.dat file\n";
+		print_usage();
+		exit $ERRORS{'UNKNOWN'};
+	}
 }
 # Just in case of problems, let's not hang Nagios
 $SIG{'ALRM'} = sub {
@@ -227,7 +230,7 @@ Check available flexlm license managers
 	print_usage();
 	print "
 -F, --filename=FILE
-   Name of license file (usually \"license.dat\")
+   Name of license file (like \"/usr/local/flexlm/licenses/license.dat\")
 -v, --verbose
    Print some extra debugging information (not advised for normal operation)
 -t, --timeout