Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow output for NagVis "weathermap" lines #26

Merged
merged 1 commit into from
Feb 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions plugins/check_snmp_int.pl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
my $o_noreg = undef; # Do not use Regexp for name
my $o_short = undef; # set maximum of n chars to be displayed
my $o_label = undef; # add label before speed (in, out, etc...).
my $o_weather = undef; # output "weathermap" data for NagVis

# Performance data options
my $o_perf = undef; # Output performance data
Expand Down Expand Up @@ -229,6 +230,8 @@ sub help {
usually 1472,1452,1460 or 1440.
-f, --perfparse, --perfdata
Performance data output (no output when interface is down).
-W, --weather
Output data for "weathermap" lines in NagVis with performance data
-e, --error
Add error & discard to Perfparse output
-S, --intspeed
Expand Down Expand Up @@ -353,7 +356,9 @@ sub check_options {
'delta:i' => \$o_delta,
'D' => \$o_dormant,
'dormant' => \$o_dormant,
'down' => \$o_down
'down' => \$o_down,
'W' => \$o_weather,
'weather' => \$o_weather
);
if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} }
if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} }
Expand Down Expand Up @@ -418,6 +423,11 @@ sub check_options {
print_usage();
exit $ERRORS{"UNKNOWN"};
}
if (defined($o_weather) && !defined($o_perf)) {
print "Cannot output weathermap line data without -f option!\n";
print_usage();
exit $ERRORS{"UNKNOWN"};
}
if (defined($o_perfr) && defined($o_perfp)) {
print "-Y and -y options are exclusives\n";
print_usage();
Expand Down Expand Up @@ -963,7 +973,11 @@ sub check_options {
$perf_out .= "'" . $descr[$i] . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c ";
}
if (defined($o_perfs)) {
$perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real;
$perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . " ";
}
if (defined($o_weather) && $usable_data == 1) {
$perf_out .= "in=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " ";
$perf_out .= "out=" . sprintf("%.0f", $checkperf_out_raw[1]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " ";
}
}
}
Expand Down