-
Notifications
You must be signed in to change notification settings - Fork 14
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
Standard Perfdata Output #7
Comments
|
OK, Thank you for the link @dnsmichi . |
Well, I wouldn't change the perfdata output for this plugin, since there's users which rely on this. Even if that check_multi format is an extension, I know that it is used by many. The main problem is then with handling them in the different metric writers. As said, PNP naturally supports it, Icinga 2 with the Graphite feature parses it, InfluxDB does not. The latter is something where I have little knowledge, that is why we'll need feedback in the linked issue :) |
Of course. I was thinking about an option which gives the ability to change the output format.
Unfortunately, I'm able to help with this. My knowledge about Influx, is also very small. I'm just lucky it is working nearly out of the box with Icinga and Grafana :-) |
interesting - does anyone found a solution how influx can parse the check_multi syntax? |
No. Only thing I did. I have build myself a wrapper script for check_interfaces, which maipulates the the output so influx can read it. |
Thanks for reply. are you intend to share your wraper script? |
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
#use Data::Dumper qw(Dumper);
my $check_interfaces = '/usr/lib64/nagios/plugins/check_interfaces';
if (-f dirname(__FILE__).'/check_interfaces') {
$check_interfaces = dirname(__FILE__).'/check_interfaces';
}
if (@ARGV && scalar(@ARGV) > 0) {
my $args = join("' '", @ARGV);
my $output = `$check_interfaces '$args'`;
my $ex = $? >> 8;
my @out = split(/\n/, $output);
if (!@out || scalar(@out) < 1 || !exists($out[0])) {
print $output;
exit $ex;
}
my $first = $out[0];
shift(@out); my $rest = join("\n", @out);
my @first_parts = split(/\|/, $first);
if (!@first_parts || scalar(@first_parts) < 1) {
print $output;
exit $ex;
}
if (!exists($first_parts[0]) || !exists($first_parts[1])) {
print $output;
exit $ex;
}
my $perfdata = $first_parts[1]; $perfdata =~ s/(^\s*|\s*$)//;
my $out_short = $first_parts[0]; $out_short =~ s/(^\s*|\s*$)//;
my @labels = split(/\s+/, $perfdata);
#print Dumper(@labels);
if (!@labels || scalar(@labels) < 1) {
print $output;
exit $ex;
}
my $ident = "";
my $new_perfdata = "";
foreach (@labels) {
if ($_ =~ /^interfaces::check_multi::plugins=|time=/) { next; }
#if ($_ =~ /outCollisions|inCRCs/) { next; }
if ($_ =~ /::/ ) {
my @tmp = split(/::/, $_);
$ident = $tmp[0];
my $label = $tmp[-1];
$new_perfdata .= $ident.'-'.$label.' ';
} else {
$new_perfdata .= $ident.'-'.$_.' ';
}
}
print $out_short.' | '.$new_perfdata."\n".$rest."\n";
exit $ex;
} else {
my $output = `$check_interfaces`;
my $ex = $? >> 8;
print $output;
exit $ex;
} |
Seems to work with InfluxDB now, at least with the InfluxDB2 writer |
Hi,
I'm having issues using this check with InfluxDB and Grafana. I guess it is because of the uncommon perfdata output, which seems to be pnp4nagios specific. Would be great if you could offer an option to output perfdata without all those '::' categories/template-names.
Example:
Current Output:
GigabitEthernet4-48::check_snmp::outDiscards=[...]
Wished Output:
GigabitEthernet4-48-outDiscards=[...]
And maybe as a bonus :-)
Would be great if I could skip some things of the perfdata like CRC-Errors. Because I already have a check which saves CRC-Errors as perfdata and having them twice will increase my data space unnecessarily.
The text was updated successfully, but these errors were encountered: