patch for alerting on missing feature

If used, for example, like this …

/tmp/check_flexlm_perf_data -H assdlic01 -p 1055 -f aa_r_cfdd -w 80

and the specified feature doesn’t exist the plugin returns OK (0% of 0 licences used). The patch below treats a missing feature as a critical error.

Index: production/apps/nagios/libexec/ncl/check_flexlm_perf_data
===================================================================
— production/apps/nagios/libexec/ncl/check_flexlm_perf_data (revision 2161)
+++ production/apps/nagios/libexec/ncl/check_flexlm_perf_data (working copy)
@@ -148,12 +148,14 @@
my $current_use = 0;
my $tot_lic = 0;
my $perc_in_use = 0;
+ my $seen_feature = 0;
for (@lmstat_lines) {
if ($features eq 0) {
$red_flag ++ if ((/[Cc]annot/)||(/[Uu]nable/)||(/refused/)||(/down/)||(/[Ww]in[sS]ock/));
} else {
if (/Users of (.*): .* of ([0-9]+) .* issued; .* of ([0-9]+) .* use/) {
my $available_licenses = $2 – $3;
+ $seen_feature++;
$current_use = $3;
$tot_lic = $2;
$perc_in_use = ($current_use/$tot_lic)*100;
@@ -168,6 +170,9 @@
}
if ($red_flag > 0) {
$output = “FLEXlm CRITICAL: License Server Down or Unreachable.n”;
+ } elsif ($vendor && ($seen_feature == 0)) {
+ # We’re looking for a feature and it’s not there
+ $output = “FLEXlm CRITICAL: License Server for $vendor not available.n”;
} elsif ($yellow_flag > 0) {
$output = “FLEXlm WARNING: Reach Usage Warning for Features: “;
for my $feat (@$yellow_feats) {
@@ -190,7 +195,6 @@
$output .=int($perc_in_use);
$output .=”% in use| user=”;
$output .= $current_use;

$output .=”n”;
}
return ($output);