• Info
  • appliance package update notification

Hello,

a little question : Is it possible to be notified of updates?

  • WalterH and Tobias replied to this.
    • Best Answerset by crpb

    Nou

    zypper in -y monitoring-plugins-zypper

    https://github.com/lrupp/monitoring-plugins-zypper

    grom-test-1:~ # /usr/lib/nagios/plugins/check_zypper -r
    Updates CRITICAL : 2 security update(s); 3 recommended update(s);  8 package update(s); | security=2;;;; recommended=3;;;; optional=0;;;; packages=8;;;;
    grom-test-1:~ # 
    
    
    
    ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    grom-test-2:~ # /usr/lib/nagios/plugins/check_zypper -r
    Updates CRITICAL : discontinued OS Release  2023.11; 1 security update(s); 3 recommended update(s);  7 package update(s); | security=1;;;; recommended=3;;;; optional=0;;;; packages=7;;;;
    grom-test-2:~ # 
    
    
    ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    grom-test-3:~ # /usr/lib/nagios/plugins/check_zypper -r
    Updates CRITICAL : discontinued OS Release  2023.11; 1 security update(s); 3 recommended update(s);  11 package update(s); | security=1;;;; recommended=3;;;; optional=0;;;; packages=11;;;;
    grom-test-3:~ # 
    
    
    ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    grom-test-4:~ # /usr/lib/nagios/plugins/check_zypper -r
    Updates CRITICAL : discontinued OS Release  2023.11; 1 security update(s); 3 recommended update(s);  13 package update(s); | security=1;;;; recommended=3;;;; optional=0;;;; packages=13;;;;
    grom-test-4:~ # 

    A problem is the grommunio-release and the overriden/totaly changed /etc/os-release (i have a open ticket because of other problems but it hunts me 😛)

    Either do this

    grom-test-3:~ # cat << EOF > /etc/leap-release
    > NAME="openSUSE Leap"
    > VERSION="15.5"
    > ID="opensuse-leap"
    > ID_LIKE="suse opensuse"
    > VERSION_ID="15.5"
    > PRETTY_NAME="openSUSE Leap 15.5"
    > ANSI_COLOR="0;32"
    > CPE_NAME="cpe:/o:opensuse:leap:15.5"
    > BUG_REPORT_URL="https://bugs.opensuse.org"
    > HOME_URL="https://www.opensuse.org/"
    > DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
    > LOGO="distributor-logo-Leap"
    > EOF
    grom-test-3:~ # /usr/lib/nagios/plugins/check_zypper --releasefile /etc/leap-release --refresh --verbose
    Updates CRITICAL : 1 security update(s); 3 recommended update(s);  11 package update(s);
    security patch: openSUSE-SLE-15.5-2024-3075
    recommended patch: openSUSE-SLE-15.5-2024-3129
    recommended patch: openSUSE-SLE-15.5-2024-3130
    recommended patch: openSUSE-SLE-15.5-2024-3131
    Packages: grommunio-archive gromox gromox-debuginfo gromox-debugsource libfreebl3 libsoftokn3 libwebp7 mozilla-nss mozilla-nss-certs unzip xen-libs| security=1;;;; recommended=3;;;; optional=0;;;; packages=11;;;;

    Or install the suse-release instead

    grom-test-1:~ # zypper in --force -y openSUSE-release
    Loading repository data...
    Reading installed packages...
    Forcing installation of 'openSUSE-release-15.5-lp155.286.1.x86_64' from repository 'base'.
    Resolving package dependencies...
    
    The following package is going to be reinstalled:
      openSUSE-release
    
    The following product is going to be reinstalled:
      "openSUSE Leap 15.5"
    
    1 package to reinstall.
    Overall download size: 704.1 KiB. Already cached: 0 B. No additional space will be used or freed after the operation.
    
    Backend:  classic_rpmtrans
    Continue? [y/n/v/...? shows all options] (y): y
    Retrieving: openSUSE-release-15.5-lp155.286.1.x86_64 (base)                                                                                (1/1), 704.1 KiB
    Retrieving: openSUSE-release-15.5-lp155.286.1.x86_64.rpm ....................................................................................[done (5.2 MiB/s)]
    
    Checking for file conflicts: ............................................................................................................................[done]
    (1/1) Installing: openSUSE-release-15.5-lp155.286.1.x86_64 ..............................................................................................[done]
    Running post-transaction scripts ........................................................................................................................[done]
    grom-test-1:~ # /usr/lib/nagios/plugins/check_zypper --refresh --verbose
    Updates CRITICAL : 2 security update(s); 3 recommended update(s);  8 package update(s);
    security patch: openSUSE-SLE-15.5-2024-3075
    security patch: openSUSE-SLE-15.5-2024-3115
    recommended patch: openSUSE-SLE-15.5-2024-3129
    recommended patch: openSUSE-SLE-15.5-2024-3130
    recommended patch: openSUSE-SLE-15.5-2024-3131
    Packages: libfreebl3 libsoftokn3 libtiff5 libwebp7 mozilla-nss mozilla-nss-certs unzip xen-libs| security=2;;;; recommended=3;;;; optional=0;;;; packages=8;;;;

    ok, thank's.

    ok, but any idea with a script?

    Which updates are you talking about exactly?

    • Nou replied to this.

      Nou btw. Community updates released typically every day. Supported updates released between 2 and 4 weeks on weekend.

      crpb
      all updates avaible
      system or grommunio/gromox

      Hello,

      ok, tks
      il will see if i can make a script processing information from zypper up

      • crpb replied to this.

        Nou il will see if i can make a script processing information from zypper up

        I haven't looked myself but i imagine their is some kind of script for that already in the official repos. I only use "yast2-online-update-configuration" for automatic security updates myself.

        Either way, if you put something together or find a reasonable application to get those notifications please share it 😛.

        • Nou likes this.
        • Edited
        • Best Answerset by crpb

        Nou

        zypper in -y monitoring-plugins-zypper

        https://github.com/lrupp/monitoring-plugins-zypper

        grom-test-1:~ # /usr/lib/nagios/plugins/check_zypper -r
        Updates CRITICAL : 2 security update(s); 3 recommended update(s);  8 package update(s); | security=2;;;; recommended=3;;;; optional=0;;;; packages=8;;;;
        grom-test-1:~ # 
        
        
        
        ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        grom-test-2:~ # /usr/lib/nagios/plugins/check_zypper -r
        Updates CRITICAL : discontinued OS Release  2023.11; 1 security update(s); 3 recommended update(s);  7 package update(s); | security=1;;;; recommended=3;;;; optional=0;;;; packages=7;;;;
        grom-test-2:~ # 
        
        
        ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        grom-test-3:~ # /usr/lib/nagios/plugins/check_zypper -r
        Updates CRITICAL : discontinued OS Release  2023.11; 1 security update(s); 3 recommended update(s);  11 package update(s); | security=1;;;; recommended=3;;;; optional=0;;;; packages=11;;;;
        grom-test-3:~ # 
        
        
        ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        grom-test-4:~ # /usr/lib/nagios/plugins/check_zypper -r
        Updates CRITICAL : discontinued OS Release  2023.11; 1 security update(s); 3 recommended update(s);  13 package update(s); | security=1;;;; recommended=3;;;; optional=0;;;; packages=13;;;;
        grom-test-4:~ # 

        A problem is the grommunio-release and the overriden/totaly changed /etc/os-release (i have a open ticket because of other problems but it hunts me 😛)

        Either do this

        grom-test-3:~ # cat << EOF > /etc/leap-release
        > NAME="openSUSE Leap"
        > VERSION="15.5"
        > ID="opensuse-leap"
        > ID_LIKE="suse opensuse"
        > VERSION_ID="15.5"
        > PRETTY_NAME="openSUSE Leap 15.5"
        > ANSI_COLOR="0;32"
        > CPE_NAME="cpe:/o:opensuse:leap:15.5"
        > BUG_REPORT_URL="https://bugs.opensuse.org"
        > HOME_URL="https://www.opensuse.org/"
        > DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
        > LOGO="distributor-logo-Leap"
        > EOF
        grom-test-3:~ # /usr/lib/nagios/plugins/check_zypper --releasefile /etc/leap-release --refresh --verbose
        Updates CRITICAL : 1 security update(s); 3 recommended update(s);  11 package update(s);
        security patch: openSUSE-SLE-15.5-2024-3075
        recommended patch: openSUSE-SLE-15.5-2024-3129
        recommended patch: openSUSE-SLE-15.5-2024-3130
        recommended patch: openSUSE-SLE-15.5-2024-3131
        Packages: grommunio-archive gromox gromox-debuginfo gromox-debugsource libfreebl3 libsoftokn3 libwebp7 mozilla-nss mozilla-nss-certs unzip xen-libs| security=1;;;; recommended=3;;;; optional=0;;;; packages=11;;;;

        Or install the suse-release instead

        grom-test-1:~ # zypper in --force -y openSUSE-release
        Loading repository data...
        Reading installed packages...
        Forcing installation of 'openSUSE-release-15.5-lp155.286.1.x86_64' from repository 'base'.
        Resolving package dependencies...
        
        The following package is going to be reinstalled:
          openSUSE-release
        
        The following product is going to be reinstalled:
          "openSUSE Leap 15.5"
        
        1 package to reinstall.
        Overall download size: 704.1 KiB. Already cached: 0 B. No additional space will be used or freed after the operation.
        
        Backend:  classic_rpmtrans
        Continue? [y/n/v/...? shows all options] (y): y
        Retrieving: openSUSE-release-15.5-lp155.286.1.x86_64 (base)                                                                                (1/1), 704.1 KiB
        Retrieving: openSUSE-release-15.5-lp155.286.1.x86_64.rpm ....................................................................................[done (5.2 MiB/s)]
        
        Checking for file conflicts: ............................................................................................................................[done]
        (1/1) Installing: openSUSE-release-15.5-lp155.286.1.x86_64 ..............................................................................................[done]
        Running post-transaction scripts ........................................................................................................................[done]
        grom-test-1:~ # /usr/lib/nagios/plugins/check_zypper --refresh --verbose
        Updates CRITICAL : 2 security update(s); 3 recommended update(s);  8 package update(s);
        security patch: openSUSE-SLE-15.5-2024-3075
        security patch: openSUSE-SLE-15.5-2024-3115
        recommended patch: openSUSE-SLE-15.5-2024-3129
        recommended patch: openSUSE-SLE-15.5-2024-3130
        recommended patch: openSUSE-SLE-15.5-2024-3131
        Packages: libfreebl3 libsoftokn3 libtiff5 libwebp7 mozilla-nss mozilla-nss-certs unzip xen-libs| security=2;;;; recommended=3;;;; optional=0;;;; packages=8;;;;
        crpb changed the title to appliance package update notification .

        Try this script:

        #!/bin/bash
        #
        # A Bash script to check for updates - grommunio and SLES, send mail if updates available
        # Please note, this script ignores patches.
        #
        # Use: zypepr ref && zypper patch-check
        # No patches if you get: 0 patches needed (0 security patches)
        #
        # Copyright (c) 2024 by Walter@Hofstaedtler.com
        #
        # Stored in WHIE GIT:
        #   git@icc-file:/whie/grommunio/update_check.git
        #
        ############################################################
        ############################################################
        # Variables to be set by the user of this script           #
        ############################################################
        ############################################################
        #
        # Recipients for result mail, a comma separated list of mail addresses
        NOTIFY_EMAIL="user@domain.com,user2@domain.com"
        #
        # Subject of result mail
        NOTIFY_SUBJECT="Grommunio and SLES update check for $(hostname)"
        #
        #
        # Internal variables
        # 0 = no debug output, 1 = debug output
        DEBUG=0
        #DEBUG=1
        #
        # Shell debug
        #set -x
        #
        ############################################################
        ############################################################
        # Main program                                             #
        ############################################################
        ############################################################
        #
        # Store date in yyyy-mm-dd format
        CURRENT_DATE="$(date +"%Y%m%d")"
        #
        #
        TMP_MAIL_FILE=$(mktemp)
        echo "Update list:" > "$TMP_MAIL_FILE"
        echo "" >> "$TMP_MAIL_FILE"
        #
        [[ $DEBUG -eq 1  ]] && echo "Refresh repositories ..."
        zypper ref -f > "$TMP_MAIL_FILE" 2>&1 
        echo " " >> "$TMP_MAIL_FILE"
        #
        [[ $DEBUG -eq 1  ]] && echo "Detect pending updates .."
        RESULT=$(zypper list-updates | grep "No updates found.")
        #
        [[ $DEBUG -eq 1  ]] && echo "Read update list ..."
        zypper list-updates >> "$TMP_MAIL_FILE" 2>&1 
        [[ $DEBUG -eq 1  ]] && echo "Pending Update: $RESULT"
        [[ $DEBUG -eq 1  ]] && echo ""
        #
        if [[ -n $RESULT ]]; then
          # nothing to do
          [[ $DEBUG -eq 1  ]] && echo "$CURRENT_DATE, nothing to do."
          [[ $DEBUG -eq 1  ]] && cat "$TMP_MAIL_FILE"
         else
          # send the status mail
          OUT=$(mail -s "$NOTIFY_SUBJECT" "$NOTIFY_EMAIL" < "$TMP_MAIL_FILE" 2>&1 )
          [[ $DEBUG -eq 1  ]] && echo "$CURRENT_DATE, update mail sent:"
          [[ $DEBUG -eq 1  ]] && cat "$TMP_MAIL_FILE"
        fi
        # clean up
        rm -f "$TMP_MAIL_FILE"
        #

        I replaced the code, old code contains an error!

        Run it with cron every night.

        Please report any errors or other issues with this script.

        © 2020-2024 grommunio GmbH. All rights reserved. | https://grommunio.com | Data Protection | Legal notice