Closed pgranado closed 5 years ago
Tried to reproduce with the same output:
object CheckCommand "pdq" {
command = [ "CENSORED/pdq.sh" ]
}
object Host "pdq" {
check_command = "pdq"
}
#!/bin/bash
exec cat <<EOF
eth0:UP (0.0MBps/0.0MBps), eth1:UP (512.5MBps/0.0MBps):2 UP: OK | 'eth0_in_octet'=29916609c 'eth0_out_octet'=72601193c 'eth0_in_error'=0c 'eth0_in_discard'=0c 'eth0_out_error'=0c 'eth0_out_discard'=0c 'eth0_speed_bps'=1000000000 'eth1_in_octet'=1210083194c 'eth1_out_octet'=429473467c 'eth1_in_error'=0c 'eth1_in_discard'=0c 'eth1_out_error'=0c 'eth1_out_discard'=0c 'eth1_speed_bps'=1000000000
EOF
Works for me:
Hi, I tried your example and it works. If I use the check_snmp_int.pl output (copy&paste) it works. I don't see any special chars when I execute it manually. Let me do further tests and I will update this. Thanks.
Hi, I found the culprit -> check_snmp_int.pl (v1.24) -> line 561 It adds a space between 'eth0_speed_bps'=1000000000 'eth1_in_octet'=1210083194c -> Result = two spaces between them. Icinga parses this as for example -> metric=\ 'eth1_in_octet' I will correct check_snmp_int.pl for perfdata. It's nothing to do with Icinga, sorry for this. I didn't saw directly the additional space.
Maybe it is already fixed in https://github.com/dnsmichi/manubulon-snmp/blob/master/plugins/check_snmp_int.pl
Not fixed with release 2.1.0 but it matches -> https://github.com/dnsmichi/manubulon-snmp/issues/32
Ah, interesting. When you patch it, please send a PR over there :)
Expected Behavior
The output format must be the same with perfdata for single or multiple interface (without quotes on the second interface)
Current Behavior
We are using check_snmp_int.pl to poll interfaces on our devices and forward perfdata to an InfluxDB. If we poll only one interface we don't see any problems on output but when we ask to poll multiple interfaces (for example 2 interfaces) we see that quotes are added on the second interface only for in_octets. The output of check_snmp_int.pl is correct but the parsing for perfdata is not correctly done. Here an example: /lib64/nagios/plugins/check_snmp_int.pl -H x.x.x.x -C comm -2 -f -n "eth0|eth1" --perfcheck --perfparse --intspeed --error --mega -w 700,700 -c 900,900
eth0:UP (0.0MBps/0.0MBps), eth1:UP (512.5MBps/0.0MBps):2 UP: OK | 'eth0_in_octet'=29916609c 'eth0_out_octet'=72601193c 'eth0_in_error'=0c 'eth0_in_discard'=0c 'eth0_out_error'=0c 'eth0_out_discard'=0c 'eth0_speed_bps'=1000000000 'eth1_in_octet'=1210083194c 'eth1_out_octet'=429473467c 'eth1_in_error'=0c 'eth1_in_discard'=0c 'eth1_out_error'=0c 'eth1_out_discard'=0c 'eth1_speed_bps'=1000000000
Perfdata: eth0_in_octet=29916609c eth0_out_octet=72601193c eth0_in_error=0c eth0_in_discard=0c eth0_out_error=0c eth0_out_discard=0c ' 'eth1_in_octet''=1210083194c eth1_out_octet=429473467c eth1_in_error=0c eth1_in_discard=0c eth1_out_error=0c eth1_out_discard=0c
We see single quotes only on term eth1_in_octet. The same with multiple interfaces, always term "_in_octet" is affected.
Possible Solution
I'm trying to find it out.. but may be someone else is faster.
Steps to Reproduce (for bugs)
1. 2. 3. 4.
Context
Your Environment
icinga2 --version
): v2.10.3icinga2 feature list
):Disabled features: compatlog debuglog elasticsearch gelf graphite opentsdb perfdata statusdata syslog Enabled features: api checker command ido-mysql influxdb livestatus mainlog notificationicinga2 daemon -C
): [2019-03-15 18:00:47 +0100] information/cli: Icinga application loader (version: r2.10.3-1) [2019-03-15 18:00:47 +0100] information/cli: Loading configuration file(s). [2019-03-15 18:00:47 +0100] information/ConfigItem: Committing config item(s). [2019-03-15 18:00:47 +0100] information/ApiListener: My API identity: ACCS-Icinga2 [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'backup-downtime' (in /etc/icinga2/conf.d/downtimes.conf: 5:1-5:52) for type 'ScheduledDowntime' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'Ping6' (in /etc/icinga2/conf.d/services.conf: 32:1-32:21) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'Ping ' (in /etc/icinga2/conf.d/services.conf: 38:1-38:71) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'MySQL-Check' (in /etc/icinga2/conf.d/services.conf: 101:1-101:27) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'MySQL-Slavestatus-Check' (in /etc/icinga2/conf.d/services.conf: 119:1-119:39) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'snmp-Check Storage' (in /etc/icinga2/conf.d/services.conf: 673:1-673:34) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'interface traffic - ' (in /etc/icinga2/conf.d/services.conf: 758:1-758:101) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'snmp-Check Ram' (in /etc/icinga2/conf.d/services.conf: 798:1-798:30) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'snmp-Check Fan' (in /etc/icinga2/conf.d/services.conf: 1078:1-1078:30) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'snmp-Check Power' (in /etc/icinga2/conf.d/services.conf: 1086:1-1086:32) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'snmp-Check Slot CPU' (in /etc/icinga2/conf.d/services.conf: 1109:1-1109:35) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] warning/ApplyRule: Apply rule 'snmp-Check Slot Memory' (in /etc/icinga2/conf.d/services.conf: 1131:1-1131:38) for type 'Service' does not match anywhere! [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1494 Services. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 InfluxdbWriter. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 LivestatusListener. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 IcingaApplication. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 128 Hosts. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 FileLogger. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 4 NotificationCommands. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1753 Notifications. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 NotificationComponent. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 27 HostGroups. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 ApiListener. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 Downtime. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 CheckerComponent. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 4 Zones. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 ExternalCommandListener. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 3 Endpoints. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 2 ApiUsers. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 5 Users. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 1 IdoMysqlConnection. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 127 CheckCommands. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 5 UserGroups. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 25 ServiceGroups. [2019-03-15 18:00:48 +0100] information/ConfigItem: Instantiated 5 TimePeriods. [2019-03-15 18:00:48 +0100] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars' [2019-03-15 18:00:48 +0100] information/cli: Finished validating the configuration file(s).zones.conf
file (oricinga2 object list --type Endpoint
andicinga2 object list --type Zone
) from all affected nodes.