monitors:rpi-apt

Error loading plugin struct
ParseError: syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM)
More info is available in the error log.

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
monitors:rpi-apt [2018/03/11 10:10] – [Changelog] wnelismonitors:rpi-apt [2020/01/28 09:50] (current) – [Table] wnelis
Line 1: Line 1:
 ====== rpi-apt ====== ====== rpi-apt ======
  
-^ Author | [[ wim.nelis@nlr.nl | Wim Nelis ]] | +^ Author         | [[wim.nelis@nlr.nl| Wim Nelis ]]  
-^ Compatibility | Xymon 4.2 | +^ Compatibility  | Xymon 4.2                         
-^ Requirements | Perl | +^ Requirements   | Perl                              
-^ Download | None | +^ Download       | None                              
-^ Last Update | 2018-01-20 |+^ Last Update    2020-01-28                        |
  
 ===== 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 22: Line 23:
 #!/usr/bin/perl -w #!/usr/bin/perl -w
 # #
-# Script apt.pl is a xymon client-side script. It retrieves the list of+# Script rpi-apt.pl is a xymon client-side script. It retrieves the list of
 # outstanding patches for raspbian. These are divided into two groups, # outstanding patches for raspbian. These are divided into two groups,
 # security-related and the rest. At the same time, this script will reguarly # security-related and the rest. At the same time, this script will reguarly
Line 39: Line 40:
 my $XyDisp  = $ENV{XYMSRV} ; # Name of monitor server my $XyDisp  = $ENV{XYMSRV} ; # Name of monitor server
 my $XySend  = $ENV{XYMON} ; # Monitor interface program my $XySend  = $ENV{XYMON} ; # Monitor interface program
-my $XyLife  = '+13h' ; # Status lifetime, default 30m+my $XyLife  = '+19h' ; # Status lifetime, default 30m
 my $FmtDate = "%Y.%m.%d %H:%M:%S" ; # Default date format my $FmtDate = "%Y.%m.%d %H:%M:%S" ; # Default date format
    $FmtDate = $ENV{XYMONDATEFORMAT} if exists $ENV{XYMONDATEFORMAT} ;    $FmtDate = $ENV{XYMONDATEFORMAT} if exists $ENV{XYMONDATEFORMAT} ;
Line 85: Line 86:
 sub UpdatePackageListCache() { sub UpdatePackageListCache() {
   my (@Time,$Time) ; # Time of last change of cache   my (@Time,$Time) ; # Time of last change of cache
-  +
   @Lines= `stat $uplcFileName` ; # Cache file statistics   @Lines= `stat $uplcFileName` ; # Cache file statistics
-  return unless @Lines ; # Ignore error condition +  return unless @Lines ; # Ignore error condition 
-  +
   foreach ( @Lines ) {   foreach ( @Lines ) {
     next unless @Time= m/^Modify: (\d{4})-(\d+)-(\d+) (\d+):(\d+):(\d+)\./ ;     next unless @Time= m/^Modify: (\d{4})-(\d+)-(\d+) (\d+):(\d+):(\d+)\./ ;
Line 94: Line 95:
     $Time= timelocal( reverse @Time ) ; # Compute time stamp     $Time= timelocal( reverse @Time ) ; # Compute time stamp
     return if time - $Time < $uplcRefreshAge ;     return if time - $Time < $uplcRefreshAge ;
-    +
     `$uplcRefreshCmd` ; # Update package list cache     `$uplcRefreshCmd` ; # Update package list cache
     last ; # Skip rest of lines     last ; # Skip rest of lines
Line 120: Line 121:
  #  #
     if ( $InPostponed ) {     if ( $InPostponed ) {
-      if ( m/^\s\s(\S+)/ ) { +      if ( m/^\s\s\S/ ) { 
- $UPL{Postponed}{$1}= [ $1, '?', '?' ] ;+ foreach my $pn ( split ) { 
 +   next unless defined $pn; 
 +   $UPL{Postponed}{$pn}= [ $pn, '?', '?' ] ; 
 +   $upCnt++ ; 
 + }  # of foreach 
  next ; # Line is handled  next ; # Line is handled
       } else {       } else {
- $InPostponed= 0 ; # Enf o section found+ $InPostponed= 0 ; # End of section found
       }  # of else       }  # of else
     } elsif ( m/^The following packages have been kept back/ ) {     } elsif ( m/^The following packages have been kept back/ ) {
Line 138: Line 144:
       }  # of else       }  # of else
       $upCnt++ ;       $upCnt++ ;
-       +    }  # of if
-    } elsif ( m/^Conf / ) { +
-    next ; # Do nothing +
- +
-    } else { +
-      next unless $upCnt ; +
-      print "$Now : $_\n" ; +
-    }  # of else+
   }  # of foreach   }  # of foreach
 }  # of GetListOfUpdates }  # of GetListOfUpdates
Line 176: Line 175:
  
   return if $upCnt == 0  and  keys(%{$UPL{Postponed}}) == 0 ;   return if $upCnt == 0  and  keys(%{$UPL{Postponed}}) == 0 ;
-  +
   $Result.= "\nList of upgradeable packages\n\n" ;   $Result.= "\nList of upgradeable packages\n\n" ;
   $Result.= "<table>\n" ;   $Result.= "<table>\n" ;
Line 211: Line 210:
 GetListOfUpdates ; # Retrieve list of outstanding updates GetListOfUpdates ; # Retrieve list of outstanding updates
 BuildMessage ; # Build message for xymon BuildMessage ; # Build message for xymon
-InformXymon( 'Package updates' ) ; # Send message to xymon server+InformXymon( 'Package upgrades' ) ; # Send message to xymon server
 </code> </code>
 </hidden> </hidden>
Line 248: Line 247:
     * Initial release     * Initial release
   * **2018-03-11**   * **2018-03-11**
-    * Report the packages which are kept back too +    * Report the packages which are kept back too 
 +  * **2020-01-28** 
 +    * Improve detection of kept-back-upgrades
  
  • monitors/rpi-apt.1520763004.txt.gz
  • Last modified: 2018/03/11 10:10
  • by wnelis