Page 1 of 2

check_procs error 'unsupported option (BSD syntax)'

Posted: Tue Jan 28, 2014 5:35 am
by Banzai
Hello Community,

I search the net a couple of days, not really find a solution or hint to solve my problem. Looks like, nobody else got this problem.

I have install nagios core via YAST on a SuSe 12.3 and it works fine. So i tried to check two of our linux server with different kernel versions (SuSe 11.4 and SuSe 12.2) with NRPE. So I install the nagios plugins on both machines.
Now I got on 12.3 and 12.2 the nagios plugins 1.4.16 installed, on the 11.4 version 1.4.15.

If I use (like in many examples on the net)

Code: Select all

./check_procs -w 5 -c 10 --metric=CPU
on the monitoring host, I got a correct looking answer: "CPU OK: 123 processes"

The same syntax local on the 11.4 and 12.2 machines gave me this result: "System call sent warnings to stderr: ERROR: Unsupported option (BSD syntax)"
Tests with ./check_users or ./check_load works perfect.

I'm not a linux-pro and I can't update the 11.4/12.2 machines to a newer/other kernel, depends on the customer software they running. I don't know how to get the versions of 'ps' or 'libp', If they have to do with this error.

Can someone give a practical hint to solve this problem?

Thanks in advance.

Lutz aka. Banzai

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

Posted: Tue Jan 28, 2014 11:12 am
by abrist
Thanks for the heads up. I added an issue on the plugins github account: https://github.com/nagios-plugins/nagio ... /issues/17
Could you try building and testing from the github master.zip? (you may need to dependencies)

Code: Select all

cd /tmp
wget https://github.com/nagios-plugins/nagios-plugins/archive/master.zip
unzip master.zip
cd nagios-plugins-master
./tools/setup
./configure
make all
./plugins/check_procs -w 5 -c 10 --metric=CPU

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

Posted: Wed Jan 29, 2014 3:12 am
by Banzai
Hello,

thx @abrist for this quick reply.

I have downloaded, setup (must install automake/autoconf first), configure and compile on the 12.2 and 11.4 system.

On 12.2 it looks like a successful compile and the "check_proc" test:

Code: Select all

./plugins/check_procs -w 5 -c 10 --metric=CPU
System call sent warnings to stderr: warning: bad ps syntax, perhaps a bogus '-'?
On 11.4 the compile throws me error, think by a missing language file:

Code: Select all

