Pakiti
From ScotGrid
pakiti (formerly yumit) is a piece of software used to check if hosts are up to date with respect to yum packages see http://pakiti.sourceforge.net/ for details
at Glasgow we have patched it slightly so that it displays the the default (grub) kernel as well as the current running kernel so we can identify nodes which have been updated but are awaiting a reboot
Oh, and you need to update the database as well as the files below, but thats just a simple case of
mysql> use pakiti; mysql> alter table host add defaultkernel varchar(20) after kernel ;
[edit]
/var/lib/pakiti/www/index.php
--- index.php.orig 2008-03-27 14:08:15.000000000 +0000
+++ index.php 2008-03-27 15:39:24.000000000 +0000
@@ -52,7 +52,7 @@
# Displays headers
function header_dad($dad,$currentadmin ) {
if ($dad == 1) {
- print "<tr><td colspan=\"6\">";
+ print "<tr><td colspan=\"7\">";
print "<h2><b><i><font color=\"#990000\">Section: ";
print $currentadmin;
print "</font></i></b></h2>\n" ;
@@ -63,7 +63,7 @@
function header_dos($dos,$currentos, $mytable ) {
if ($dos == 1) {
- print "<tr><td colspan=\"6\"><h3>$currentos";
+ print "<tr><td colspan=\"7\"><h3>$currentos";
print"</h3></td></tr>\n" ;
print $mytable;
}
@@ -190,13 +190,14 @@
$mytable='<tr>'.$s.'
<td width="28%"><h5>hostname</h5></td>
-<td width="29%"><h5>current kernel</h5></td>
+<td width="15%"><h5>current kernel</h5></td>
+<td width="14%"><h5>default kernel</h5></td>
<td width="28%"><h5>last report</h5></td>
<td width="5%"><h5>Connection</h5></td>
</tr>';
$sql = "select os,host,kernel, UNIX_TIMESTAMP(time),
- TO_DAYS(NOW())-TO_DAYS(host.time),admin,connection from host ";
+ TO_DAYS(NOW())-TO_DAYS(host.time),admin,connection,defaultkernel from host ";
if ($o=='admin') $sql .= " order by $o, os, host"; else $sql .= " order by os, $o, host" ;
$hosts = mysql_query($sql) ;
$currentos = "" ;
@@ -410,7 +411,17 @@
if ( ! array_key_exists($unikernel,$version)) {
$version[$unikernel] = array_pop($color) ;
}
- print "<td><font color=\"$version[$unikernel]\">$kernel</font></td><td>";
+ print "<td><font color=\"$version[$unikernel]\">$kernel</font></td>";
+
+# Hopefully the running kernel matches the default grub one
+$defaultkernel = $row[7] ;
+if ( $defaultkernel == $kernel ) {
+ $dkcolour = "#33cc00" ;
+} else {
+ $dkcolour = "#ff0033" ;
+}
+ print "<td><font color=\"$dkcolour\">$defaultkernel</font></td><td>";
+
if ( $row[4] >= 3 ) {
#$stats_nb_dead[$row[5]]++;
[edit]
/usr/sbin/pakiti
--- /usr/sbin/pakiti 2006-04-26 10:07:48.000000000 +0100 +++ /root/pakiti.ae 2008-03-27 13:43:05.000000000 +0000 @@ -16,7 +16,7 @@ # Default Config file. my $config = '/etc/pakiti/pakiti-client.conf' ; -my $version = "5"; +my $version = "6"; my $curl; my $pause=''; my $certificate; @@ -191,11 +191,21 @@ chomp($kernel) ; print "KERNEL: $kernel\n" if ($opt_v) ; + +############################################################### +# Determine grub default. +my $grubkern = `/sbin/grubby --default-kernel`; +chomp($grubkern) ; +$grubkern =~ s#/boot/vmlinuz-## ; +print "GRUB: $grubkern\n" if ($opt_v) ; + + ############################################################## # Generating message $curl .= " -F host=\"".$hostname."\""; $curl .= " -F kernel=\"".$kernel."\""; +$curl .= " -F defaultkernel=\"".$grubkern."\""; $curl .= " -F admin=\"".$admin."\""; $curl .= " -F os=\"".$os."\""; $curl .= " -F version=\"".$version."\"";
[edit]
/var/lib/pakiti/feed/index.php
--- /var/lib/pakiti/feed/index.php.orig 2008-03-27 13:53:54.000000000 +0000
+++ /var/lib/pakiti/feed/index.php 2008-03-27 16:13:45.000000000 +0000
@@ -8,6 +8,7 @@
$host = (isset($HTTP_POST_VARS["host"])) ? $HTTP_POST_VARS["host"] : "unknown";
$admin = (isset($HTTP_POST_VARS["admin"])) ? $HTTP_POST_VARS["admin"] : "unknown";
$kernel = (isset($HTTP_POST_VARS["kernel"])) ? $HTTP_POST_VARS["kernel"] : "unknown";
+$defaultkernel = (isset($HTTP_POST_VARS["defaultkernel"])) ? $HTTP_POST_VARS["defaultkernel"] : "unknown";
$os = (isset($HTTP_POST_VARS["os"])) ? $HTTP_POST_VARS["os"] : "unknown";
$updates = (isset($HTTP_POST_VARS["updates"])) ? $HTTP_POST_VARS["updates"] : "unknown";
$version = (isset($HTTP_POST_VARS["version"])) ? $HTTP_POST_VARS["version"] : "0";
@@ -116,7 +117,7 @@
if ($version == "external_report") $admin = "External report from ".$_SERVER['REMOTE_HOST'];
$sql = "insert into host set host='".$host.
- "',os='".$os."',kernel='".$kernel.
+ "',os='".$os."',kernel='".$kernel."',defaultkernel='".$defaultkernel.
"',admin='".$admin."',connection='".$_SERVER['SERVER_PORT'].
"',version='".$version."'";
if (!mysql_query($sql)) {
