monitors:rpi-apt

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
monitors:rpi-apt [2018/03/11 10:04] – [Installation] wnelismonitors:rpi-apt [2018/03/11 10:10] – [rpi-apt] 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 =====
Line 70: Line 70:
 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 87:
      
   @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 108:
 # #
 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 175:
   $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 227: Line 247:
   * **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