Making all in po
make[2]: Entering directory `/tmp/nagios-plugins-master/po'
test ! -f ./nagios-plugins.pot || \
  test -z "fr.gmo de.gmo" || make fr.gmo de.gmo
make[3]: Entering directory `/tmp/nagios-plugins-master/po'
rm -f fr.gmo && : -c --statistics -o fr.gmo fr.po
mv: cannot stat `t-fr.gmo': No such file or directory
make[3]: *** [fr.gmo] Error 1
make[3]: Leaving directory `/tmp/nagios-plugins-master/po'
make[2]: *** [stamp-po] Error 2
make[2]: Leaving directory `/tmp/nagios-plugins-master/po'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/nagios-plugins-master'
make: *** [all] Error 2
#> _
But I have tried the test:

Code: Select all

./plugins/check_procs -w 5 -c 10 --metric=CPU
System call sent warnings to stderr: Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
A closer look to http://procps.sf.net/faq.html let me try to do a "ps -aux", but it still seems a ok ps output (should I said, I'm not a linux-pro? ;) )

Hope that helps step forward to a closer solution and thanks a lot for support.


Lutz aka. Banzai

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

Posted: Wed Jan 29, 2014 11:01 am
by abrist
On the 12.2 system, try running the following:

Code: Select all

ps axwo 'stat comm vsz rss user uid pid ppid args'
ps -axwo 'stat comm vsz rss user uid pid ppid args'
You should get an error/usage warning for the second.

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

Posted: Thu Jan 30, 2014 2:48 am
by Banzai
Hello,

@abrist thank you for reply.

I try on all 3 systems the ps syntax, with and without the hyphen by 'axwo', as you suggest.
First on the 12.2::

Code: Select all

 ps axwo 'stat comm vsz rss user uid pid ppid args'
error: unsupported option (BSD syntax)

Usage:
 libp [options]

 Try 'libp --help <simple|list|output|threads|misc|all>'
  or 'libp --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).

Code: Select all

ps -axwo 'stat comm vsz rss user uid pid ppid args'
error: must set personality to get -x option

Usage:
 libp [options]

 Try 'libp --help <simple|list|output|threads|misc|all>'
  or 'libp --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
OK, on the 'axwo' should be the error 'check_procs' get back.
'-axwo' confused me little bit, but 'googleing' this get a answer like
One more thing here that there is no -x option in ps in linux(but in solaris it is present)Try ps ax (without -) – http://stackoverflow.com/questions/1307 ... ption-garb
!

The same (more or less) shows the 11.4:

Code: Select all

 ps axwo 'stat comm vsz rss user uid pid ppid args'
ERROR: Unsupported option (BSD syntax)
********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports nam...blahblah

Code: Select all

 ps -axwo 'stat comm vsz rss user uid pid ppid args'
ERROR: Must set personality to get -x option.
********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective...blahblahblah
I am infinitely grateful to you for your help and hope with your support, a solution to this problem to find (and I hope others can use that too)by Google Translate ;).

Lutz aka Banzai

BTW: The 12.3 shows a nice and perfect looking process list.... but you know that before, I think.

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

Posted: Thu Jan 30, 2014 3:44 pm
by abrist
I am going to try and reproduce this behavior. Do me a favor and get the versions of ps for these boxes:

Code: Select all

ps -V

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

Posted: Fri Jan 31, 2014 3:30 am
by Banzai
Thank you abrist.

Here now the results for "ps -get me the damn version":

11.4

Code: Select all

# ps -V
# ps -v
warning: bad ps syntax, perhaps a bogus '-'?
See http://gitorious.org/procps/procps/blobs/master/Documentation/FAQ
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
  519 tty1     Ss+    0:00      1    26 12601   652  0.0 /sbin/agetty tty1 38400
13015 pts/1    Ss     0:00      3   599 13572  2256  0.0 -bash
# ps --version
# ps v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
  519 tty1     Ss+    0:00      1    26 12601   652  0.0 /sbin/agetty tty1 38400
13015 pts/1    Ss     0:00      3   599 13572  2256  0.0 -bash
# ps V
#
12.2:

Code: Select all

# ps -V
# ps -v
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 2550 tty1     Ss+    0:00      1    19  4220   592  0.0 /sbin/mingetty --noclear tty1
 2551 tty2     Ss+    0:00      0    19  4220   592  0.0 /sbin/mingetty tty2
20990 pts/0    Ss     0:00      0   594 13421  3088  0.0 -bash
# ps --version
# ps v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 2550 tty1     Ss+    0:00      1    19  4220   592  0.0 /sbin/mingetty --noclear tty1
 2551 tty2     Ss+    0:00      0    19  4220   592  0.0 /sbin/mingetty tty2
20990 pts/0    Ss     0:00      0   594 13421  3088  0.0 -bash
# ps V
#
On both systems a "man ps" shows in the OTHER INFORMATION section V/-V/--version parameter, but this don't work (see above).
So I try on the 12.3:

Code: Select all

# ps -V
procps-ng version 3.3.5
#
Thats give me the hint to look what YAST says to the versions of ps (or procps):
11.4: procps -> 3.2.8
12.2: procps -> 3.3.3

A closer look to the man pages shows me the --info option. That give more information:
11.4

Code: Select all

 # ps --info
BSD j    OL_j
:
Linux version 2.6.37
Compiled with: glibc 2.11, gcc 4.5
:
12.2:

Code: Select all

# ps --info
BSD j    OL_j
:
Linux version 3.4.28
Compiled with: glibc 2.15, gcc 4.7
:
..and for completation 12.3:

Code: Select all

# ps --info
BSD j    OL_j
:
procps-ng version 3.3.5
Linux version 3.7.10
Compiled with: glibc 2.17, gcc 4.7
:
Hope this helps you to find the version-chaos-solution.

Thanks in advanced

Lutz aka Banzai

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

Posted: Fri Jan 31, 2014 1:20 pm
by abrist
I have been doing some digging, and it looks like you may need to use a different command. Can you try:

Code: Select all

ps -ewo 'stat uid ppid vsz rss pcpu comm args'

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

Posted: Mon Feb 03, 2014 2:33 am
by Banzai
@abrist

I try the command as you post:

Code: Select all

# ps -ewo 'stat uid ppid vsz rss pcpu comm args'
error: unsupported option (BSD syntax)

Usage:
 libp [options]

 Try 'libp --help <simple|list|output|threads|misc|all>'
  or 'libp --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
But this gave me the hint, to a deeper look into the 'man ps'. So I try:

Code: Select all

ps -ewo
error: format specification must follow -o

Usage:
 libp [options].......
OK, and

Code: Select all

# ps -ew
  PID TTY          TIME CMD
    1 ?        00:04:58 systemd
    2 ?        00:00:36 kthreadd
    3 ?        01:04:53 ksoftirqd/0
:
:
Huh?.... so on your proposal I use the alternativ format description, a comma separated list and.....

Code: Select all

# ps -ewo stat,uid,ppid,vsz,rss,pcpu,comm,args
STAT   UID  PPID    VSZ   RSS %CPU COMMAND         COMMAND
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 migration/0     [migration/0]
S        0     2      0     0  0.0 watchdog/0      [watchdog/0]
:
:
Is this that, what you wanted to see?

Hope that gives you the ultimate hint.

Thanks in advance

Banzai

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

Posted: Mon Feb 03, 2014 11:55 am
by abrist
Are you running opensuse or suse enterprise? I am setting up the environment today. I have a sneaking suspicion that we will have have to specify a different ps command at compile.