[1734] in Moira

home help back first fref pref prev next nref lref last post

reformat spwatch dcm file

daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Thu Jan 18 06:10:09 2001

Date: Thu, 18 Jan 2001 06:10:01 -0500 (EST)
Message-Id: <200101181110.GAA12191@Bearing-An-Hourglass.mit.edu>
To: moiradev@mit.edu
From: Jonathon Weiss <jweiss@MIT.EDU>


The spwatch DCM is used to maintain a list of SAP printers on urania
so it can periodically poll them for problems.  Ac it turns out the
code that was doing the polling was a copy of a csh script that was
used to do similar polling of cluster printers.  Moreover, the script
was then edited to use a different column, since for some reason the
list of SAP printer and of cluster printers were in different formats.
I'm in the process of upgrading urania, and in the process am trying
to do some code cleanup (and in this case promote code sharing and
kill the csh script entirely).  Since teh script only needs the
printer's hostname, I'd like to reformat the spwatch DCM to only
provide that.  Assuming this is accepted, I'll check it in and deploy
it when I'm ready to upgrade urania.

	Jonathon

Index: spwatch.gen
===================================================================
RCS file: /mit/moiradev/repository/moira/gen/spwatch.gen,v
retrieving revision 1.1
diff -c -r1.1 spwatch.gen
*** spwatch.gen	2000/03/29 19:59:20	1.1
--- spwatch.gen	2001/01/18 11:01:19
***************
*** 13,19 ****
  $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
      || exit $MR_DBMS_ERR;
  
! $sth = $dbh->prepare("SELECT p.name, m.name, p.location FROM printers p, ".
  		     "machine m WHERE p.type = 'SAP' AND p.mach_id = ".
  		     "m.mach_id ORDER BY p.name") || exit $MR_DBMS_ERR;
  
--- 13,19 ----
  $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
      || exit $MR_DBMS_ERR;
  
! $sth = $dbh->prepare("SELECT m.name FROM printers p, ".
  		     "machine m WHERE p.type = 'SAP' AND p.mach_id = ".
  		     "m.mach_id ORDER BY p.name") || exit $MR_DBMS_ERR;
  
***************
*** 21,30 ****
  
  umask 022;
  open(OUT, ">$outfile") || exit $MR_OCONFIG;
  
! while (($name, $hostname, $location) = $sth->fetchrow_array) {
      next if $hostname eq "[NONE]";
!     $row = "$name\t$hostname\t$location\n";
      $row =~ s/\0//g;
      print OUT $row;
  }
--- 21,31 ----
  
  umask 022;
  open(OUT, ">$outfile") || exit $MR_OCONFIG;
+ print OUT "# This File is automatically generated by Moira.  Do not edit.\n";
  
! while (($hostname) = $sth->fetchrow_array) {
      next if $hostname eq "[NONE]";
!     $row = "$hostname\n";
      $row =~ s/\0//g;
      print OUT $row;
  }

home help back first fref pref prev next nref lref last post