Apache template: apache.proc.vmem becomes unsupported when proc.get returns -1

XMLWordPrintable

      Hello,

      I encountered an issue with the official Apache template where the item apache.proc.vmem{#APACHE.NAME}periodically becomes not supported.

      The problem occurs because the template expects a Numeric (unsigned) value, but the preprocessing extracts the vsizefield from proc.get, which can sometimes return -1.

      Since -1 is interpreted as a string and is not a valid unsigned numeric value, the item becomes unsupported.

      Example from zabbix_server.log:

      {{item "example.com:apache.proc.vmem[apache2]" became not supported:
      Value of type "string" is not suitable for value type "Numeric (unsigned)". Value "-1"}}
      

      Shortly afterwards it becomes supported again when a valid value is returned.

      This leads to constant state flapping of the item.

      Environment

      • Zabbix version: 7.4
      • Template: Apache by Zabbix agent active
      • OS: Linux (Ubuntu)
      • Apache process name: apache2
      • Agent version: Zabbix Agent2

      Root cause

      sudo -u zabbix zabbix_agent2 -t "proc.get[apache2,,,summary]"
      proc.get[apache2,,,summary]                   [s|[{"name":"apache2","processes":34,"vsize":-1,"pmem":-1,"rss":-1,"data":-1,"exe":-1,"lck":-1,"lib":-1,"pin":-1,"pte":-1,"size":-1,"stk":-1,"swap":-1,"cputime_user":15.959999999999996,"cputime_system":31.22,"ctx_switches":78299,"threads":66,"page_faults":21,"pss":2884001792}]]

      The template uses:

      {{proc.get[\{$APACHE.PROCESS.NAME.PARAMETER},,,summary]}}
      

      and extracts:

      {{$.vsize}}
      

      However, the proc.get documentation indicates that certain fields may return -1 when the value is unavailable.

      Because the item type is Numeric (unsigned), this causes the item to become unsupported.

      Impact

      This issue causes the item to repeatedly switch between supported and not supported, even though Apache is running normally.

      Additional note

      This was observed using the default template without any modifications.

            Assignee:
            Kamil Florowski
            Reporter:
            Bence Mihály Kévés
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 2h
                2h