From patchwork Sun Apr 2 11:07:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 6759 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PqB811NW7z3wvh for ; Sun, 2 Apr 2023 11:07:45 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqB7y24hhz3pR; Sun, 2 Apr 2023 11:07:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PqB7x4TkDz30J0; Sun, 2 Apr 2023 11:07:41 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PqB7w0zzMz2yVQ for ; Sun, 2 Apr 2023 11:07:40 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqB7t04CpzNW for ; Sun, 2 Apr 2023 11:07:37 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=GKnZUm5P; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1680433658; a=rsa-sha256; cv=none; b=VnxtAYK09W7t4f606lhwbOGpbD/7Jm491RYg32jerFw76OlWo5pTlGdArO2K7LkTBiGFuP 9kECnmxEIp3zbUtE1w5QEnGq8aYyy/FOPdEhpVsnQnQuvqJuQyXYS/fyEvv7IeFG3T9+7Q LqWS7QYMdePIaSciPnLJaQXReMlDp+nfsuCIyyOZ0ehAwK4WXXvjoQrYi1cUgrTYWO1FPf CeKblSGp4Jhq53ns1YEEJDE+Glu76LxHSIRU9oFcax3E5setYl5TgsZYhsb4nWwdABr7wp Y2YTA/hRQc3RaEWowmGmFi2sUKth59PMab3ymLUr723iHJW/erY0JpbhpMBAEA== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=GKnZUm5P; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1680433658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OtEPqnkpI1QJsf2GF+mBc++rzHeOZKTqDID6iNNghEY=; b=pY4R85Aqkk/I2zN0G7UC/RaIdoZT9AXHIuvHUF0sqx8x3Nay+jsJqSkKTw784WMBS97m+o 7HcJNKDiuW73s7VXI4jIrRKDLXzMXs2es9r1m1scRCElrXECSWL9RuBP0bdKg1wMQwoWuc z+3XHQ57GnBVkqlphkh0ysjhO45c1tJO8u29tnyStcuk4GPcIJfnn3jn5GQ8uJo+kwFfgW VKsQCW7rl+GngD07QsRsJaNgSahQpy7ZVh9q7DQgj/deB1TNpOpN7y/BudnvEjkZOKWdOd yjnYHSD2OAZEIk1FLEWs01s6cAGqcagRexrtzI+4lTX+lpqhPtsARd4hASCfrw== Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D66364024A for ; Sun, 2 Apr 2023 13:07:36 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vhZefRtdt1lx for ; Sun, 2 Apr 2023 13:07:35 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id A0EEDC905F; Sun, 2 Apr 2023 13:07:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1680433655; bh=5h7gQ/Sk8rrTq5gVDCOOQkYIO4+kryEofCpQ+0+LO+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GKnZUm5PFKdfwhuwUaL/4gSUSS8Zvz58d4dmSuDBAtx/blHWrkL9YjSfbAM5paN3J +f1o0npc7L0lKZCrW94nJZJt9uM0YVYLoEI8WkCm3IebgTQZ9kv1HSfpUc3XNMEZ4E jaV2epISLiowGfse06bfGirOVTwx5KqAMKB4HMWgLYbn0EZLu5SJke91ujNYX2ymXo iBsjBCB99jai6Wb++tZBnclJXGm62RT84vrYhw8J9WwkdYlo/ZUyWtrwYWtStBKMdC GSIaeFqHvjRaUDN9AF84PbJ/BmbwBNxOeQYJbdIGnqlgVTLetM8xxi7b98ZHzsausz Bx2BETWzOe6tw== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 1/3] zabbix_agentd: Update to 6.0.15 (LTS) Date: Sun, 2 Apr 2023 13:07:09 +0200 Message-Id: <20230402110711.19593-2-robin.roevens@disroot.org> In-Reply-To: <20230402110711.19593-1-robin.roevens@disroot.org> References: <20230402110711.19593-1-robin.roevens@disroot.org> MIME-Version: 1.0 X-sicho-MailScanner-ID: A0EEDC905F.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1681038442.96209@HHzD/v8rF6zpwaAVZoFKaA X-Rspamd-Action: no action X-Rspamd-Server: mail01.haj.ipfire.org X-Rspamd-Queue-Id: 4PqB7t04CpzNW X-Spamd-Result: default: False [-0.14 / 11.00]; BAYES_HAM(-2.99)[99.96%]; SPF_REPUTATION_SPAM(2.37)[0.78937627724883]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,reject]; R_MISSING_CHARSET(0.50)[]; R_SPF_ALLOW(-0.20)[+a]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; DKIM_REPUTATION(0.00)[0]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; ARC_NA(0.00)[] X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - Update from version 6.0.6 to 6.0.15 - Update of rootfile not required - Changelog No substantial changes for Agent Linux version Changelogs since 6.0.6: - https://www.zabbix.com/rn/rn6.0.7 - https://www.zabbix.com/rn/rn6.0.8 - https://www.zabbix.com/rn/rn6.0.9 - https://www.zabbix.com/rn/rn6.0.10 - https://www.zabbix.com/rn/rn6.0.11 - https://www.zabbix.com/rn/rn6.0.12 - https://www.zabbix.com/rn/rn6.0.13 - https://www.zabbix.com/rn/rn6.0.14 - https://www.zabbix.com/rn/rn6.0.15 Signed-off-by: Robin Roevens Reviewed-by: Adolf Belka --- lfs/zabbix_agentd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index d7b5a4b37..281bd9fa3 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -26,7 +26,7 @@ include Config SUMMARY = Zabbix Agent -VER = 6.0.6 +VER = 6.0.15 THISAPP = zabbix-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -34,7 +34,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) PROG = zabbix_agentd -PAK_VER = 6 +PAK_VER = 7 DEPS = fping @@ -48,7 +48,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_BLAKE2 = f9d07ca8938ae4e5e47048c32872644caeda0ecdef17513c63c63d1ce2aaa4ac0c92e6c70932bc598ff908419dae05bab32924f5973a5528b5668f7c7c2c5a17 +$(DL_FILE)_BLAKE2 = dfef2036df2afbc50f4706a98105311e859f21cd01b430bc26f960bc650ff2d83c0db2977a85561cc75ddeb5fbb7a6704948dfa17749b238583f4f50e15f18a7 install : $(TARGET) From patchwork Sun Apr 2 11:07:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 6758 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PqB7z5yYJz3wvh for ; Sun, 2 Apr 2023 11:07:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqB7x5HfDzp8; Sun, 2 Apr 2023 11:07:41 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PqB7x3gpNz30D6; Sun, 2 Apr 2023 11:07:41 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PqB7w0f8tz2xNW for ; Sun, 2 Apr 2023 11:07:40 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqB7t0Lq4zp8 for ; Sun, 2 Apr 2023 11:07:37 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=EpjlAcsX; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1680433658; a=rsa-sha256; cv=none; b=IcFYl5tZVHFtA+LuPTCsMhbYSzbycbkP1DMCgnvhDPpxNpsu0zdtYP9D0vNzX0Ntu3rEzR ARkK1mEh0BgwAcxScEk0nyGHYdbL1jUW7b7oSrRcIY8VUtw1uZoGdpjHU1dA7j4taSzZfO YU5sM/nKGTHNMyeillQE2iHuFMRWch/xok31IjfSj/A+32YEjvXjzW0OstghpN19qiHlD2 ii2XJpBit6JEgrKOt8Dnp81ZwLbzLoOymCdQmPLGNOaj2KEZTSnwmlIFfde5vBKvdyrhv2 /hcJY4EEL+J842blWNN80QltaShMVF/7ZC9OX3nyjN8Q0jtyK1DJbeGUWyP1sw== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=EpjlAcsX; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1680433658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kFk0kjzHcEKvatRn3p06iBwxotNcJMjVuohdfepB6qA=; b=FQNAZXu6sm2U9VzlhJdla9jHThUgcC5Tydx4Yk/d66oP5JnVO8Hopr4sGoCBtobjDfCn2g sVUGZbfGRLuy+QK+AfoR37MjhJtcrV4pIXn3W0dxNEZe+7MHVY73B6aVvbNLQli0D3c5wX N4KUSShGjJYUzYEty4rGBL+toIL4/3RsRZOGCuWHRicNqsTc59DuFOjXtJ2rczIGh82x3b hhdtQXLrtUyirLAJ1AWHNCh0JHPod4iaKECC1FM7p7UVwlH6aSowzE/8wuZedTFyvxDwU2 +meKUIOwQeQgLRrJR/KElXNPWIcCa7jwNKirvb+AiwuaT3L9leGrTq05cr2dag== Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 0C2804021F for ; Sun, 2 Apr 2023 13:07:37 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S_OlqEQf-1nd for ; Sun, 2 Apr 2023 13:07:35 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id A3092C9062; Sun, 2 Apr 2023 13:07:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1680433655; bh=WaLPTWvcPalWGlFCAxGIkAfUCyLlE7HndFoO9FX77ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EpjlAcsXCvAA1ZFh7+uK9oukXWEEEZqViYEGYBtL5XIvC3dm6yKzy8WCt0H20bCrt gkZiY+i+8ePidQus3vZW3uC6hOyx8+u6afZ5uZ7ArZJEcZZkf0eHGWJQrOPf1r/uda 0vGg9AGzGPo5x0N7Ee3sQz+mWNCSQJGqQ9+g+Nr0838fkbXNcAhBjBK6ptbEbzwwGz Akl+nkCRFZ+HKyh+HcKfVilIGx/fURCTbEj5LqI3qH7qQQSRideYh9VWRuJ6E2LNGf zKuv/7XX76FiISUYBMZdGa6tHDT7D2R7zmHDhFOYprkuKn6q0x715DCewuKrPjyKSs eLm40kAI7ixYQ== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 2/3] Bugfix: compatibility with grep 3.8+ Date: Sun, 2 Apr 2023 13:07:10 +0200 Message-Id: <20230402110711.19593-3-robin.roevens@disroot.org> In-Reply-To: <20230402110711.19593-1-robin.roevens@disroot.org> References: <20230402110711.19593-1-robin.roevens@disroot.org> MIME-Version: 1.0 X-sicho-MailScanner-ID: A3092C9062.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1681038442.8439@jiKTOtaZ5gHxKf0Zr+iF5A X-Rspamd-Action: no action X-Rspamd-Server: mail01.haj.ipfire.org X-Rspamd-Queue-Id: 4PqB7t0Lq4zp8 X-Spamd-Result: default: False [-0.15 / 11.00]; BAYES_HAM(-3.00)[99.99%]; SPF_REPUTATION_SPAM(2.37)[0.78937627724883]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,reject]; R_MISSING_CHARSET(0.50)[]; R_SPF_ALLOW(-0.20)[+a]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; DKIM_REPUTATION(0.00)[0]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; ARC_NA(0.00)[] X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Fix "grep: warning: stray \ before /" message on Zabbix Agent ipfire.net.fw.hits item introduced by grep 3.8 in https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=40b5df3942149738529c22c9cfcd067cd672b605 Signed-off-by: Robin Roevens Reviewed-by: Adolf Belka --- config/zabbix_agentd/userparameter_ipfire.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/zabbix_agentd/userparameter_ipfire.conf b/config/zabbix_agentd/userparameter_ipfire.conf index 10c09c25d..c5a636edf 100644 --- a/config/zabbix_agentd/userparameter_ipfire.conf +++ b/config/zabbix_agentd/userparameter_ipfire.conf @@ -5,7 +5,7 @@ UserParameter=ipfire.net.gateway.pingtime,sudo /usr/sbin/fping -c 3 gateway 2>&1 # Internet Gateway availability, can be used to check Internet connection UserParameter=ipfire.net.gateway.ping,sudo /usr/sbin/fping -q -r 3 gateway; [ ! $? ]; echo $? # Firewall Filter Forward chain drops in bytes/chain (JSON), can be used for discovery of firewall chains and monitoring of firewall hits on each chain -UserParameter=ipfire.net.fw.hits.raw,sudo /usr/local/bin/getipstat -xf | grep "\/\* DROP_.* \*\/$" | awk 'BEGIN { ORS = ""; print "["} { printf "%s{\"chain\": \"%s\", \"bytes\": \"%s\"}", separator, substr($11, 6), $2; separator = ", "; } END { print"]" }' +UserParameter=ipfire.net.fw.hits.raw,sudo /usr/local/bin/getipstat -xf | grep "/\* DROP_.* \*/$" | awk 'BEGIN { ORS = ""; print "["} { printf "%s{\"chain\": \"%s\", \"bytes\": \"%s\"}", separator, substr($11, 6), $2; separator = ", "; } END { print"]" }' # Number of currently Active DHCP leases UserParameter=ipfire.dhcpd.clients,grep -s -E 'lease|bind' /var/state/dhcp/dhcpd.leases | sed ':a;/{$/{N;s/\n//;ba}' | grep "state active" | wc -l # Number of Captive Portal clients From patchwork Sun Apr 2 11:07:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 6760 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PqB8222Zwz3wvh for ; Sun, 2 Apr 2023 11:07:46 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqB7z62F6z315; Sun, 2 Apr 2023 11:07:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PqB7z5Jqrz2yl8; Sun, 2 Apr 2023 11:07:43 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PqB7x4hwcz30JQ for ; Sun, 2 Apr 2023 11:07:41 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqB7v38RGzx5 for ; Sun, 2 Apr 2023 11:07:39 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=QWtLegwW; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1680433659; a=rsa-sha256; cv=none; b=fp1uqqA4Wt0y9abgtxAyQiH/dmR/CcjXa2IFcH+jUdjHK7oZR1OJA5KSyYaK/Klb6pJT73 Spy2mrcm+4z4AKWTWN8YVCux8YW0uu5gSEWmubFUZ8CM2GLCTxMuJE7ot5yCk+l90/BvVM ++OiuK+hQGKSoKIxIZHeazjGL1tYVpZhApP7fHrnk89pVj4ieU0R6i92R/eQhkDva+wbEF Nv+6zEqwmD6S2xdA+CpDRPAacquD/YlNAQ8qfxu1mF+s1wAood1yLnxsCsrINjSyxwUt8O d9jos/qLWeabCqtYh4nlVlv64X9aAYByTFufo2/02q6/aepnO1cU7q4eh1zNkA== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=QWtLegwW; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1680433659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OpK+jqRKcMt7Ji9etI5g+3sn40r2bFkS7l7BcIrpwX4=; b=PKh4Va4i2PqX/k7zqLcnbUGm9bUlm2Gu7w7gtXAxMzhm6BkOpOkXlyWiO3s1ZAAXME//li UgRKnivQinGiNC3Z6zUJqS5R/xNiGXQE54r1Q9JCx7BLJa5oaTZzfByxxhZWlVqN+HJzrH gtpVddKk1G4LAimZaK+ZyU4ShCIARVAkMlm4LxAtJuV8kveVu3yvIpIVhv6BD6eLOkbLYq R964uf9axxPyZOBy6oy5dqzNIgxGdJMGcg0nMH4L+VYvTdcX39EpJF9LXndM45SxGMuGs3 PaGciipyYKdspYvIxVc3DFMnPvgcKMJbXzM4hTD8MuRfJy3AbCv9tBd4pEoUGQ== Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id EA11340249 for ; Sun, 2 Apr 2023 13:07:38 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7kWfdsOC39HN for ; Sun, 2 Apr 2023 13:07:35 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id A54C0C9065; Sun, 2 Apr 2023 13:07:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1680433655; bh=YHGjYxO1EQ1QCm++Q/5MYgHQEJBS7BijjndFzDcr0+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QWtLegwWHoGX+44xq338v+erUnkBRBOJN0K30OMMnNp5qyLB4m+QASsrs9gdg0JO+ 4Xv43iRGAHi2KEP7QIfal1iYT0TbCPdse1bFEv6JFo4eEkoKQ8cOqdoAweFQGr3mQE z1zP4UIf3mfkXg1UcYO6nlmse3cpINM+ubXwnPzDzeRRUeSDJv6xcfjlAf2bgrStV4 SAFY8HRoJfx7Ruv71t8Gnr3+mz45CmefSJ4Lu3e4a6wm+uHobXu+LMd+7aaaVdj/h9 L4ljfv4Bgzd/uRgrB1ILK1ak2TwSIwzKLYrbk4Zg6NaB2rVxpDpWGJf+4Cgpn5nMJD +51t7MP6IGz3w== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 3/3] Add Zabbix Agent Logs viewer in WebGUI Date: Sun, 2 Apr 2023 13:07:11 +0200 Message-Id: <20230402110711.19593-4-robin.roevens@disroot.org> In-Reply-To: <20230402110711.19593-1-robin.roevens@disroot.org> References: <20230402110711.19593-1-robin.roevens@disroot.org> MIME-Version: 1.0 X-sicho-MailScanner-ID: A54C0C9065.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1681038442.91745@gsAvpBMTB87znm8g8rdeZQ X-Rspamd-Action: no action X-Rspamd-Server: mail01.haj.ipfire.org X-Rspamd-Queue-Id: 4PqB7v38RGzx5 X-Spamd-Result: default: False [-0.15 / 11.00]; BAYES_HAM(-3.00)[100.00%]; SPF_REPUTATION_SPAM(2.37)[0.78937627724883]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,reject]; R_MISSING_CHARSET(0.50)[]; R_SPF_ALLOW(-0.20)[+a:c]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; DKIM_REPUTATION(0.00)[0]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; ARC_NA(0.00)[] X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - Adds a simple logs viewer page logs.cgi/zabbix_agentd.dat, based on logs.cgi/logs.dat, to the Logs menu in GUI. - Changes permission of zabbix_agentd logfiles in logrotate config for GUI to be able to access the log files (640 to 644) - Changes file permissions of existing zabbix_agentd logfiles upon update of the package - Rootfile changes: added gui page, menu item-file, and addon language files - configroot rootfile changes: added logs menu item-file as comment - web-user-interface rootfile changes: added log viewer .dat as comment - Update language cache during install/uninstall Signed-off-by: Robin Roevens --- config/menu/EX-zabbix_agentd.menu | 5 + config/rootfiles/common/configroot | 1 + config/rootfiles/common/web-user-interface | 1 + config/rootfiles/packages/zabbix_agentd | 6 + config/zabbix_agentd/logrotate | 2 +- config/zabbix_agentd/zabbix_agentd.de.pl | 8 + config/zabbix_agentd/zabbix_agentd.en.pl | 8 + config/zabbix_agentd/zabbix_agentd.fr.pl | 8 + config/zabbix_agentd/zabbix_agentd.nl.pl | 8 + html/cgi-bin/logs.cgi/zabbix_agentd.dat | 341 +++++++++++++++++++++ lfs/zabbix_agentd | 4 + src/paks/zabbix_agentd/install.sh | 1 + src/paks/zabbix_agentd/uninstall.sh | 1 + src/paks/zabbix_agentd/update.sh | 3 + 14 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 config/menu/EX-zabbix_agentd.menu create mode 100644 config/zabbix_agentd/zabbix_agentd.de.pl create mode 100644 config/zabbix_agentd/zabbix_agentd.en.pl create mode 100644 config/zabbix_agentd/zabbix_agentd.fr.pl create mode 100644 config/zabbix_agentd/zabbix_agentd.nl.pl create mode 100644 html/cgi-bin/logs.cgi/zabbix_agentd.dat diff --git a/config/menu/EX-zabbix_agentd.menu b/config/menu/EX-zabbix_agentd.menu new file mode 100644 index 000000000..dddd7f05e --- /dev/null +++ b/config/menu/EX-zabbix_agentd.menu @@ -0,0 +1,5 @@ + $sublogs->{'95.zabbixagent'} = {'caption' => $Lang::tr{'zabbix agent logs'}, + 'uri' => '/cgi-bin/logs.cgi/zabbix_agentd.dat', + 'title' => "$Lang::tr{'zabbix agent logs'}", + 'enabled' => 1 + }; diff --git a/config/rootfiles/common/configroot b/config/rootfiles/common/configroot index bc979cf2c..f12e2e0f0 100644 --- a/config/rootfiles/common/configroot +++ b/config/rootfiles/common/configroot @@ -126,6 +126,7 @@ var/ipfire/menu.d/70-log.menu #var/ipfire/menu.d/EX-samba.menu #var/ipfire/menu.d/EX-tor.menu #var/ipfire/menu.d/EX-wlanap.menu +#var/ipfire/menu.d/EX-zabbix_agentd.menu var/ipfire/modem var/ipfire/modem-lib.pl #var/ipfire/modem/defaults diff --git a/config/rootfiles/common/web-user-interface b/config/rootfiles/common/web-user-interface index 33f0d30a7..bc17b4ce4 100644 --- a/config/rootfiles/common/web-user-interface +++ b/config/rootfiles/common/web-user-interface @@ -49,6 +49,7 @@ srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromip.dat srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromport.dat srv/web/ipfire/cgi-bin/logs.cgi/summary.dat srv/web/ipfire/cgi-bin/logs.cgi/urlfilter.dat +#srv/web/ipfire/cgi-bin/logs.cgi/zabbix_agentd.dat srv/web/ipfire/cgi-bin/mac.cgi srv/web/ipfire/cgi-bin/mail.cgi srv/web/ipfire/cgi-bin/mdstat.cgi diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd index 6f2c831d7..5b57026f5 100644 --- a/config/rootfiles/packages/zabbix_agentd +++ b/config/rootfiles/packages/zabbix_agentd @@ -7,6 +7,7 @@ etc/zabbix_agentd/scripts etc/zabbix_agentd/zabbix_agentd.conf etc/zabbix_agentd/zabbix_agentd.conf.example etc/zabbix_agentd/zabbix_agentd.d +srv/web/ipfire/cgi-bin/logs.cgi/zabbix_agentd.dat usr/bin/zabbix_get usr/bin/zabbix_sender #usr/lib/modules @@ -16,6 +17,11 @@ usr/sbin/zabbix_agentd #usr/share/man/man1/zabbix_sender.1 #usr/share/man/man8/zabbix_agentd.8 var/ipfire/backup/addons/includes/zabbix_agentd +var/ipfire/addon-lang/zabbix_agentd.de.pl +var/ipfire/addon-lang/zabbix_agentd.en.pl +var/ipfire/addon-lang/zabbix_agentd.fr.pl +var/ipfire/addon-lang/zabbix_agentd.nl.pl +var/ipfire/menu.d/EX-zabbix_agentd.menu var/ipfire/zabbix_agentd var/ipfire/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf var/ipfire/zabbix_agentd/userparameters diff --git a/config/zabbix_agentd/logrotate b/config/zabbix_agentd/logrotate index 83bbca9fb..46fee44f2 100644 --- a/config/zabbix_agentd/logrotate +++ b/config/zabbix_agentd/logrotate @@ -5,5 +5,5 @@ delaycompress missingok notifempty - create 0640 zabbix zabbix + create 0644 zabbix zabbix } diff --git a/config/zabbix_agentd/zabbix_agentd.de.pl b/config/zabbix_agentd/zabbix_agentd.de.pl new file mode 100644 index 000000000..910225242 --- /dev/null +++ b/config/zabbix_agentd/zabbix_agentd.de.pl @@ -0,0 +1,8 @@ +%tr = ( +%tr, + +'zabbix agent logs' => "Zabbix Agent-Protokolldateien", + +); + +#EOF diff --git a/config/zabbix_agentd/zabbix_agentd.en.pl b/config/zabbix_agentd/zabbix_agentd.en.pl new file mode 100644 index 000000000..1f523f926 --- /dev/null +++ b/config/zabbix_agentd/zabbix_agentd.en.pl @@ -0,0 +1,8 @@ +%tr = ( +%tr, + +'zabbix agent logs' => "Zabbix Agent Logs", + +); + +#EOF diff --git a/config/zabbix_agentd/zabbix_agentd.fr.pl b/config/zabbix_agentd/zabbix_agentd.fr.pl new file mode 100644 index 000000000..f7576ad2f --- /dev/null +++ b/config/zabbix_agentd/zabbix_agentd.fr.pl @@ -0,0 +1,8 @@ +%tr = ( +%tr, + +'zabbix agent logs' => "Rapports de Zabbix Agent", + +); + +#EOF diff --git a/config/zabbix_agentd/zabbix_agentd.nl.pl b/config/zabbix_agentd/zabbix_agentd.nl.pl new file mode 100644 index 000000000..1f523f926 --- /dev/null +++ b/config/zabbix_agentd/zabbix_agentd.nl.pl @@ -0,0 +1,8 @@ +%tr = ( +%tr, + +'zabbix agent logs' => "Zabbix Agent Logs", + +); + +#EOF diff --git a/html/cgi-bin/logs.cgi/zabbix_agentd.dat b/html/cgi-bin/logs.cgi/zabbix_agentd.dat new file mode 100644 index 000000000..047ca2e98 --- /dev/null +++ b/html/cgi-bin/logs.cgi/zabbix_agentd.dat @@ -0,0 +1,341 @@ +#!/usr/bin/perl +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2020 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +use strict; + +# enable only the following on debugging purpose +# use warnings; +# use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); + +use POSIX(); + +my %cgiparams=(); +my %logsettings=(); +my $errormessage = ''; + +my @shortmonths = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', + 'Sep', 'Oct', 'Nov', 'Dec' ); +my @longmonths = ( $Lang::tr{'january'}, $Lang::tr{'february'}, $Lang::tr{'march'}, + $Lang::tr{'april'}, $Lang::tr{'may'}, $Lang::tr{'june'}, $Lang::tr{'july'}, $Lang::tr{'august'}, + $Lang::tr{'september'}, $Lang::tr{'october'}, $Lang::tr{'november'}, + $Lang::tr{'december'} ); + +my @now = localtime(); +my $dow = $now[6]; +my $doy = $now[7]; +my $tdoy = $now[7]; +my $year = $now[5]+1900; + +$cgiparams{'DAY'} = $now[3]; +$cgiparams{'MONTH'} = $now[4]; +$cgiparams{'ACTION'} = ''; + +&Header::getcgihash(\%cgiparams); +$logsettings{'LOGVIEW_REVERSE'} = 'off'; +&General::readhash("${General::swroot}/logging/settings", \%logsettings); +${Header::viewsize} = defined ($logsettings{'LOGVIEW_VIEWSIZE'}) ? $logsettings{'LOGVIEW_VIEWSIZE'} : 150; + +my $start = ($logsettings{'LOGVIEW_REVERSE'} eq 'on') ? 0x7FFFF000 : 0; #index of first line number to display + +if ($ENV{'QUERY_STRING'} && $cgiparams{'ACTION'} ne $Lang::tr{'update'}) { + my @temp = split(',',$ENV{'QUERY_STRING'}); + $start = $temp[0]; + $cgiparams{'MONTH'} = $temp[1]; + $cgiparams{'DAY'} = $temp[2]; +} + +if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/) || + !($cgiparams{'DAY'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)$/)) { + $cgiparams{'DAY'} = $now[3]; + $cgiparams{'MONTH'} = $now[4]; +} elsif($cgiparams{'ACTION'} eq '>>') { + my @temp_then=(); + my @temp_now = localtime(time); + $temp_now[4] = $cgiparams{'MONTH'}; + $temp_now[3] = $cgiparams{'DAY'}; + @temp_then = localtime(POSIX::mktime(@temp_now) + 86400); + ## Retrieve the same time on the next day + + ## 86400 seconds in a day + $cgiparams{'MONTH'} = $temp_then[4]; + $cgiparams{'DAY'} = $temp_then[3]; +} elsif($cgiparams{'ACTION'} eq '<<') { + my @temp_then=(); + my @temp_now = localtime(time); + $temp_now[4] = $cgiparams{'MONTH'}; + $temp_now[3] = $cgiparams{'DAY'}; + @temp_then = localtime(POSIX::mktime(@temp_now) - 86400); + ## Retrieve the same time on the next day - + ## 86400 seconds in a day + $cgiparams{'MONTH'} = $temp_then[4]; + $cgiparams{'DAY'} = $temp_then[3]; +} + +# Find in which file.gz is the log. Can be calculated because MONTHLY ROTATING of zabbix_agentd.log +my $gzindex; +my $date = $cgiparams{'DAY'} == 0 ? '' : $cgiparams{'DAY'} <= 9 ? "0$cgiparams{'DAY'}" : "$cgiparams{'DAY'}"; + +my @then = (); + +my $monthstr = ($cgiparams{'MONTH'} + 1) <= 9 ? "0" . ($cgiparams{'MONTH'} + 1) : ($cgiparams{'MONTH'} + 1); +my $daystr = $cgiparams{'DAY'} == 0 ? '..' : $cgiparams{'DAY'} <= 9 ? "0$cgiparams{'DAY'}" : "$cgiparams{'DAY'}"; +my $yearstr = $year; + +# Calculate time. If future date, calculate for past year !!! +if (( $cgiparams{'MONTH'} eq $now[4]) && ($cgiparams{'DAY'} > $now[3]) || + ( $cgiparams{'MONTH'} > $now[4] ) ) { + @then = localtime(POSIX::mktime( 0, 0, 0, $cgiparams{'DAY'}, $cgiparams{'MONTH'}, $year - 1901 )); + $date = "$longmonths[$cgiparams{'MONTH'}] $date, ". int($year-1); + $yearstr--; +} else { + @then = localtime(POSIX::mktime( 0, 0, 0, $cgiparams{'DAY'}, $cgiparams{'MONTH'}, $year - 1900 )); + $date = "$longmonths[$cgiparams{'MONTH'}] $date, $year"; +} + +$gzindex = $now[4] - $then[4]; +$gzindex += 12 if $gzindex < 0; + +my $lines = 0; +my @log=(); + +my $loop = 1; +my $filestr = 0; +my $search_for_end = 0; + +while ($gzindex >=0 && $loop) { + # calculate file name + if ($gzindex == 0) { + $filestr = "/var/log/zabbix/zabbix_agentd.log"; + } else { + $filestr = "/var/log/zabbix/zabbix_agentd.log.$gzindex"; + $filestr = "$filestr.gz" if -f "$filestr.gz"; + } + # now read file if existing + if (open (FILE,($filestr =~ /.gz$/ ? "gzip -dc $filestr |" : $filestr))) { + READ:while () { + my $line = $_; + if ($line =~ /^ *[0-9]+:${yearstr}${monthstr}${daystr}:[0-9]{6}\.[0-9]{3} (.*)/) { + # when standard viewing, just keep in memory the correct slice + # it starts at '$start' and size is $viewport + # If export, then keep all lines... + if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}){ + $log[$lines++] = "$line"; + } else { + if ($lines++ < ($start + $Header::viewsize)) { + push(@log,"$line"); + if (@log > $Header::viewsize) { + shift (@log); + } + } + } + $search_for_end = 1; # we find the start of slice, can look for end now + } else { + if ($search_for_end == 1) { + #finish read files when date is over (test month equality only) + $line =~ /^ *[0-9]+:[0-9]{4}([0-9]{2})([0-9]{2}):[0-9]{6}\.[0-9]{3} .*$/; + $loop = 0 if ( ($1 ne $monthstr) || ( ($daystr ne '..') && ($daystr ne $2) ) ); + } + } + } + close (FILE); + } + $gzindex--; # will try next gz file eg 40,39,38,.... because it may have holes +} + +if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) { + print "Content-type: text/plain\n\n"; + print "IPFire $Lang::tr{'zabbix agent logs'}\r\n"; + print "$Lang::tr{'date'}: $date\r\n\r\n"; + + if ($logsettings{'LOGVIEW_REVERSE'} eq 'on') { @log = reverse @log; } + + foreach $_ (@log) { + /^ *([0-9]+):[0-9]{6}([0-9]{2}):([0-9]{2})([0-9]{2})([0-9]{2}\.[0-9]{3}) (.*)$/; + my $pid = $1; + my $day = $2; + $day =~ tr / /0/; + my $time = $cgiparams{'DAY'} ? "$3:$4:$5" : "$day/$3:$4:$5" ; + print "$time ($pid) $6\r\n"; + } + exit 0; +} + +&Header::showhttpheaders(); + +&Header::openpage($Lang::tr{'zabbix agent logs'}, 1, ''); + +&Header::openbigbox('100%', 'left', '', $errormessage); + +if ($errormessage) { + &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); + print "$errormessage \n"; + &Header::closebox(); +} + +&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:"); + +print < + + + + + + + + + + + +
$Lang::tr{'month'}: + $Lang::tr{'day'}: +
+ +END +; + +&Header::closebox(); + +&Header::openbox('100%', 'left', $Lang::tr{'log'}); +print "

