Release notes: https://www.zabbix.com/rn/rn4.2.1
Signed-off-by: Alexander Koch ipfire@starkstromkonsument.de --- lfs/zabbix_agentd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index 23b77b9..1dcf28c 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -24,7 +24,7 @@
include Config
-VER = 4.2.0 +VER = 4.2.1
THISAPP = zabbix-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) PROG = zabbix_agentd -PAK_VER = 2 +PAK_VER = 3 DEPS = ""
############################################################################### @@ -43,7 +43,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 20f261708f95787f3dbea3eab89f804d +$(DL_FILE)_MD5 = e55ba94060ba2548ae8a1c29fd7cb7dd
install : $(TARGET)
This enables Pakfire to return a Status-Summary for the Current Core-Update-Level, time since last updates, the availability of a core-/packet-update and if a reboot is required to complete an update. This can be used by monitoring agents (e.g. zabbix_agentd) to monitor the update status of the IPFire device.
Signed-off-by: Alexander Koch ipfire@starkstromkonsument.de --- src/pakfire/lib/functions.pl | 52 ++++++++++++++++++++++++++++++++++++++++++++ src/pakfire/pakfire | 2 ++ 2 files changed, 54 insertions(+)
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 12a405b..9ed911d 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -108,6 +108,7 @@ sub usage { &Pakfire::message(" <update> - Contacts the servers for new lists of paks."); &Pakfire::message(" <upgrade> - Installs the latest version of all paks."); &Pakfire::message(" <list> - Outputs a short list with all available paks."); + &Pakfire::message(" <status> - Outputs a summary about available core upgrades, updates and a required reboot"); &Pakfire::message(""); &Pakfire::message(" Global options:"); &Pakfire::message(" --non-interactive --> Enables the non-interactive mode."); @@ -893,4 +894,55 @@ sub progress_bar { sprintf "$color{'lightgreen'}%-20s %7s |%-${width}s| %10s$color{'normal'}\r",$show_bfile, $progress, $char x (($width-1)*$got/$total). '>', beautifysize($got); }
+sub updates_available { + # Get packets with updates available + my @upgradepaks = &Pakfire::dblist("upgrade", "noweb"); + + # Get the length of the returned array + my $updatecount = scalar @upgradepaks; + + return "$updatecount"; +} + +sub coreupdate_available { + eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); + if ("$core_release" > "$Conf::core_mine") { + return "yes ($core_release)"; + } + else { + return "no"; + } +} + +sub reboot_required { + if ( -e "/var/run/need_reboot" ) { + return "yes"; + } + else { + return "no"; + } +} + +sub status { + # General info + my $return = "Core-Update-Level: $Conf::core_mine\n"; + $return .= "Last update: " . &General::age("/opt/pakfire/db/core/mine") . " ago\n"; + $return .= "Last core-list update: " . &General::age("/opt/pakfire/db/lists/core-list.db") . " ago\n"; + $return .= "Last server-list update: " . &General::age("/opt/pakfire/db/lists/server-list.db") . " ago\n"; + $return .= "Last packages-list update: " . &General::age("/opt/pakfire/db/lists/packages_list.db") . " ago\n"; + + # Get availability of core updates + $return .= "Core-Update available: " . &Pakfire::coreupdate_available() . "\n"; + + # Get availability of package updates + $return .= "Package-Updates available: " . &Pakfire::updates_available() . "\n"; + + # Test if reboot is required + $return .= "Reboot required: " . &Pakfire::reboot_required() . "\n"; + + # Return status text + print "$return"; + exit 1; +} + 1; diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index 041ba66..c69a8d3 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -322,6 +322,8 @@ } elsif ("$ARGV[1]" eq "upgrades") { system("rm -f /etc/fcron.daily/pakfire-upgrade"); } + } elsif ("$ARGV[0]" eq "status") { + &Pakfire::status; } else { &Pakfire::usage; }
Add the IPFire-Core-Version to the status message.
Signed-off-by: Alexander Koch ipfire@starkstromkonsument.de --- src/pakfire/lib/functions.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 9ed911d..460eaf3 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -925,7 +925,8 @@ sub reboot_required {
sub status { # General info - my $return = "Core-Update-Level: $Conf::core_mine\n"; + my $return = "Core-Version: $Conf::version\n"; + $return .= "Core-Update-Level: $Conf::core_mine\n"; $return .= "Last update: " . &General::age("/opt/pakfire/db/core/mine") . " ago\n"; $return .= "Last core-list update: " . &General::age("/opt/pakfire/db/lists/core-list.db") . " ago\n"; $return .= "Last server-list update: " . &General::age("/opt/pakfire/db/lists/server-list.db") . " ago\n";
Ship the UserParameter for monitoring the status of pakfire for keeping track of available updates etc.
Signed-off-by: Alexander Koch ipfire@starkstromkonsument.de --- config/rootfiles/packages/zabbix_agentd | 1 + config/zabbix_agentd/sudoers | 8 ++++---- config/zabbix_agentd/userparameter_pakfire.conf | 2 ++ lfs/zabbix_agentd | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 config/zabbix_agentd/userparameter_pakfire.conf
diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd index eaecf26..4420bda 100644 --- a/config/rootfiles/packages/zabbix_agentd +++ b/config/rootfiles/packages/zabbix_agentd @@ -5,6 +5,7 @@ etc/zabbix_agentd etc/zabbix_agentd/scripts etc/zabbix_agentd/zabbix_agentd.conf etc/zabbix_agentd/zabbix_agentd.d +etc/zabbix_agentd/zabbix_agentd.d/userparameter_pakfire.conf usr/bin/zabbix_get usr/bin/zabbix_sender usr/lib/modules diff --git a/config/zabbix_agentd/sudoers b/config/zabbix_agentd/sudoers index f4e4321..1b362a4 100644 --- a/config/zabbix_agentd/sudoers +++ b/config/zabbix_agentd/sudoers @@ -8,10 +8,10 @@ # Some hints: # - It is strongly recommended to edit this file only using the visudo -f <filename> command. If you mess up this file, # you might end up locking yourself out of your system! -# - Append the full path to each command, using "," as separator. +# - Append the full path incl. parameters to each command, using "," as separator. # - Only add commands you really need. Zabbix should not have more rights than it has to. # -# Uncomment the following two lines and edit the example of commands to fit your needs: +# Append / edit the following list of commands to fit your needs: # -#Defaults:zabbix !requiretty -#zabbix ALL=(ALL) NOPASSWD: <path to command1>, <path to command2> +Defaults:zabbix !requiretty +zabbix ALL=(ALL) NOPASSWD: /opt/pakfire/pakfire status diff --git a/config/zabbix_agentd/userparameter_pakfire.conf b/config/zabbix_agentd/userparameter_pakfire.conf new file mode 100644 index 0000000..aa2e80f --- /dev/null +++ b/config/zabbix_agentd/userparameter_pakfire.conf @@ -0,0 +1,2 @@ +### Parameter for monitoring pakfire status +UserParameter=pakfire.status,sudo /opt/pakfire/pakfire status diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index 1dcf28c..d4d5a22 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -91,6 +91,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) -mkdir -pv /etc/zabbix_agentd/scripts install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/zabbix_agentd.conf \ /etc/zabbix_agentd/zabbix_agentd.conf + install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/userparameter_pakfire.conf \ + /etc/zabbix_agentd/zabbix_agentd.d/userparameter_pakfire.conf
# Create directory for additional agent modules -mkdir -pv /usr/lib/zabbix