Configure-time ps command truncates command names

Bug #1082767 reported by Gerald Combs
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-meta (Ubuntu)
Opinion
Medium
Unassigned

Bug Description

It looks like the nagios-plugins package is configured with

  --with-ps-command="/bin/ps axwwo 'stat uid pid ppid vsz rss pcpu etime comm args'"

Unfortunately using "comm" returns truncated command names (via /proc/[pid]/status) which makes it difficult or impossible to use check_procs -C. For example, "check_procs -C apache2" fails while "check_procs -C apach" works.

description: updated
Robie Basak (racb)
Changed in nagios-plugins (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Jan Wagner (waja) wrote :

sorry ... can't reproduce your problem ... at least on quantal:

root@ubuntu:~# LANG=C /usr/lib/nagios/plugins/check_procs -C getty
PROCS OK: 6 Prozesse with command name 'getty'
root@ubuntu:~# ps aux|grep getty
root 1004 0.0 0.0 4632 844 tty4 Ss+ 20:33 0:00 /sbin/getty -8 38400 tty4
root 1008 0.0 0.0 4632 856 tty5 Ss+ 20:33 0:00 /sbin/getty -8 38400 tty5
root 1023 0.0 0.0 4632 848 tty2 Ss+ 20:33 0:00 /sbin/getty -8 38400 tty2
root 1025 0.0 0.0 4632 856 tty3 Ss+ 20:33 0:00 /sbin/getty -8 38400 tty3
root 1029 0.0 0.0 4632 848 tty6 Ss+ 20:33 0:00 /sbin/getty -8 38400 tty6
root 1492 0.0 0.0 4632 852 tty1 Ss+ 20:33 0:00 /sbin/getty -8 38400 tty1
root 13428 0.0 0.0 5636 816 pts/0 S+ 22:13 0:00 grep getty

looks like you messed your local environment

Revision history for this message
Gerald Combs (gerald.combs) wrote :

That's because "/sbin/getty" is shorter than 15 characters, which means that /proc/<pid>/status isn't truncating it.

Revision history for this message
Gerald Combs (gerald.combs) wrote :

...and this problem has been reported before: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513460

Revision history for this message
Jan Wagner (waja) wrote : Re: [Bug 1082767] Re: Configure-time ps command truncates command names

Am 16.12.12 01:31, schrieb Gerald Combs:
> That's because "/sbin/getty" is shorter than 15 characters, which
> means that /proc/<pid>/status isn't truncating it.

that's true, but this is the same for "apache2" as you reported first:

$ LANG=C /usr/lib/nagios/plugins/check_procs -C apache2
PROCS OK: 7 processes with command name 'apache2'

> ** Bug watch added: Debian Bug tracker #513460
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513460

okay ... so you know this won't get fixed (from debian side and this
seems likely in ubuntu too). anyways ... it's not a problem in
nagios-plugins but in linux-meta.

Revision history for this message
Jan Wagner (waja) wrote :

This is a kernel limitation ...

affects: nagios-plugins (Ubuntu) → linux-meta (Ubuntu)
Changed in linux-meta (Ubuntu):
status: New → Opinion
Revision history for this message
Gerald Combs (gerald.combs) wrote :

This is indeed ultimately a kernel limitation, one which will likely never be fixed. Procps should probably be modified to use /proc/<pid>/cmdline instead of the first line of /proc/<pid>/status for command names since this can affect other programs as well as indicated by the Debian bug.

In the mean time, check_procs is broken. Can we work around the problem by configuring nagios-plugins with a ps argument that returns the full command name, e.g. something like

  --with-ps-command="/bin/ps axwwo 'stat uid pid ppid vsz rss pcpu etime command'"

instead of

  --with-ps-command="/bin/ps axwwo 'stat uid pid ppid vsz rss pcpu etime comm args'"

?

Revision history for this message
Holger Weiß (holger-cis) wrote :

No, "comm" cannot be replaced with "command" without breaking things.

However, the workaround you're suggesting is provided by "check_procs -a" (as this uses the format specifier "args", which is just an alias for "command").

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.