Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-6198

proc.num user limitation seems broken in 2.0.4 when processes drop privileges

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 2.0.4
    • Agent (G)
    • Zabbix server: RHEL Linux 6.3 x86_64, running 2.0.4
      Zabbix client: RHEL Linux 5.9 x86_64, running 2.0.4 agent

      I'm trying to count the number of "lpd" processes running as the "lp" user on a RHEL 5.9 print server via a "Zabbix agent" check type. I've discovered that if I limit the proc.num by user "lp", it returns 0, but if I use "root" as the username it returns a suitable number, even though ps and pgrep on the system in question indicate the processes are running as user lp:

      On the print server:

      $ pgrep -u lp
      5379
      5382
      6203
      6642
      7909
      7910
      10482
      15888
      $ pgrep -u lp lpd
      5379
      5382
      6203
      6642
      10482
      15888

      However, zabbix seems to get it wrong. This is executed on the zabbix server:

      $ sudo -u zabbix /usr/local/bin/zabbix_get -s printserver -p 10050 -k 'proc.num[lpd,lp]'
      0
      $ sudo -u zabbix /usr/local/bin/zabbix_get -s printserver -p 10050 -k 'proc.num[,lp]'
      0

      I believe this has something to do with the fact that the process starts as root but then drops to the "lp" user. I say that because if
      I instead run

      $ sudo -u zabbix /usr/local/bin/zabbix_get -s printserver -p 10050 -k 'proc.num[lpd,root]'
      6

      Also, in the case where the "lpd" process (which ps and pgrep show running as user "lp") forks a print filter, then the zabbix agent does detect that the print filter is running as the "lp" user:

      $ sudo -u zabbix /usr/local/bin/zabbix_get -s printserver -p 10050 -k 'proc.num[,lp]'
      1

      On the zabbix client, that happens when a filter has been started:

      $ ps -fu lp | egrep 'ifhp'
      lp 8420 8419 0 19:33 ? 00:00:00 /usr/local/libexec/ifhp/ifhp -Plibrary-118-b-1 -nuser.name -hCL-LIBR0118-25 -b11593449 -J8 x 10 in. (1)

      This is just a guess, but it appears that the zabbix agent may not be using the correct logic for matching the effective user id for processes with proc.num. The ps and pgrep commands very clearly display and match (via the -u argument) processes executing as user lp, but zabbix agent misses them.

            Unassigned Unassigned
            tim.mooney Tim Mooney
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: