X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=aptcheck%2Faptcheck.pl;h=7801291189a50cf7ec8cbc3113f55fd9229e6e85;hb=d9a352a0da41b7e7e249c315bc60f6e3ffc08cc9;hp=1568872e302b637683c2db539f59186cbd4c744c;hpb=f3c349d5c88413cbf479a82f3beac389b1b58c43;p=git-tools-moved-to-github.git diff --git a/aptcheck/aptcheck.pl b/aptcheck/aptcheck.pl index 1568872..7801291 100755 --- a/aptcheck/aptcheck.pl +++ b/aptcheck/aptcheck.pl @@ -18,10 +18,15 @@ # # 11-Mar-2011 Heikki: Started this # 22-Mar-2011 Heikki: Adding manually maintained packages +# 15-Aug-2011 Heikki: Adding a total in the headline, for nagiosgrapher # # TODO: Assumes that we release our restricted packages for all versions # and architectures at the same time. Gets only the highest version from -# all, and reports anything less than this. +# all, and reports anything less than this. Good enough for now. +# +# TODO: Get the dates from ls --full-time /var/cache/apt/archives/ +# and display next to the packages, so we can see how long they have +# been lingering. Boldface them if older than some limit #### Init use strict; @@ -30,6 +35,16 @@ my $year =`date +%Y`; my $wikilink = 'http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/'; my $restrictedpackages = "ssh -q kebab cat /home/ftp/pub/debian/dists/*/restricted/*/Packages"; +#### Host comments +my %hostcomments = ( + "ariel" => "Niels Erik does the manual upgrades", + "bellone" => "Niels Erik does the manual upgrades", + "cfrepous" => "Wolfram does the manual upgrades", + "leopard" => "Wolfram does the manual upgrades", + "lsd" => "Heikki takes care of all upgrades", + ); + + #### Get list of hosts # I could use a hard-coded list, but I would forget to maintain it. # Nagios knows most of our hosts. It even knows which are worth @@ -145,14 +160,15 @@ for my $hline ( split("\n",$hostlist) ) { $manhosts{$H} = 1; $manpkgs{$restrname} = 1; $det .= ""; - $det .= "  $restrname (M)"; + $det .= "  $restrname (M)"; $det .= "". strdiff($bver,$restrinst).""; $det .= "". strdiff($restrinst,$bver).""; $det .= "\n"; - if ( !$summary{$restrname} ) { - $summary{$restrname} = ""; + my $key = "$restrname"; + if ( !$summary{$key} ) { + $summary{$key} = ""; } - $summary{$restrname} .= "$H "; + $summary{$key} .= "$H "; } } $restrname = ""; # clear for next round @@ -213,9 +229,11 @@ for my $hline ( split("\n",$hostlist) ) { $updlink =~ s/Opencontent-solrUpdates/OpenContentSolrUpdates/; $table .= " Upd"; $table .= "\n"; + $table .= "$hostcomments{$H}\n" + if ( $hostcomments{$H} ); $table .= $det if $pkgs; print "\n$table\n" if $debug>2; - last if $H =~/dart/ && $debug; + last if $H =~/diane/ && $debug; } $table .= "\n"; @@ -227,6 +245,11 @@ print F "\n"; print F "Apt upgrade status\n"; print F "\n"; print F "

Apt package status

\n"; +print F "" . ( $sectot + $owntot + $mantot + $normtot ) . + " packages pending ($sectot critical) \n"; + +print F "

Debug run, many hosts missing!

\n" + if $debug; # Summary table: one row for per host group @@ -304,16 +327,34 @@ if ( %skiphosts ) { } print F "\n"; } -if ( %okhosts ) { +#if ( %okhosts ) { +if ( 1 ) { print F "Ok " . scalar(keys(%okhosts)) . "\n"; print F ""; for my $HH ( sort(keys(%okhosts)) ) { print F "$HH "; } + if ( !%okhosts ) { + print F "None at all!"; + } print F "\n"; } print F "\n"; +# Graph +#my $secs = 60*60*24 * 7 * 2; # 2 weeks in secods +#my $secs = "1m"; # one month, let nagios do the math +my $secs = "45d"; +print F "

" . + "\n". + " ". + "" . + "
\n"; # The host table print F $table; @@ -323,8 +364,9 @@ print F "

Packages\n"; print F "\n"; for my $P ( sort(keys(%summary)) ) { my $PN = $P; - $PN = "$P (s)" if ($secpkgs{$P}); - $PN = "$P (id)" if ($ownpkgs{$P}); + $PN = "$P (s)" if ($secpkgs{$P}); + $PN = "$P (id)" if ($ownpkgs{$P}); + $PN = "$P (M)" if ($manpkgs{$P}); print F "\n"; print F "
$PN"; for my $HH ( split(' ',$summary{$P} )) {