Bug 1769834 - /usr/lib/nagios/plugins/check_oracle gives pgrep: invalid option -- 'c' error
Summary: /usr/lib/nagios/plugins/check_oracle gives pgrep: invalid option -- 'c' error
Keywords:
Status: CLOSED DUPLICATE of bug 1752383
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: nagios-plugins
Version: el6
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Stephen John Smoogen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-07 15:16 UTC by johan.hoeke
Modified: 2019-12-10 19:50 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-10 19:50:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.