Page 2 of 2

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Tue Feb 04, 2014 1:54 am
by Banzai
Think it's openSuse:

openSUSE 11.4 „Celadon“
openSUSE 12.2 "Mantis"
openSUSE 12.3 "Dartmouth"

ThxIA

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Tue Feb 04, 2014 4:26 pm
by abrist
Now I am really confused. The plugins built fine on 11.4 and 12.2 and check_procs runs as expected. 11.4:

Code: Select all

andy@linux-dll5:/tmp/nagios-plugins-master> cat /etc/*release
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
andy@linux-dll5:/tmp/nagios-plugins-master> ./plugins/check_procs 
PROCS OK: 123 processes | procs=123;;;0;
andy@linux-dll5:/tmp/nagios-plugins-master> ./plugins/check_procs -w 5 -c 10 --metric=CPU
CPU OK: 123 processes | procs=123;;;0; procs_warn=0;;;0; procs_crit=0;;;0;
And just to show you that both of the commands work:

Code: Select all

andy@linux-dll5:/tmp/nagios-plugins-master> ps -ewo stat,uid,ppid,vsz,rss,pcpu,comm,args | head -5
STAT   UID  PPID    VSZ   RSS %CPU COMMAND         COMMAND
Ss       0     0  12460   696  0.0 init            init [5]           
S        0     0      0     0  0.0 kthreadd        [kthreadd]
S        0     2      0     0  0.0 ksoftirqd/0     [ksoftirqd/0]
S        0     2      0     0  0.0 kworker/0:0     [kworker/0:0]
andy@linux-dll5:/tmp/nagios-plugins-master> ps -ewo 'stat uid' | head -5
STAT   UID
Ss       0
S        0
S        0
S        0
12.2 worked as well. We should look through your configure and compile log, maybe configure had an issue where it chooses the proper ps command for the system. Are these suse boxes up to date? Were there any customizations performed when it was installed?

At this point I am at a loss as I cannot reproduce this behavior at all.

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Wed Feb 05, 2014 9:14 am
by Banzai
Thanks @abrist for your investigation.

I really dont know, what is messy around my systems, because I installed from a image default by my provider. Think they using standard openSuSe repositories.

I'm playing around with the source code of "check_proc". So I first 'mark' the error printf to be sure, I found the correct place where the error is thrown.
Then I let printf the PS_COMMAND, that means: "ps -laxnwww"

Try this on the prompt:

Code: Select all

# ps -laxnwww | head -5
warning: bad ps syntax, perhaps a bogus '-'?
See http://gitorious.org/procps/procps/blobs/master/Documentation/FAQ
F   UID   PID  PPID PRI  NI    VSZ   RSS  WCHAN STAT TTY        TIME COMMAND
1     0     2     0  20   0      0     0  5f3f5 S    ?          0:37 [kthreadd]
1     0     3     2  20   0      0     0  45be5 S    ?         65:09 [ksoftirqd/0]
1     0     6     2 -100  -      0     0  ae0cd S    ?          1:52 [migration/0]
1     0     7     2 -100  -      0     0  c546a S    ?          0:44 [watchdog/0]
#
Huh, that IS the "error", but I think this is NOT an error. "ps laxnwww" give the same output, except the warning.

OK, so I take a deeper look to the source, found PS_VARLIST and PS_FORMAT.
On my 12.2 System the #defines look like:

Code: Select all

#define PS_COMMAND "/usr/bin/ps -laxnwww"
#define PS_VARLIST &procuid,&procpid,&procppid,&procvsz,&procrss,procstat,&pos,procprog
#define PS_FORMAT "%*s %d %d %d %*s %*s %*s %d %d %*s %s %*s %*s %n%s"
@12.3

Code: Select all

#define PS_COMMAND "/usr/bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'"
#define PS_VARLIST procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos
#define PS_FORMAT "%s %d %d %d %d %d %f %s %n"
First, the format description on 12.2 differs from the available variables (15 format descriptors and 8 variables?) like in source fo the 12.3 system.
Now I execute the "/usr/bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'" on 12.2 (remeber, alternate syntax) and get the result:

Code: Select all

 # /usr/bin/ps axwo stat,uid,pid,ppid,vsz,rss,pcpu,comm,args | head -5
STAT   UID   PID  PPID    VSZ   RSS %CPU COMMAND         COMMAND
S        0     2     0      0     0  0.0 kthreadd        [kthreadd]
S        0     3     2      0     0  0.0 ksoftirqd/0     [ksoftirqd/0]
S        0     6     2      0     0  0.0 migration/0     [migration/0]
S        0     7     2      0     0  0.0 watchdog/0      [watchdog/0]
#
Yippie!!!
In a transcendent multidimensional godlike inspiration :lol: I replaced the #defines for PS_COMMAND, PS_VARLIST, PS_FORMAT with the values from the generated 12.3 code in config.h.
The PS_COMMAND I change to the alternativ syntax from

Code: Select all

#define PS_COMMAND "/usr/bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'"
to

Code: Select all

#define PS_COMMAND "/usr/bin/ps axwo stat,uid,pid,ppid,vsz,rss,pcpu,comm,args"
Then "make all" and !surprise :o surprise!:

Code: Select all

12.2 # ./plugins/check_procs -w 5 -c 10 --metric=CPU
CPU CRITICAL: 1 crit, 0 warn out of 141 processes | procs=141;;;0; procs_warn=0;;;0; procs_crit=1;;;0;
12.2 #
Doing the same on the 11.4 system, except to change the path to ps from /usr/bin/ps to /bin/ps, because there is no linked file "/usr/bin/ps -> /bin/ps". Same result of check_proc:

Code: Select all

 11.4 # ./plugins/check_procs -w 5 -c 10 --metric=CPU
CPU OK: 151 processes | procs=151;;;0; procs_warn=0;;;0; procs_crit=0;;;0;
11.4 #
In my view, this is the correct output for check_procs, or I'm wrong? Can you please confirm the output?

I don't know why my ps is different from other systems, I swear I do nothing with the base installation! Sometimes I think linux is a shortcut for "Let It Not Useful Xtra".... ;)

Thanks for all your help.

Lutz

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Wed Feb 05, 2014 10:55 am
by sreinhardt
I would agree that, that is correct output for the check_procs and confirm that it is slightly strange that simply adding commas between the arguments was the fix. We will keep this in mind for a future optional patch.

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Wed Feb 05, 2014 11:05 am
by Banzai
Good News Friends!

I moved the check_procs from compile directory to /usr/lib/nagios/plugins and it works perfectly. Now I can can control the machines by a separate nagios server. :D
Cool thing and a create work and many many thanks to all nagios-supporters!

Problem solved with "little help from my friends" :geek:

Hope somebody else can use this thread to solve problems like this.
:lol:

LL&P

Lutz aka Banzai

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Wed Feb 05, 2014 11:08 am
by tmcdonald
Banzai wrote:Problem solved with "little help from my friends" :geek:
Glad to call you friend :)

Gonna go ahead and close this up now, good luck with everything!

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Wed Feb 05, 2014 11:45 am
by abrist
Just as a heads up, you can actually declare the ps command at configure. A quick grep from the configure script:

Code: Select all

[root@localhost nagios-plugins]# cat configure | grep with-ps
  --with-ps-command=PATH  Verbatim command to execute for ps
  --with-ps-format=FORMAT Format string for scanning ps output
  --with-ps-cols=NUM      Number of columns in ps command
  --with-ps-varlist=LIST  Variable list for sscanf of 'ps' output
Glad you figured it out, though it is strange that all 3 of the suse versions I tried worked just fine. Hopefully this is an edge case. . . If I could reproduce it, I could fix the configure process. . .

RESOLVED : check_procs error 'unsupported option (BSD syntax

Posted: Thu Nov 06, 2014 11:09 pm
by sagar_padamwar
Hi Guys, I too had same issue on rhel 6.1

[root@ttpmpjlrdevapp libexec]# ./check_procs -w 200 -c 300
System call sent warnings to stderr: ERROR: Unsupported option (BSD syntax)


I have Resolved this as below
1) Checked which package provides ps command
---------------------------------------------------------------------------------
[root@ttpmpjlrdevapp libexec]# yum provides /bin/ps
Loaded plugins: product-id, subscription-manager
Updating Red Hat repositories.
rhel | 2.9 kB 00:00
procps-3.2.8-17.el6.x86_64 : System and process monitoring utilities
Repo : rhel
Matched from:
Filename : /bin/ps

procps-3.2.8-17.el6.x86_64 : System and process monitoring utilities
Repo : installed
Matched from:
Other : Provides-match: /bin/ps
---------------------------------------------------------------------------------

2) Reinstalled procps-3.2.8-17.el6.x86_64 using "yum reinstall procps-3.2.8-17.el6.x86_64"

and problem resolved

[root@ttpmpjlrdevapp libexec]# ./check_procs -w 200 -c 300
PROCS OK: 200 processes | procs=200;200;300;0;

Re: check_procs error 'unsupported option (BSD syntax)'

Posted: Tue Nov 24, 2015 11:16 am
by andjelko
Recovering ps command helped me on Ubuntu http://askubuntu.com/questions/144954/r ... ps-command
I just did:
apt-get install --reinstall procps
and that resolved my problem.