From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v2 3/3] Add Zabbix Agent to logviewer Date: Tue, 18 Apr 2023 20:45:12 +0200 Message-ID: <20230418184512.2235-4-robin.roevens@disroot.org> In-Reply-To: <20230418184512.2235-1-robin.roevens@disroot.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3839840236964573398==" List-Id: --===============3839840236964573398== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - Configure Zabbix Agent to log to syslog instead of its own logs. - Remove old zabbix log-dir and logrotate settings from rootfile, lfs and install-script. - Update log.dat to view Zabbix Agent logging from syslog. Signed-off-by: Robin Roevens --- config/rootfiles/packages/zabbix_agentd | 2 -- config/zabbix_agentd/logrotate | 9 --------- config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf | 5 ++--- html/cgi-bin/logs.cgi/log.dat | 6 ++++-- lfs/zabbix_agentd | 9 --------- src/paks/zabbix_agentd/install.sh | 4 +--- 6 files changed, 7 insertions(+), 28 deletions(-) delete mode 100644 config/zabbix_agentd/logrotate diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packa= ges/zabbix_agentd index 6f2c831d7..729a47ac6 100644 --- a/config/rootfiles/packages/zabbix_agentd +++ b/config/rootfiles/packages/zabbix_agentd @@ -1,4 +1,3 @@ -etc/logrotate.d/zabbix_agentd etc/rc.d/init.d/zabbix_agentd etc/sudoers.d/zabbix_agentd etc/sudoers.d/zabbix_agentd_user @@ -21,4 +20,3 @@ var/ipfire/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf var/ipfire/zabbix_agentd/userparameters var/ipfire/zabbix_agentd/userparameters/userparameter_pakfire.conf var/ipfire/zabbix_agentd/userparameters/userparameter_ipfire.conf -#var/log/zabbix diff --git a/config/zabbix_agentd/logrotate b/config/zabbix_agentd/logrotate deleted file mode 100644 index 83bbca9fb..000000000 --- a/config/zabbix_agentd/logrotate +++ /dev/null @@ -1,9 +0,0 @@ -/var/log/zabbix/zabbix_agentd.log { - monthly - rotate 12 - compress - delaycompress - missingok - notifempty - create 0640 zabbix zabbix -} diff --git a/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf b/confi= g/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf index c6be948be..f6580f3ba 100644 --- a/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf +++ b/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf @@ -1,8 +1,7 @@ PidFile=3D/var/run/zabbix/zabbix_agentd.pid =20 -# Log rotation is managed by logrotate -LogFile=3D/var/log/zabbix/zabbix_agentd.log -LogFileSize=3D0 +# Logs go to syslog so it can be viewed in WUI logviewer +LogType=3Dsystem =20 # These paths are included in the IPFire backups. Do not put user modules # or configuration files in other locations if you want them included in the diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat index 53b9073fc..01c382a0d 100644 --- a/html/cgi-bin/logs.cgi/log.dat +++ b/html/cgi-bin/logs.cgi/log.dat @@ -78,7 +78,8 @@ my %sections =3D ( 'ssh' =3D> '(sshd(?:\(.*\))?\[.*\]: )', 'unbound' =3D> '(unbound: \[.*?\])(.*:.*$)', 'urlfilter bl' =3D> '(installpackage\[urlfilter\]: )', - 'wireless' =3D> '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:)' + 'wireless' =3D> '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:)', + 'zabbix_agentd' =3D> '(zabbix_agentd\[.*?\]: )' ); =20 # Translations for the %sections array. @@ -112,7 +113,8 @@ my %trsections =3D ( 'ssh' =3D> 'SSH', 'unbound' =3D> 'DNS: Unbound', 'urlfilter bl' =3D> 'URLFilter Blacklist', - 'wireless' =3D> 'Wireless' + 'wireless' =3D> 'Wireless', + 'zabbix_agentd' =3D> 'Zabbix Agent' ); =20 =20 diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index 45f7cec1f..4f2a8b5d8 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -114,10 +114,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # Create directory for additional agent modules -mkdir -pv /usr/lib/zabbix =20 - # Create directory for logging - -mkdir -pv /var/log/zabbix - chown zabbix.zabbix /var/log/zabbix - # Create directory for pid. -mkdir -pv /var/run/zabbix chown zabbix.zabbix /var/run/zabbix @@ -135,10 +131,5 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) install -v -m 644 $(DIR_SRC)/config/backup/includes/zabbix_agentd \ /var/ipfire/backup/addons/includes/zabbix_agentd =20 - # Install include file for Logrotate - -mkdir -pv /etc/logrotate.d - install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/logrotate \ - /etc/logrotate.d/zabbix_agentd - @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/insta= ll.sh index 80632d1ec..e3f988c34 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -39,7 +39,6 @@ ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc0.d/K02zabbix_ag= entd ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc6.d/K02zabbix_agentd =20 # Create additonal directories and set permissions -[ -d /var/log/zabbix ] || ( mkdir -pv /var/log/zabbix && chown zabbix.zabbix= /var/log/zabbix ) [ -d /usr/lib/zabbix ] || ( mkdir -pv /usr/lib/zabbix && chown zabbix.zabbix= /usr/lib/zabbix ) =20 restore_backup ${NAME} @@ -66,8 +65,7 @@ grep -q "Include=3D/var/ipfire/zabbix_agentd/zabbix_agentd_= ipfire_mandatory.conf" if [ $? -eq 1 ]; then # Remove settings that are now in our own config sed -i -e "\|^PidFile=3D.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf - sed -i -e "\|^LogFile=3D.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf - sed -i -e "\|^LogFileSize=3D.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf + sed -i -e "\|^LogType=3D.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf sed -i -e "\|^LoadModulePath=3D.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf sed -i -e "\|^Include=3D/etc/zabbix_agentd/zabbix_agentd\.d/\*\.conf$|d" /e= tc/zabbix_agentd/zabbix_agentd.conf # Include our own config in main config --=20 2.40.0 --=20 Dit bericht is gescanned op virussen en andere gevaarlijke inhoud door MailScanner en lijkt schoon te zijn. --===============3839840236964573398==--