monitors:rpi-apt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
monitors:rpi-apt [2018/01/20 11:40] – created wnelismonitors:rpi-apt [2018/03/11 10:15] – [Description] wnelis
Line 5: Line 5:
 ^ Requirements | Perl | ^ Requirements | Perl |
 ^ Download | None | ^ Download | None |
-^ Last Update | 2018-01-20 |+^ Last Update | 2018-03-11 |
  
 ===== Description ===== ===== Description =====
  
-Script rpi-apt.pl is a client-side script, which determines if there are any packages which can be upgraded at a Raspberry Pi running Raspbian. The upgrades are grouped into two classes, the security upgrades and the rest. An alert is generated if at least one upgrade is found. Moreover, the package list cache is updated periodically.+Script rpi-apt.pl is a client-side script, which determines if there are any packages which can be upgraded at a Raspberry Pi running Raspbian. The upgrades are grouped into three classes, the security related upgrades, the normal upgrades and the upgrades which will not be installed. An alert is generated if at least one upgrade in the first two classes is found. The upgrades which are kept back are only reportedas a reminder. 
 +Script rpi-apt.pl will update the package list cache periodically.
  
  
Line 70: Line 71:
 my $Result= '' ; # Message to sent to Xymon my $Result= '' ; # Message to sent to Xymon
  
-my %Class= ( High => 'red', Normal => 'yellow' ) ;+my %Class= ( High => 'red', Normal => 'yellow', Postponed => 'green' ) ;
 my %UPL  = () ; my %UPL  = () ;
 $UPL{$_} = {} foreach ( keys %Class ) ; $UPL{$_} = {} foreach ( keys %Class ) ;
Line 87: Line 88:
      
   @Lines= `stat $uplcFileName` ; # Cache file statistics   @Lines= `stat $uplcFileName` ; # Cache file statistics
-  next unless @Lines ; # Ignore error condition+  return unless @Lines ; # Ignore error condition
      
   foreach ( @Lines ) {   foreach ( @Lines ) {
Line 108: Line 109:
 # #
 sub GetListOfUpdates() { sub GetListOfUpdates() {
 +  my $InPostponed= 0 ; # Flag: in list of kept back packages
 +
   @Lines= `$upCmd` ; # Current list of updatable packages   @Lines= `$upCmd` ; # Current list of updatable packages
   foreach ( @Lines ) {   foreach ( @Lines ) {
     chomp ;     chomp ;
 +
 + # Handle the list of packages which are not to be upgraded (which are kept
 + # back). The format of such a list is as follows:
 + #  The following packages have been kept back:
 + #    firmware-brcm80211
 + #
 +    if ( $InPostponed ) {
 +      if ( m/^\s\s(\S+)/ ) {
 + $UPL{Postponed}{$1}= [ $1, '?', '?' ] ;
 + next ; # Line is handled
 +      } else {
 + $InPostponed= 0 ; # Enf o section found
 +      }  # of else
 +    } elsif ( m/^The following packages have been kept back/ ) {
 +      $InPostponed= 1 ; # Start of section found
 +      next ; # Line is handled
 +    }  # of elsif
 +
     if ( m/^Inst (.+?) \[(.+?)] \((.+?) / ) {     if ( m/^Inst (.+?) \[(.+?)] \((.+?) / ) {
       if ( m/securi/i ) {       if ( m/securi/i ) {
Line 155: Line 176:
   $Result.= "</table>\n" ;   $Result.= "</table>\n" ;
  
-  return if $upCnt == 0 ;+  return if $upCnt == 0  and  keys(%{$UPL{Postponed}}) == 0 ;
      
-  $Result.= "\nList of upgradable packages\n\n" ;+  $Result.= "\nList of upgradeable packages\n\n" ;
   $Result.= "<table>\n" ;   $Result.= "<table>\n" ;
   $Result.= " <tr><th>Package</th><th>Priority</th>" .   $Result.= " <tr><th>Package</th><th>Priority</th>" .
Line 215: Line 236:
 === Server side === === Server side ===
  
-There is nothing to install or to configure at the server-size, except possibly for the alerting.+There is nothing to install or to configure at the server-side, except possibly for the alerting.
  
  
Line 227: Line 248:
   * **2018-01-20**   * **2018-01-20**
     * Initial release     * Initial release
 +  * **2018-03-11**
 +    * Report the packages which are kept back too 
  
  • monitors/rpi-apt.txt
  • Last modified: 2020/01/28 09:50
  • by wnelis