Bug 2329175

Summary: check_openmanage incorrectly reports the version of OpenManage in its output.
Product: [Fedora] Fedora EPEL Reporter: Brad Viviano <viviano.brad>
Component: nagios-plugins-openmanageAssignee: Trond H. Amundsen <trondham>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: epel8CC: trondham, xavier
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brad Viviano 2024-11-27 16:53:30 UTC
Description of problem:

When NOT using SNMP, output is reporting the wrong installed version of OMSA.

Version-Release number of selected component (if applicable):

Affects RHEL7 - RHEL9.

nagios-plugins-openmanage-3.7.12-1.el7.x86_64
nagios-plugins-openmanage-3.7.12-1.el8.x86_64
nagios-plugins-openmanage-3.7.12-20.el9.x86_64

I understand that the RHEL7 packages might no longer be updated, I am just reporting for completeness.

How reproducible:

Very

Steps to Reproduce:
1. Install Dell OpenManager Server Administrator (Any Verison) onto a supported Dell server
2. Install nagios-plugins-openmanage
3. Run the check: /usr/lib64/nagios/plugins/check_openmanage -o 3

Actual results:

# /usr/lib64/nagios/plugins/check_openmanage -o 3
OK - System: 'PowerEdge R740', SN: '13DP3Y2', 384 GB ram (12 dimms), 1 logical drives, 3 physical drives
----- BIOS='2.22.2 09/12/2024', iDRAC9='7.00.00.174 (Build 2)'
----- Ctrl 0 [PERC H730P Adapter]: Fw='25.5.9.0001', Dr='07.727.03.00-rc1'
----- Ctrl 1 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 2 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 3 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 4 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Encl 0:0:1 [Backplane]: Fw='2.52'
----- OpenManage Server Administrator (OMSA) version: '11.0.20'


Expected results:

# /usr/lib64/nagios/plugins/check_openmanage -o 3
OK - System: 'PowerEdge R740', SN: '13DP3Y2', 384 GB ram (12 dimms), 1 logical drives, 3 physical drives
----- BIOS='2.22.2 09/12/2024', iDRAC9='7.00.00.174 (Build 2)'
----- Ctrl 0 [PERC H730P Adapter]: Fw='25.5.9.0001', Dr='07.727.03.00-rc1'
----- Ctrl 1 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 2 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 3 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 4 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Encl 0:0:1 [Backplane]: Fw='2.52'
----- OpenManage Server Administrator (OMSA) version: '11.1.0.0'

Additional info:

In non-SNMP mode, check_openmanage uses `omreport about` to get the OMSA version information, called in the function `get_omreport_about`:

sub get_omreport_about {
    if (open my $OM, '-|', "$omreport about -fmt ssv") {
        my @lines = <$OM>;
        close $OM;
        foreach (@lines) {
            if (m/\A Version;(.+) \z/xms) {
                $sysinfo{om} = $1;
                chomp $sysinfo{om};
            }
        }
    }
    return;
}

However the output of `omreport about` has 2 lines that match the above RegEx, one for the version of OMSA and one for the version of Java used in OMSA:

# omreport about -fmt ssv

Product name;Dell OpenManage Server Administrator
Version;11.1.0.0
Copyright;Copyright (C) Dell Inc. 1995-2024 All rights reserved.
Company;Dell Inc.
Latest Version;11.1.0.0
;
Latest OpenJDK available for download
Version;11.0.20
Download Link;https://adoptium.net/temurin/releases/?version=11
;

This is causing check_openmange to report the version of Java in the check_openmanage check, NOT the version of OpenManage.

I would propose you make the following change to `get_omreport_about`:

sub get_omreport_about {
    if (open my $OM, '-|', "$omreport about -fmt ssv") {
        my @lines = <$OM>;
        close $OM;
        foreach (@lines) {
            if (m/\A Version;(.+) \z/xms) {
                $sysinfo{om} = $1;
                chomp $sysinfo{om};
                last;
            }
        }
    }
    return;
}

Adding 'last' will cause the foreach loop to abort after the first match, which is the OMSA version and not have it continue on and report the Java version:

# ./check_openmanage -o 3
OK - System: 'PowerEdge R740', SN: '13DP3Y2', 384 GB ram (12 dimms), 1 logical drives, 3 physical drives
----- BIOS='2.22.2 09/12/2024', iDRAC9='7.00.00.174 (Build 2)'
----- Ctrl 0 [PERC H730P Adapter]: Fw='25.5.9.0001', Dr='07.727.03.00-rc1'
----- Ctrl 1 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 2 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 3 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Ctrl 4 [12Gbps SAS HBA]: Fw='16.17.01.00', Dr='43.100.00.00'
----- Encl 0:0:1 [Backplane]: Fw='2.52'
----- OpenManage Server Administrator (OMSA) version: '11.1.0.0'

Thanks.