$Lang::tr{'total hits for log section'} $date: $lines

"; + +$start = $lines - ${Header::viewsize} if ($start >= $lines - ${Header::viewsize}); +$start = 0 if ($start < 0); + +my $prev; +if ($start == 0) { + $prev = -1; +} else { + $prev = $start - ${Header::viewsize}; + $prev = 0 if ( $prev < 0); +} + +my $next; +if ($start == $lines - ${Header::viewsize}) { + $next = -1; +} else { + $next = $start + ${Header::viewsize}; + $next = $lines - ${Header::viewsize} if ($next >= $lines - ${Header::viewsize}); +} + +if ($logsettings{'LOGVIEW_REVERSE'} eq 'on') { @log = reverse @log; } +if ($lines != 0) { &oldernewer(); } + +print < + + $Lang::tr{'time'} + PID +   + +END +; + +$lines = 0; +foreach $_ (@log) { + /^ *([0-9]+):[0-9]{6}([0-9]{2}):([0-9]{2})([0-9]{2})([0-9]{2}\.[0-9]{3}) (.*)$/; + my $pid = $1; + my $day = $2; + $day =~ tr / /0/; + my $time = $cgiparams{'DAY'} ? "$3:$4:$5" : "$day/$3:$4:$5" ; + my $data = $6; + my $col=""; + + if ($lines % 2) { + print ""; + $col="bgcolor='$color{'color20'}'"; + } else { + print ""; + $col="bgcolor='$color{'color22'}'"; + } + print "$time$pid" .&Header::cleanhtml ("$data", 'y') . "\n"; + $lines++; +} +print ""; + +&oldernewer(); + +&Header::closebox(); + +&Header::closebigbox(); + +&Header::closepage(); + +sub oldernewer { + print < + +END + ; + + print ""; + if ($prev != -1) { + print "$Lang::tr{'older'}"; + } else { + print "$Lang::tr{'older'}"; + } + print "\n"; + + print ""; + if ($next >= 0) { + print "$Lang::tr{'newer'}"; + } else { + print "$Lang::tr{'newer'}"; + } + print "\n"; + + print < + +END + ; +} diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index 281bd9fa3..49b8440f8 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -139,6 +139,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) -mkdir -pv /etc/logrotate.d install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/logrotate \ /etc/logrotate.d/zabbix_agentd + + # Install addon-specific language-files. + install -v -m 004 $(DIR_SRC)/config/zabbix_agentd/zabbix_agentd.*.pl \ + /var/ipfire/addon-lang/ @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/install.sh index 80632d1ec..465ea7e8a 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -32,6 +32,7 @@ if ! getent passwd zabbix; then fi extract_files +/usr/local/bin/update-lang-cache # Create symlinks for runlevel interaction. ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc3.d/S65zabbix_agentd diff --git a/src/paks/zabbix_agentd/uninstall.sh b/src/paks/zabbix_agentd/uninstall.sh index edff3b818..4342384de 100644 --- a/src/paks/zabbix_agentd/uninstall.sh +++ b/src/paks/zabbix_agentd/uninstall.sh @@ -25,6 +25,7 @@ stop_service ${NAME} make_backup ${NAME} remove_files +/usr/local/bin/update-lang-cache # Remove init-scripts and symlinks rm -rfv /etc/rc.d/rc*.d/*zabbix_agentd diff --git a/src/paks/zabbix_agentd/update.sh b/src/paks/zabbix_agentd/update.sh index a41e72ab4..f01e32810 100644 --- a/src/paks/zabbix_agentd/update.sh +++ b/src/paks/zabbix_agentd/update.sh @@ -40,6 +40,9 @@ if [ -f /etc/sudoers.d/zabbix ]; then fi fi +# Fix permissions on /var/log/zabbix/* to allow GUI to read the logfiles. +find /var/log/zabbix -perm 640 -exec chmod 644 \{\} \; + extract_backup_includes ./uninstall.sh ./install.sh