Hi,
 I'm the procps maintainer (Debian and upstream). Dmitry asked me to 
have a look at this bug as pgrep was discussed.  My first impression
is that there is some confusion between command line and process name.

Digging deeper, that is the correct impression.

So, we have a process, pgrep finds it, zabbix_agent doesn't. Obviously
they are doing things differently, but what?

pgrep, by default, uses the process name which what most tools show
by default. You can see the difference with
  ps -e -o pid,comm,cmd
which shows the pid, the process name and the command line.

What does zabbix use? Looking in src/libs/zbxsysinfo/linux/proc.c
we see this:
   if (FAIL == check_procname(f_cmd, f_stat, procname))

and what is f_cmd?
   zbx_snprintf(tmp, sizeof(tmp), "/proc/%s/cmdline", entries->d_name);
   if (NULL == (f_cmd = open_proc_file(tmp)))

cmdline is the command line, NOT the process name.

If you want to use pgrep to check the command line, then use the -f flag.

So why did spamd not show up? My strong assumption is that its command
line looks different to its process name.  There might be something else
happening here, but at the very least you can easily discount this.

 - Craig

-- 
Craig Small VK2XLZ   http://enc.com.au/          csmall at : enc.com.au
Debian GNU/Linux     http://www.debian.org/      csmall at : debian.org
GPG fingerprint:     5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5

Attachment: signature.asc
Description: Digital signature

Reply via email to