This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 2.x development tree".
The branch, next has been updated via 5a1aaf023329833600bef771848c381da31347b9 (commit) via d335cc9592afa74f219bbf564b01c612ea336e77 (commit) via a66263b4f5c746c3c7f7c320e45c3ac78811c7a8 (commit) via a20209975a29184570821679e87b4728ab81e688 (commit) from 7ad12edfb0d233498410f2afc09753e70de50f80 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 5a1aaf023329833600bef771848c381da31347b9 Author: Michael Tremer michael.tremer@ipfire.org Date: Wed Sep 11 09:45:58 2024 +0000
core189: Ship header.pl
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit d335cc9592afa74f219bbf564b01c612ea336e77 Author: Robin Roevens robin.roevens@disroot.org Date: Tue Sep 10 23:32:32 2024 +0200
header.pl: only get memory consumption when service is running
It probably doesn't matter much as the get_memory_consumption function just returns 0 when no pids are found. But it shouldn't even try as the mem var is never used when the service is not running.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit a66263b4f5c746c3c7f7c320e45c3ac78811c7a8 Author: Robin Roevens robin.roevens@disroot.org Date: Tue Sep 10 23:12:31 2024 +0200
zabbix_agentd: Add IPFire services.get item
- Adds Zabbix Agent userparameter `ipfire.services.get` for the agent to get details about configured IPFire services (builtin and addon-services) - Includes `ipfire_services.pl` script in sudoers for Zabbix Agent as it needs root permission to call addonctrl for addon service states. - Adapts lfs install script to install new script - Adds new script to rootfiles
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
commit a20209975a29184570821679e87b4728ab81e688 Author: Robin Roevens robin.roevens@disroot.org Date: Tue Sep 10 20:25:59 2024 +0200
zabbix_agentd: Update to 6.0.33 (LTS)
- Update from version 6.0.30 to 6.0.33 - Update of rootfile not required
Bugs fixed: - ZBX-20766: Fixed confusing port binding error message - ZBX-24391: Fixed Zabbix agent to return net.tcp.socket.count result without error if IPv6 is disabled
Full changelogs since 6.0.30: - https://www.zabbix.com/rn/rn6.0.31 - https://www.zabbix.com/rn/rn6.0.32 - https://www.zabbix.com/rn/rn6.0.33
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
-----------------------------------------------------------------------
Summary of changes: config/cfgroot/header.pl | 6 +- config/rootfiles/core/189/filelists/files | 1 + config/rootfiles/packages/zabbix_agentd | 1 + config/zabbix_agentd/ipfire_services.pl | 212 +++++++++++++++++++++++++ config/zabbix_agentd/sudoers | 1 + config/zabbix_agentd/userparameter_ipfire.conf | 4 +- lfs/zabbix_agentd | 8 +- 7 files changed, 226 insertions(+), 7 deletions(-) create mode 100755 config/zabbix_agentd/ipfire_services.pl
Difference in files: diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index a90a6f481..3778c4e59 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -950,9 +950,6 @@ EOF @pids = &General::find_pids("${process}"); }
- # Get memory consumption - my $mem = &General::get_memory_consumption(@pids); - print <<EOF; <tr> <th scope="row"> @@ -962,6 +959,9 @@ EOF
# Running? if (scalar @pids) { + # Get memory consumption + my $mem = &General::get_memory_consumption(@pids); + # Format memory $mem = &General::formatBytes($mem);
diff --git a/config/rootfiles/core/189/filelists/files b/config/rootfiles/core/189/filelists/files index 17944f7ff..e2bd83e7e 100644 --- a/config/rootfiles/core/189/filelists/files +++ b/config/rootfiles/core/189/filelists/files @@ -1 +1,2 @@ etc/rc.d/init.d/functions +var/ipfire/header.pl diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd index 8e10cb4c8..ffa66f307 100644 --- a/config/rootfiles/packages/zabbix_agentd +++ b/config/rootfiles/packages/zabbix_agentd @@ -23,3 +23,4 @@ var/ipfire/zabbix_agentd/userparameters/userparameter_ipfire.conf var/ipfire/zabbix_agentd/userparameters/userparameter_ovpn.conf var/ipfire/zabbix_agentd/scripts var/ipfire/zabbix_agentd/scripts/ipfire_certificate_detail.sh +var/ipfire/zabbix_agentd/scripts/ipfire_services.pl diff --git a/config/zabbix_agentd/ipfire_services.pl b/config/zabbix_agentd/ipfire_services.pl new file mode 100755 index 000000000..653b606ee --- /dev/null +++ b/config/zabbix_agentd/ipfire_services.pl @@ -0,0 +1,212 @@ +#!/usr/bin/perl +############################################################################### +# ipfire_services.pl - Retrieves available IPFire services information and +# return this as a JSON array suitable for easy processing +# by Zabbix server +# +# Author: robin.roevens (at) disroot.org +# Version: 3.0 +# +# Copyright (C) 2007-2024 IPFire Team info@ipfire.org +# +# 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 http://www.gnu.org/licenses/. +# +############################################################################### + +use strict; + +# enable only the following on debugging purpose +# use warnings; + +# Load General functions +require "/var/ipfire/general-functions.pl"; + +# Load Pakfire functions +require "/opt/pakfire/lib/functions.pl"; + +my $first = 1; + +print "["; + +# Built-in services +my %services = ( + # DHCP Server + 'DHCP Server' => { + "process" => "dhcpd", + }, + + # Web Server + 'Web Server' => { + "process" => "httpd", + }, + + # Cron Server + 'CRON Server' => { + "process" => "fcron", + }, + + # DNS Proxy + 'DNS Proxy Server' => { + "process" => "unbound", + }, + + # Syslog + 'Logging Server' => { + "process" => "syslogd", + }, + + # Kernel Logger + 'Kernel Logging Server' => { + "process" => "klogd", + }, + + # Time Server + 'NTP Server' => { + "process" => "ntpd", + }, + + # SSH Server + 'Secure Shell Server' => { + "process" => "sshd", + }, + + # IPsec + 'VPN' => { + "process" => "charon", + }, + + # Web Proxy + 'Web Proxy' => { + "process" => "squid", + }, + + # IPS + 'Intrusion Prevention System' => { + "process" => "suricata", + "pidfile" => "/var/run/suricata.pid", + }, + + # OpenVPN Roadwarrior + 'OpenVPN Roadwarrior Server' => { + "process" => "openvpn", + "pidfile" => "/var/run/openvpn.pid", + } +); + +foreach my $service (sort keys %services){ + my %config = %{ $services{$service} }; + + my $pidfile = $config{"pidfile"}; + my $process = $config{"process"}; + + # Collect all pids + my @pids = (); + + # Read the PID file or go search... + if (defined $pidfile) { + @pids = &General::read_pids("${pidfile}"); + } else { + @pids = &General::find_pids("${process}"); + } + + # Not Running + my $status = ""state":"0""; + + # Running? + if (scalar @pids) { + # Get memory consumption + my $mem = &General::get_memory_consumption(@pids); + + $status = ""state":1,"pids":[" . join(',', @pids) . "],"memory":$mem"; + } + + print "," if not $first; + $first = 0; + + print "{"; + print ""service":"$service","servicename":"$process",$status"; + print "}"; +} + +# Generate list of installed addon pak's +my %paklist = &Pakfire::dblist("installed"); + +foreach my $pak (keys %paklist) { + my %metadata = &Pakfire::getmetadata($pak, "installed"); + + # If addon contains services + if ("$metadata{'Services'}") { + foreach my $service (split(/ /, "$metadata{'Services'}")) { + print ","; + print "{"; + + print ""service":"Addon: $metadata{'Name'}","; + print ""servicename":"$service","; + + my $onboot = isautorun($pak, $service); + print ""onboot":$onboot,"; + + print &addonservicestats($pak, $service); + + print "}"; + } + } +} + +print "]"; + +sub isautorun() { + my ($pak, $service) = @_; + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "boot-status", "$service"); + my $testcmd = @testcmd[0]; + my $status = 9; + + # Check if autorun for the given service is enabled. + if ( $testcmd =~ /enabled\ on\ boot/ ) { + $status = 1; + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { + $status = 0; + } + + # Return the status. + return $status; +} + +sub addonservicestats() { + my ($pak, $service) = @_; + my $testcmd = ''; + my $exename; + my @memory = (0); + + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "status", "$service"); + my $testcmd = @testcmd[0]; + + my $status = ""state":0"; + if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){ + $testcmd =~ s/.* //gi; + $testcmd =~ s/[a-z_]//gi; + $testcmd =~ s/[[0-1];[0-9]+//gi; + $testcmd =~ s/[().]//gi; + $testcmd =~ s/ //gi; + $testcmd =~ s///gi; + + my @pids = split(/\s/,$testcmd); + + # Fetch the memory consumption + my $memory = &General::get_memory_consumption(@pids); + + $status = ""state":1,"pids":[" . join(',', @pids) . "],"memory":$memory"; + } + return $status; +} diff --git a/config/zabbix_agentd/sudoers b/config/zabbix_agentd/sudoers index 138c75635..78e175980 100644 --- a/config/zabbix_agentd/sudoers +++ b/config/zabbix_agentd/sudoers @@ -10,3 +10,4 @@ Defaults:zabbix !requiretty zabbix ALL=(ALL) NOPASSWD: /opt/pakfire/pakfire status, /usr/sbin/fping, /usr/local/bin/getipstat, /bin/cat /var/run/ovpnserver.log zabbix ALL=(ALL) NOPASSWD: /var/ipfire/zabbix_agentd/scripts/ipfire_certificate_detail.sh +zabbix ALL=(ALL) NOPASSWD: /var/ipfire/zabbix_agentd/scripts/ipfire_services.pl diff --git a/config/zabbix_agentd/userparameter_ipfire.conf b/config/zabbix_agentd/userparameter_ipfire.conf index d2d0c8307..cc0bd9f8e 100644 --- a/config/zabbix_agentd/userparameter_ipfire.conf +++ b/config/zabbix_agentd/userparameter_ipfire.conf @@ -9,4 +9,6 @@ UserParameter=ipfire.net.fw.hits.raw,sudo /usr/local/bin/getipstat -xf | grep "/ # 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 -UserParameter=ipfire.captive.clients,awk -F ',' 'length($2) == 17 {sum += 1} END {if (length(sum) == 0) print 0; else print sum}' /var/ipfire/captive/clients \ No newline at end of file +UserParameter=ipfire.captive.clients,awk -F ',' 'length($2) == 17 {sum += 1} END {if (length(sum) == 0) print 0; else print sum}' /var/ipfire/captive/clients +# Services list and state +UserParameter=ipfire.services.get,sudo /var/ipfire/zabbix_agentd/scripts/ipfire_services.pl \ No newline at end of file diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index 06956ad41..dd593ecf1 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -26,7 +26,7 @@ include Config
SUMMARY = Zabbix Agent
-VER = 6.0.30 +VER = 6.0.33
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 = 13 +PAK_VER = 14
DEPS = fping
@@ -48,7 +48,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_BLAKE2 = 5446a15c5fa3400d78eef47cced6cbd0bc884b6b1f14e267321f562b5891e21de41179bb615a733b49ee0ae334aadede32d931db400b9148ec9bc6636ac71e5a +$(DL_FILE)_BLAKE2 = 736c5b46193e7e7f93dfa00eb56c65fdf3fa6e36a647d0f910118923950114dbbbe9382563e96db4d8ee6199b4e0342037fb8ec6ec8d349884612f5ef18db966
install : $(TARGET)
@@ -117,6 +117,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) -mkdir -pv /var/ipfire/zabbix_agentd/scripts install -v -m 755 $(DIR_SRC)/config/zabbix_agentd/ipfire_certificate_detail.sh \ /var/ipfire/zabbix_agentd/scripts/ipfire_certificate_detail.sh + install -v -m 755 $(DIR_SRC)/config/zabbix_agentd/ipfire_services.pl \ + /var/ipfire/zabbix_agentd/scripts/ipfire_services.pl
# Create directory for additional agent modules -mkdir -pv /usr/lib/zabbix
hooks/post-receive -- IPFire 2.x development tree