zabbix_export: version: '5.4' date: '2021-11-21T21:46:32Z' groups: - uuid: 7df96b18c230490a9a0a9e2307226338 name: Templates templates: - uuid: 489691779735440c9d9b897bafb63d79 template: Apache name: Apache description: | ## Overview This template is for Apache HTTP server monitoring. It contains one master item that connects to HTTP Agent every 10 seconds, requests server-status page, provided by mod-status Apache module and spreads collected information between 18 dependent items. No triggers. See screenshot for details. Refer to the blog post for even more details. ## Author Andris Zeila groups: - name: Templates items: - uuid: f1a069b419f54f74aa78a6383645dab0 name: 'Bytes per request' type: DEPENDENT key: apache.bytesreq delay: '0' value_type: FLOAT units: B preprocessing: - type: JSONPATH parameters: - $.BytesPerReq master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 028efa2b52dd48649ec694b63796b9d6 name: 'Bytes per second' type: DEPENDENT key: apache.bytessec delay: '0' value_type: FLOAT units: B preprocessing: - type: JSONPATH parameters: - $.BytesPerSec master_item: key: apache.status tags: - tag: Application value: Apache - uuid: e3fc1a194dba412ea8aeb0e75aaee11b name: 'CPU load' type: DEPENDENT key: apache.cpuload delay: '0' value_type: FLOAT preprocessing: - type: JSONPATH parameters: - $.CPULoad master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 5eaae95f61bc471a89012d92ca9aa8f4 name: 'Total requests' type: DEPENDENT key: apache.requests delay: '0' preprocessing: - type: JSONPATH parameters: - '$["Total Accesses"]' master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 39f7257793554c628831d55c5a21cb82 name: 'Requests per second' type: DEPENDENT key: apache.requestssec delay: '0' value_type: FLOAT preprocessing: - type: JSONPATH parameters: - $.ReqPerSec master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 5139fcff72334add8628dfbdd39fe070 name: 'Apache HTTP Server status' type: HTTP_AGENT key: apache.status delay: 10s history: '0' trends: '0' value_type: TEXT preprocessing: - type: JAVASCRIPT parameters: - | // Convert Apache status to JSON. var lines = value.split("\n"); var fields = {}, workers = {}, output = {}; // Get all "Key: Value" pairs as an object. 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]); } } // Parse "Scoreboard" to get worker count. if (typeof output.Scoreboard === 'string') { for (var i = 0; i < output.Scoreboard.length; i++) { var char = output.Scoreboard[i]; workers[char] = workers[char] ? (workers[char] + 1) : 1; } } // Add worker data to the output. 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["."] }; // Return JSON string. return JSON.stringify(output); url: '{$APACHE.STATUS.URL}' query_fields: - name: auto tags: - tag: Application value: Apache - uuid: da499c2810ee4f779dbefe12d8d2705e name: 'Total traffic' type: DEPENDENT key: apache.traffic delay: '0' units: B preprocessing: - type: JSONPATH parameters: - '$["Total kBytes"]' - type: MULTIPLIER parameters: - '1024' master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 7d13f247851747f2add629749491169e name: Uptime type: DEPENDENT key: apache.uptime delay: '0' units: s preprocessing: - type: JSONPATH parameters: - $.ServerUptimeSeconds master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 91a6a730cf9c4827868f2a8e5815ec8d name: Version type: DEPENDENT key: apache.version delay: '0' history: 30d trends: '0' value_type: CHAR preprocessing: - type: JSONPATH parameters: - $.ServerVersion master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 4ab3217978274491bac1f76fe4c3231a name: 'Workers idle cleanup' type: DEPENDENT key: apache.workers.cleanup delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.cleanup error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: ee48d4d331c54e13a9a8a50018caeffb name: 'Workers closing connection' type: DEPENDENT key: apache.workers.closing delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.closing error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 9e64b797bd5d4158b8bfa2f2a18b1b32 name: 'Workers DNS lookup' type: DEPENDENT key: apache.workers.dnslookup delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.dnslookup error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: ebfcba1193fe43a39b11c5cd17963b21 name: 'Workers finishing' type: DEPENDENT key: apache.workers.finishing delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.finishing error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 12ca5b3e09944b13bfcb6c0e9ec50a31 name: 'Workers keepalive (read)' type: DEPENDENT key: apache.workers.keepalive delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.keepalive error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 528ecd2dd4f246f1b4388eb05c92432f name: 'Workers logging' type: DEPENDENT key: apache.workers.logging delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.logging error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 6466642b0b3d43d69e1565e575ee74eb name: 'Workers reading request' type: DEPENDENT key: apache.workers.reading delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.reading error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: c7bea4b21d2945018eb568b4efed7757 name: 'Workers sending reply' type: DEPENDENT key: apache.workers.sending delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.sending error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: 231811e984bd4687bb981314b72fbdeb name: 'Workers starting up' type: DEPENDENT key: apache.workers.starting delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.starting error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache - uuid: beaee936d37b4a0bb4515d1798efd393 name: 'Workers waiting for connection' type: DEPENDENT key: apache.workers.waiting delay: '0' preprocessing: - type: JSONPATH parameters: - $.Workers.waiting error_handler: DISCARD_VALUE master_item: key: apache.status tags: - tag: Application value: Apache