Ad Widget

Collapse

Discussion thread for official Zabbix Template Apache

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JorgeSach
    Junior Member
    • Jul 2022
    • 7

    #16
    Originally posted by ddougan
    I'm seeing these errors in the zabbix_server log (for Apache on the server itself):

    Code:
    1. Failed: cannot extract value from json by path "$.IdleWorkers": no data matches the specified path
    2987:20210424:104340.164 error reason for "Zabbix server:apache.workers_total.busy" changed: Preprocessing failed for: {"Date":"Sat, 24 Apr 2021 17:43:40 GMT","Server":"Apache/2.4.37 (centos) OpenSSL/1.1.1g","Length"...
    1. Failed: cannot extract value from json by path "$.BusyWorkers": no data matches the specified path
    2987:20210424:104340.164 error reason for "Zabbix server:apache.bytes.rate" changed: Preprocessing failed for: {"Date":"Sat, 24 Apr 2021 17:43:40 GMT","Server":"Apache/2.4.37 (centos) OpenSSL/1.1.1g","Length"...
    1. Failed: cannot extract value from json by path "$["Total kBytes"]": no data matches the specified path
    This is on Zabbix 5.2 on CentOS 8, updated recently. I'm not sure what these are being caused by.
    Do you hace any solution for this?

    Same problem on Ubuntu 18.04 and apache 2.4.2, but in my zabbix server with ubuntu 20.04 and apache 2.4.4 works perfect. A little diference of versions but the config of the files are the same. I dont know where is the problem. The logs are ok


    EDIT:

    Ok now works with a few changes on the template MACROS.

    My enviroment: zabbix server 6.2.2 and the agent version is 6.2.3 on the apache server. i made this changes in the template:

    On {$APACHE.STATUS.HOST} i put my apache server ip and it works for me. try this

    Click image for larger version

Name:	image.png
Views:	720
Size:	34.2 KB
ID:	451797

    ​​
    Attached Files
    Last edited by JorgeSach; 23-09-2022, 10:52. Reason: Finally works!

    Comment

    • simpsas
      Junior Member
      • Nov 2025
      • 1

      #17
      Hello, i suggest to introduce additional trigger which checks busy workers and if it reaches THRESHOLD value, lets say 90%, of total processes (MaxClients), create an alert.

      Here is proposed changes for preprocesing:
      Code:
      var lines = value.split('\n');
      var output = {},
          workers = {
              '_': 0, 'S': 0, 'R': 0, 'W': 0,
              'K': 0, 'D': 0, 'C': 0, 'L': 0,
              'G': 0, 'I': 0, '.': 0
          };
      
      for (var i = 0; i < lines.length; i++) {
          var line = lines[i].match(/([A-z0-9 ]+): (.*)/);
      
          if (line !== null) {
              output[line[1]] = isNaN(line[2]) ? line[2] : Number(line[2]);
          }
      }
      
      output.ServerUptimeSeconds = output.ServerUptimeSeconds || output.Uptime;
      output.ServerVersion = output.ServerVersion || output.Server;
      
      if (typeof output.Scoreboard === 'string') {
          for (var i = 0; i < output.Scoreboard.length; i++) {
              var char = output.Scoreboard[i];
      
              workers[char]++;
          }
      }
      
      // CHANGE: compute scoreboard length
      var totalWorkers = (typeof output.Scoreboard === 'string') ? output.Scoreboard.length : 0;
      
      output.Workers = {
          waiting: workers['_'], starting: workers['S'], reading: workers['R'],
          sending: workers['W'], keepalive: workers['K'], dnslookup: workers['D'],
          closing: workers['C'], logging: workers['L'], finishing: workers['G'],
          cleanup: workers['I'], slot: workers['.']
      };
      
      // CHANGE: expose total length
      output.Workers.total = totalWorkers;
      
      return JSON.stringify(output);
      Now you can create a item with $.Workers.total
      And create a triger:
      Code:
      last(/Apache by Zabbix agent/apache.workers_total.busy)> (last(/Apache by Zabbix agent/apache.workers.total)*{$APACHE_MPM_THRESHOLD}/100)

      Comment

      Working...