Bug 1769834

Summary: /usr/lib/nagios/plugins/check_oracle gives pgrep: invalid option -- 'c' error
Product: [Fedora] Fedora EPEL Reporter: johan.hoeke
Component: nagios-pluginsAssignee: Stephen John Smoogen <smooge>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: b.heden, herrold, lemenkov, smooge, smooge, swilkerson
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-10 19:50:31 UTC 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 johan.hoeke 2019-11-07 15:16:07 UTC
Description of problem:
check_oracle from nagios-plugins-oracle package contains a line that calls pgrep with the -c parameter:
169:    pmonchk=$(pgrep -f -c "(asm|ora|xe)_pmon_${2}$")
RHEL6 pgrep doesnt support the -c parameter. 

Version-Release number of selected component (if applicable):
nagios-plugins-oracle-2.2.2-2.20190926git1b8ad57.el6.x86_64

How reproducible:


Steps to Reproduce:
1.# /usr/lib/nagios/plugins/check_oracle --db MYDB
pgrep: invalid option -- 'c'
Usage: pgrep [-flvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]
	[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]
/usr/lib/nagios/plugins/check_oracle_broken: line 170: [: : integer expression expected

2.
3.

Actual results:
pgrep: invalid option -- 'c'
Usage: pgrep [-flvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]
	[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]
/usr/lib/nagios/plugins/check_oracle_broken: line 170: [: : integer expression expected


Expected results:
MYDB Database is DOWN

Additional info:
Red Hat Enterprise Linux Server release 6.10 (Santiago)[root@karsten plugins]# pgrep -V
pgrep (procps version 3.2.8)
procps-3.2.8-45.el6_9.3.x86_64

Comment 1 johan.hoeke 2019-11-07 15:22:55 UTC
forgot to add the easy patch

-    pmonchk=$(pgrep -f -c "(asm|ora|xe)_pmon_${2}$")
+    pmonchk=$(pgrep -f "(asm|ora|xe)_pmon_${2}$"|wc -l)

Comment 2 Stephen John Smoogen 2019-12-10 19:50:31 UTC
This looks to be fixed in 2.3.1 which I will be putting into testing. i am consolidating bugs

*** This bug has been marked as a duplicate of bug 1752383 ***