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
Last revisionBoth sides next revision
monitors:rpi-apt [2018/03/11 10:15] – [Description] wnelismonitors:rpi-apt [2020/01/28 09:48] wnelis
Line 23: 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 40: 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 86: 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 95: 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 121: 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 139: 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 177: 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 212: 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 249: 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.txt
  • Last modified: 2020/01/28 09:50
  • by wnelis