You can subscribe to this list here.
| 2002 |
Jan
|
Feb
(2) |
Mar
(29) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(3) |
Aug
(9) |
Sep
(3) |
Oct
|
Nov
|
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
|
| 2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
(10) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
(8) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Mitchell G. <mrg...@us...> - 2006-04-12 13:24:30
|
Update of /cvsroot/acd/acd-2/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29879/acd-2/bin Modified Files: convert.py Log Message: The new convert.py that actually checks the XML to the database contents. Still need to implement the correct date and -d option for the script Index: convert.py =================================================================== RCS file: /cvsroot/acd/acd-2/bin/convert.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** convert.py 13 Feb 2006 16:21:00 -0000 1.1 --- convert.py 12 Apr 2006 13:24:06 -0000 1.2 *************** *** 1,58 **** #!/usr/bin/python ! ! import sys, string from xml.sax import saxutils, make_parser, handler ! SQL = []; ! NotValid = [ "system", "required", "optional", "custom" ]; ! class FancyCounter(handler.ContentHandler): ! def __init__(self): ! self._SQLStr = ""; ! self._values = ""; ! self._current_head = ""; ! self._current_column = ""; ! def startElement(self, name, attrs): ! if name not in NotValid: ! if self._current_head == "": ! self._current_head = name ! self._SQLStr = "INSERT INTO " ! self._SQLStr += name ! self._SQLStr += " (" ! elif self._current_column == "": ! self._current_column = name ! self._SQLStr += str(name) ! else: ! self._SQLStr += ", " ! self._SQLStr += name ! def endElement(self, name): ! if name == self._current_head: ! self._SQLStr += ") VALUES ( " ! self._SQLStr += self._values[0:-2] ! self._SQLStr += " );" ! self._current_head = "" ! self._current_column = "" ! self._values = "" ! SQL.append( self._SQLStr ); ! def characters(self, content): ! if content.strip() != '': ! self._values += "'" + content.strip() + "'" ! self._values += ", " ! ! def endDocument(self): ! print "End of Transmission" ! ! parser = make_parser() ! parser.setContentHandler(FancyCounter()) ! parser.parse(sys.argv[1]) - for item in SQL: - print item ,"\n" --- 1,361 ---- #!/usr/bin/python ! """ ! translate.py - this script reads an ACD XML file and translates it ! to an ACD MySQL database. ! """ ! import sys ! import string ! import MySQLdb ! import time ! import datetime ! import getopt from xml.sax import saxutils, make_parser, handler ! class ACD(object): ! def __init__(self, myDate): ! self.__server="localhost"; ! self.__port=3306 ! self.__dbname="acd"; ! self.__username="acd"; ! self.__password="55spoon+"; ! self.__DateExecuted = myDate; ! self.__DB=ACDDatabase(self.__server, self.__port, self.__dbname, self.__username, self.__password); ! ! def ParseXML(self, filename): ! self.__ACDItems = []; ! parser=make_parser(); ! parser.setContentHandler( ACDParser(self.__ACDItems ) ); ! parser.parse( filename ); ! ## self.__ACDItems now has the ACDItems from the XML doc ! def DifferenceXMLtoDB(self): ! changed=False; ! for item in self.__ACDItems: ! colNames="("; ! colValues="("; ! SQLStr = "SELECT id FROM " + item.GetTableName() + " WHERE "; ! for columnName, columnValue in item.GetItems().iteritems(): ! ## let's save the instance name for further use ! if item.GetTableName() == "instance": ! if columnName == "hostname": ! self.__instanceName = columnValue; ! ############################################### ! SQLStr += columnName + "='" + columnValue + "' AND "; ! colNames += columnName + ", "; ! colValues += "'" + columnValue + "', "; ! SQLStr = SQLStr[0:-4] + ";"; ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! changed=True; ! if item.GetTableName() != "instance": ! SQLStr1 = "INSERT INTO " + item.GetTableName()+ " " + colNames[0:-2] + ") VALUES " + colValues[0:-2] +");"; ! self.__DB.Execute( SQLStr1 ); ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! print "ERROR: The Row Really should exists. There was an error with the SQL insert statement.\n"; ! print "SQL1=", SQLStr1; ! print "SQL=", SQLStr; ! ! return changed; ! ! ! def LoadXML(self): ! self.__XMLValues = loading(); ! for item in self.__ACDItems: ! if item.GetTableName() != "instance": ! colNames="("; ! colValues="("; ! SQLStr = "SELECT id FROM " + item.GetTableName() + " WHERE "; ! for columnName, columnValue in item.GetItems().iteritems(): ! SQLStr += columnName + "='" + columnValue + "' AND "; ! colNames += columnName + ", "; ! colValues += "'" + columnValue + "', "; ! SQLStr = SQLStr[0:-4] + ";"; ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! print "ERROR: the row should exist\n"; ! sys.exit (1); ! self.__XMLValues.AddItem( item.GetTableName() + "s", row[0] ); ! ! def LoadDB(self): ! self.__DBValues = loading(); ! ## ! ## Let's parse ACDItems and get a list together from the DB ! ## ! SQLStr = "SELECT id,date FROM instance WHERE hostname='" + self.__instanceName + "' ORDER BY date DESC"; ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row != None: ! instanceID = row[0]; ! completed=['instance']; ! for item in self.__ACDItems: ! if item.GetTableName() not in completed: ! SQLStr = "SELECT " + item.GetTableName() + "_id FROM " + item.GetTableName() + "s WHERE instance_id='" + str(instanceID) + "';" ! cursor = self.__DB.Execute( SQLStr ); ! while (1): ! row = cursor.fetchone () ! if row == None: ! break; ! self.__DBValues.AddItem( item.GetTableName() + "s", row[0] ); ! completed.append(item.GetTableName() ); ! ! def XMLValuesEqualsDBValues(self): ! self.LoadDB(); ! self.LoadXML(); ! return self.__DBValues == self.__XMLValues; ! ! def InsertNewInstance(self): ! SQLStr = "INSERT into instance (hostname,date) VALUES ('" + self.__instanceName + "','" + str(self.__DateExecuted) + "')"; ! self.__DB.Execute( SQLStr ); ! ! SQLStr = "SELECT id FROM instance WHERE hostname = '" + self.__instanceName + "' and date = '" + str(self.__DateExecuted) + "';"; ! ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! print "ERROR: The Row should exist"; ! ! ## Let's load the DB ! instanceID = row[0]; ! for item in self.__ACDItems: ! colNames="("; ! colValues="("; ! SQLStr = "SELECT id FROM " + item.GetTableName() + " WHERE "; ! for columnName, columnValue in item.GetItems().iteritems(): ! SQLStr += columnName + "='" + columnValue + "' AND "; ! colNames += columnName + ", "; ! colValues += "'" + columnValue + "', "; ! SQLStr = SQLStr[0:-4] + ";"; ! ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! print "ERROR: The Row should exist"; ! else: ! if item.GetTableName() != "instance": ! otherID = row[0]; ! SQLStr = "INSERT INTO " + item.GetTableName() + "s (instance_id, " + item.GetTableName() + "_id, date) VALUES ('" + str(instanceID) + "', '" + str(otherID) + "', '" + str(self.__DateExecuted) + "');"; ! self.__DB.Execute( SQLStr ); ! ! def UpdateInstance(self): ! ### All is well, and we want to update the date field on all relevant tables in the database ! # get the id of the latest instance ! SQLStr="select id from instance where hostname='" + self.__instanceName + "' order by date desc;"; ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! print "ERROR: The Row should exist"; ! instanceID = row[0]; ! for item in self.__ACDItems: ! colNames="("; ! colValues="("; ! SQLStr = "SELECT id FROM " + item.GetTableName() + " WHERE "; ! for columnName, columnValue in item.GetItems().iteritems(): ! SQLStr += columnName + "='" + columnValue + "' AND "; ! colNames += columnName + ", "; ! colValues += "'" + columnValue + "', "; ! SQLStr = SQLStr[0:-4] + ";"; ! ! row = self.__DB.Execute( SQLStr ).fetchone(); ! if row == None: ! print "ERROR: The Row should exist"; ! otherID = row[0]; ! ! if item.GetTableName() != "instance": ! SQLStr = "UPDATE " + item.GetTableName() + "s SET date='" + str(self.__DateExecuted) + "' WHERE " + item.GetTableName() + "_id='" + str(otherID) + "' AND instance_id='" + str(instanceID) + "';"; ! else: ! SQLStr = "UPDATE instance SET date='" + str(self.__DateExecuted) + "' WHERE id='" + str(instanceID) + "';"; ! self.__DB.Execute( SQLStr ); ! ! ! class ACDDatabase(object): ! def __init__(self, server, port, dbname, username, password): ! try: ! self.__conn = MySQLdb.connect (host = server, user = username, passwd = password, db = dbname); ! except MySQLdb.Error, e: ! print "Error %d: %s" % (e.args[0], e.args[1]); ! print "ERROR: could not connect to the database exiting"; ! sys.exit (1); ! ! ! self.__cursor = self.__conn.cursor(); ! self.__open=True; ! ! ! def BuildInsert( self, tableName, valueMap ): ! SQL = ""; ! columnNames=" ("; ! columnValues=" VALUES '"; ! for key, value in valueMap.iteritems(): ! columnNames += key + ", "; ! columnValues += value + "', "; ! ! # remove the extra , ! columnNames = columnNames[0:-2] + ')'; ! columnValues = columnValues[0:-2] + ')'; ! ! SQL = "INSERT INTO " + tableName + columnNames + columnValues; ! return SQL; ! ! def Execute( self, SQL): ! if not self.__open: ! raise ValueError; ! try: ! self.__cursor.execute(SQL); ! except MySQLdb.OperationalError, message: ! errorMessage = "Error %d:\n%s" % (message[ 0 ], message[ 1 ] ) ! print "ERROR: ", errorMessage; ! sys.exit(1); ! except: ! print "ERROR: There was an error executing"; ! print SQL ! sys.exit(1); ! ! return self.__cursor; ! ! def Close(self): ! self.__open=False; ! self.__cursor.close(); ! self.__conn.close(); ! ! class loading(object): ! def __init__(self): ! self._values = []; ! ! def AddItem(self, tablename, table_id): ! self._values.append((tablename, table_id)); ! ! def ShowAll(self): ! self._values.sort() ! for item in self._values: ! print item; ! ! def __eq__(self, other): ! if len( self._values) == len( other._values ): ! self._values.sort(); ! other._values.sort(); ! x=0; ! for item in self._values: ! if item !=other._values[x]: ! return False; ! x+=1; ! return True; ! ! return False; ! ! def __ne__(self, other): ! return not ( self == other); ! ! ! class ACDTable(object): ! def __init__(self, tname): ! self._tablename = tname; ! self._item = {}; ! self._id = -1; ! self._verified = -1; ! ! def SetTableName(self, name): ! self._tablename = name; ! ! def SetItems(self, name, value): ! self._item[name]=value; ! ! def SetID(self, id): ! self._id = id; ! ! def GetTableName(self): ! return self._tablename; ! ! def GetItems(self): ! return self._item; ! ! def PrintAll(self): ! print "%s" % (self._tablename); ! for columnName, columnValue in self._item.iteritems(): ! print "\t%s = %s" % (columnName, columnValue); ! ! ! class ACDParser(handler.ContentHandler): ! ! def __init__(self, ACDTable): ! self._current_head = ""; ! self._current_column = ""; ! self.__ACDItems = ACDTable; ! self.__NotValid = [ "system", "required", "optional", "custom" ]; ! ! ! def startElement(self, name, attrs): ! if name not in self.__NotValid: ! if self._current_head == "": ! ## create the table ! self._current_table = ACDTable( name ); ! self._current_head = name; ! ! else: ! self._current_column = name.strip(); ! ! def endElement(self, name): ! if name == self._current_head: ! self._current_head = ""; ! self._current_column = ""; ! self.__ACDItems.append( self._current_table ); + def characters(self, content): + if content.strip() != '': + self._current_table.SetItems( self._current_column, content.strip() ); ! def endDocument(self): ! pass; ! def ACDFile(filename): ! DateExecuted = datetime.datetime.now().strftime( '%Y-%m-%d %H:%M:%S' ); ! working = ACD( DateExecuted ); ! working.ParseXML( filename ); ! if not working.DifferenceXMLtoDB() and working.XMLValuesEqualsDBValues(): ! print "Updating"; ! working.UpdateInstance(); ! else: ! working.InsertNewInstance(); ! print "New Instance"; ! ! ! ! ! def main(): ! dirmode=False; ! ! # parse command line options ! try: ! opts, args = getopt.getopt(sys.argv[1:], "hd", ["help"]) ! except getopt.error, msg: ! print msg ! print "for help use --help" ! sys.exit(2) ! # process options ! for o, a in opts: ! if o in ("-h", "--help"): ! print __doc__ ! sys.exit(0) ! if o == "-d": ! dirmode=True; ! ! if dirmode: ! if len(args) != 1: ! print "ERROR: directory not specified."; ! else: ! acddir( args[0] ); ! else: ! if len(args) != 1: ! print "ERROR: no file specified."; ! else: ! ACDFile( args[0] ); ! ! ! ! if __name__=="__main__": ! try: ! main(); ! except KeyboardInterrupt, e: ! print "\n"; |
|
From: Mitchell G. <mrg...@us...> - 2006-02-13 16:21:09
|
Update of /cvsroot/acd/acd-2/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17905/bin Added Files: convert.py Log Message: Initial start of the python conversion code. --- NEW FILE: convert.py --- #!/usr/bin/python import sys, string from xml.sax import saxutils, make_parser, handler SQL = []; NotValid = [ "system", "required", "optional", "custom" ]; class FancyCounter(handler.ContentHandler): def __init__(self): self._SQLStr = ""; self._values = ""; self._current_head = ""; self._current_column = ""; def startElement(self, name, attrs): if name not in NotValid: if self._current_head == "": self._current_head = name self._SQLStr = "INSERT INTO " self._SQLStr += name self._SQLStr += " (" elif self._current_column == "": self._current_column = name self._SQLStr += str(name) else: self._SQLStr += ", " self._SQLStr += name def endElement(self, name): if name == self._current_head: self._SQLStr += ") VALUES ( " self._SQLStr += self._values[0:-2] self._SQLStr += " );" self._current_head = "" self._current_column = "" self._values = "" SQL.append( self._SQLStr ); def characters(self, content): if content.strip() != '': self._values += "'" + content.strip() + "'" self._values += ", " def endDocument(self): print "End of Transmission" parser = make_parser() parser.setContentHandler(FancyCounter()) parser.parse(sys.argv[1]) for item in SQL: print item ,"\n" |
|
From: Josh L. <ru...@us...> - 2006-02-12 01:04:16
|
Update of /cvsroot/acd/acd-2/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13343/bin Modified Files: 00_linux_required Log Message: Added OS tests for SuSE pro and SLES 9, tested on Pro 9.2 and SLES9 Index: 00_linux_required =================================================================== RCS file: /cvsroot/acd/acd-2/bin/00_linux_required,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** 00_linux_required 12 Feb 2006 00:56:25 -0000 1.2 --- 00_linux_required 12 Feb 2006 01:03:54 -0000 1.3 *************** *** 24,31 **** OSREL=$(cat /etc/debian_version) OSPATCH=${OSREL} fi - - echo " <required>" echo " <hostname>" --- 24,40 ---- OSREL=$(cat /etc/debian_version) OSPATCH=${OSREL} + elif [ -f /etc/SuSE-release ] ; then + if grep Enterprise /etc/SuSE-release ; then + OSDISTRO="SLES" + else + OSDISTRO="SuSE Professional" + fi + OSREL=$(grep VERSION /etc/SuSE-release | awk '{print $3}') + OSPATCH=$(grep PATCHLEVEL /etc/SuSE-release | awk '{print $3}') + if [ -z "${OSPATCH}" ] ; then + OSPATCH=$OSREL + fi fi echo " <required>" echo " <hostname>" |
|
From: Josh L. <ru...@us...> - 2006-02-12 00:56:34
|
Update of /cvsroot/acd/acd-2/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10808 Modified Files: 00_linux_required Log Message: Added debian distro support Index: 00_linux_required =================================================================== RCS file: /cvsroot/acd/acd-2/bin/00_linux_required,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 00_linux_required 11 Feb 2006 02:34:28 -0000 1.1 --- 00_linux_required 12 Feb 2006 00:56:25 -0000 1.2 *************** *** 20,23 **** --- 20,27 ---- fi OSPATCH=$(awk '{print $10}' /etc/redhat-release| sed 's/)//') + elif [ -f /etc/debian_version ] ; then + OSDISTRO="Debian" + OSREL=$(cat /etc/debian_version) + OSPATCH=${OSREL} fi |
|
From: Josh L. <ru...@us...> - 2006-02-11 02:34:37
|
Update of /cvsroot/acd/acd-2/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6091/bin Added Files: 00_linux_required 20_optional_linux_cpu 21_optional_linux_disks 22_optional_linux_network Log Message: initial info gathering scripts for linux added --- NEW FILE: 00_linux_required --- #!/bin/sh HOSTNAME=$(/bin/hostname) OSNAME="Linux" # get osinfo if [ -f /etc/redhat-release ] ; then S=$(cat /etc/redhat-release) if grep "Red Hat Enterprise" /etc/redhat-release ; then OSDISTRO=RHEL if grep "release 3" /etc/redhat-release ; then OSREL="3" elif grep "release 4" /etc/redhat-release ; then OSREL="4" else OSREL="-1" fi else OSDISTRO="Unknown Red Hat" fi OSPATCH=$(awk '{print $10}' /etc/redhat-release| sed 's/)//') fi echo " <required>" echo " <hostname>" echo " ${HOSTNAME}" echo " </hostname>" echo " <operatingsystem>" echo " <name>${OSNAME}</name>" echo " <distribution>${OSDISTRO}</distribution>" echo " <version>${OSREL}</version>" echo " <patchLevel>${OSPATCH}<patchLevel>" echo " </operatingsystem>" echo " </required>" --- NEW FILE: 20_optional_linux_cpu --- #!/usr/bin/env perl use strict; my $num_cpus=0; my $mhz; my $arch; my $model; open CPUINFO, "/proc/cpuinfo"; while(<CPUINFO>) { if( /processor/ ) { $num_cpus++; } elsif ( /cpu MHz/) { $_ =~ s/cpu MHz.*:\s*//g; $mhz=$_; } elsif (/model name/){ $_ =~ s/model name:\s*//g; if(m/Xeon/){ $model="Intel Xeon"; } elsif (m/Opteron/){ $model="AMD Opteron"; } } } chomp $mhz; $mhz=int $mhz; $arch=`uname -m`; chomp $arch; for(my $i=0;$i<$num_cpus;$i++){ print " <cpu>\n"; print " <architecture>$arch</architecture>\n"; print " <speed>$mhz</speed>\n"; print " <model>$model</model>\n"; print " </cpu>\n" } --- NEW FILE: 21_optional_linux_disks --- #!/usr/bin/env perl use strict; open(P,'</proc/partitions') or die "Cannot open /proc/partitions: $!"; while(<P>){ if(m/^major/i){ next; } elsif (m/^$/) { next; } elsif (m/^\s*[0-9]+\s*[0]/){ my $c=$_; $c =~ m/^\s*[0-9]+\s+[0]\s+([0-9]+)\s+(...)/; print " <disk_drive>\n"; print " <device>$2</device>\n"; print " <size>$1</size>\n"; print " </disk_drive>\n"; } } --- NEW FILE: 22_optional_linux_network --- #!/usr/bin/env perl use strict; use Data::Dumper; my @ifconfig; my $ifname; my $current_line; use vars qw/$hw_address $inet_addr $netmask $mtu $broadcast/; my $i; my $current_interface; my @interfaces; @ifconfig=`/sbin/ifconfig`; for ($i=0; $i<$#ifconfig; $i++) { $current_line=$ifconfig[$i]; chomp($current_line); if($current_line =~ m/^[0-9a-zA-Z]/){ if($current_interface->{ifname}){ push(@interfaces,$current_interface); } #print_interface($current_interface); undef($current_interface); $ifname = $current_line; $ifname =~ s/^([0-9A-z:]+).*/$1/; $current_interface->{ifname}=$ifname; if($current_line =~ m/HWaddr/){ $hw_address = $current_line; $hw_address =~ s/.*HWaddr ([a-fA-F0-9:]+)\s*/$1/; $current_interface->{hw_address}=$hw_address; } } elsif ($current_line =~ m/\s*inet addr/){ $current_line =~ m/inet addr:([0-9.]+).*Bcast:([0-9.]+).*Mask:(([0-9.]+))/; $current_interface->{inet_addr}=$1; $current_interface->{broadcast}=$2; $current_interface->{netmask}=$3; } elsif ($current_line =~ m/MTU/){ $mtu=$current_line; $mtu =~ s/.*MTU:([0-9]+).*/$1/; $current_interface->{mtu}=$mtu; } } push(@interfaces, $current_interface); foreach my $a (@interfaces){ print_interface($a); } sub print_interface{ my $int=shift; if($int->{ifname} eq "lo") { return; } print " <!-- interface ".$int->{ifname}." -->\n"; print " <network_interface>\n"; print " <device>".$int->{ifname}."</device>\n"; if($int->{inet_addr}){ print " <ip_address>".$int->{inet_addr}."</ip_address>\n"; } if($int->{netmask}){ print " <netmask>".$int->{netmask}."</netmask>\n"; } if($int->{hw_address}){ print " <mac>".$int->{hw_address}."</mac>\n"; } if($int->{mtu}){ print " <mtu>".$int->{mtu}."</mtu>\n"; } if($int->{broadcast}){ print " <broadcast>".$int->{broadcast}."</broadcast>\n"; } print " </network_interface>\n"; } |
|
From: Josh L. <ru...@us...> - 2006-02-11 02:33:46
|
Update of /cvsroot/acd/acd-2/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5793/bin Log Message: Directory /cvsroot/acd/acd-2/bin added to the repository |
|
From: Mitchell G. <mrg...@us...> - 2006-02-10 14:11:24
|
Update of /cvsroot/acd/acd-2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9075 Modified Files: acd.xsd Added Files: sample.xml Log Message: added sample.xml as a working example of what an XML "should" look like. --- NEW FILE: sample.xml --- <?xml version='1.0' encoding='utf-8' standalone='no'?> <system xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:acd="http://acd.org/acd" xsi:schemaLocation="http://acd.org/acd acd.xsd" > <required> <hostname>fozzie0</hostname> <operatingsystem> <name>linux</name> <kernel>2.6.9-22.5</kernel> <distribution>RedHat Enterprise Linux WS</distribution> <version>4</version> <patchlevel>U2</patchlevel> </operatingsystem> </required> <optional> <cpu> <architecture>x86_64</architecture> <model>GenuineIntel</model> <speed>3591</speed> </cpu> <cpu> <architecture>x86_64</architecture> <model>GenuineIntel</model> <speed>3591</speed> </cpu> <network_interface> <ip_address>192.168.1.1</ip_address> <netmask>255.255.255.255</netmask> <mac>00:0d:93:c5:b1:ca</mac> <device>eth0</device> <MTU>1500</MTU> <broadcast>192.168.1.1</broadcast> </network_interface> <disk_drive> <device>/dev/sda</device> <size>1024</size> <manufacturer>maxtor</manufacturer> </disk_drive> </optional> <custom> <customitem> <name>numberofdisks</name> <value>12</value> </customitem> <customitem> <name>bob</name> <value>newValue</value> </customitem> </custom> </system> Index: acd.xsd =================================================================== RCS file: /cvsroot/acd/acd-2/acd.xsd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** acd.xsd 6 Feb 2006 18:01:41 -0000 1.1 --- acd.xsd 10 Feb 2006 14:11:13 -0000 1.2 *************** *** 1,3 **** ! <?xml version="1.0" ?> <xs:schema --- 1,3 ---- ! <?xml version="1.0"?> <xs:schema *************** *** 17,20 **** --- 17,21 ---- </xs:complexType> + <xs:complexType name="requiredType"> <xs:sequence> *************** *** 27,32 **** <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" /> ! <xs:element name="distribution" type="xs:string" minOccurs="1" maxOccurs="1" /> // restrict to [a-Z0-9.-] ! <xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1" /> // restrict to [a-Z0-9.-] <xs:element name="patchLevel" type="xs:string" minOccurs="1" maxOccurs="1" /> </xs:sequence> --- 28,33 ---- <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" /> ! <xs:element name="distribution" type="xs:string" minOccurs="1" maxOccurs="1" /> ! <xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="patchLevel" type="xs:string" minOccurs="1" maxOccurs="1" /> </xs:sequence> *************** *** 98,102 **** </xs:simpleType> </xs:element> ! --- 99,103 ---- </xs:simpleType> </xs:element> ! </xs:schema> |
|
From: Mitchell G. <mrg...@us...> - 2006-02-06 18:01:51
|
Update of /cvsroot/acd/acd-2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30169 Added Files: acd.xsd Log Message: Added the initial XML schema --- NEW FILE: acd.xsd --- <?xml version="1.0" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://acd.org/acd" elementFormDefault="unqualified" > <xs:element name="system" type="systemType" /> <xs:complexType name="systemType"> <xs:sequence> <xs:element name="required" type="requiredType" minOccurs="1" maxOccurs="1" /> <xs:element name="optional" type="optionalType" minOccurs="0" maxOccurs="1" /> <xs:element name="custom" type="customType" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:complexType name="requiredType"> <xs:sequence> <xs:element name="hostname" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="operatingsystem" type="operatingsystemType" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:complexType name="operatingsystemType"> <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="distribution" type="xs:string" minOccurs="1" maxOccurs="1" /> // restrict to [a-Z0-9.-] <xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1" /> // restrict to [a-Z0-9.-] <xs:element name="patchLevel" type="xs:string" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:complexType name="optionalType"> <xs:sequence> <xs:element name="cpu" type="cpuType" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="network_interface" type="network_interfaceType" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="disk_drive" type="disk_driveType" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> <xs:complexType name="cpuType"> <xs:sequence> <xs:element name="architecture" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="model" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="speed" type="xs:decimal" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:complexType name="network_interfaceType"> <xs:sequence> <xs:element name="ip_address" type="ipaddrType" minOccurs="0" maxOccurs="1" /> <xs:element name="netmask" type="ipaddrType" minOccurs="0" maxOccurs="1" /> <xs:element name="mac" type="macaddrType" minOccurs="0" maxOccurs="1" /> <xs:element name="device" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="MTU" type="xs:integer" minOccurs="0" maxOccurs="1" /> <xs:element name="broadcast" type="ipaddrType" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:complexType name="disk_driveType"> <xs:sequence> <xs:element name="device" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="size" type="sizeType" minOccurs="1" maxOccurs="1" /> <xs:element name="manufacturer" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:complexType name="customType"> <xs:sequence> <xs:element name="customField" type="customFieldType" minOccurs="1" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> <xs:complexType name="customFieldType"> <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:element name="sizeType"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:minInclusive value="0"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="ipaddrType"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:pattern value="[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]" /> </xs:restriction> </xs:simpleType> </xs:element> |
|
From: Mitchell G. <mrg...@us...> - 2006-02-06 17:58:27
|
Update of /cvsroot/acd/acd-2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28817/acd-2 Log Message: Directory /cvsroot/acd/acd-2 added to the repository |
|
From: Josh L. <ru...@us...> - 2004-05-27 13:18:13
|
Update of /cvsroot/acd/acd-1/web/arch/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27422 Modified Files: release Log Message: release: - fixed to put "Debian" in the release string Index: release =================================================================== RCS file: /cvsroot/acd/acd-1/web/arch/linux/release,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** release 27 May 2004 02:14:45 -0000 1.4 --- release 27 May 2004 13:17:55 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- elif [ -f /etc/debian_version ] ; then REL=`cat /etc/debian_version` + REL=`echo Debian ${REL}` fi echo " <basic_info>" |
|
From: Matt D. <md...@us...> - 2004-05-27 05:45:30
|
Update of /cvsroot/acd/acd-1/web/arch/OpenBSD-3.4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14764 Added Files: aging cpu diskspace memory Log Message: - Started the OpenBSD-3.4 arch, partly as an exercise, partly because JLo was talking about it today. diskspace worked as copied from the linux directory. I didn't really touch aging, but cpu and memory are kludgy and depend on dmesg. I haven't been able to get network_interfaces figured out yet. -MD --- NEW FILE: aging --- #!/bin/sh GET_TIME=/usr/local/bin/get_time if [ -x $GET_TIME ]; then TIME=`/usr/local/bin/get_time -m /etc/init.d` fi echo " <basic_info>" echo " <installed>$TIME</installed>" echo " </basic_info>" --- NEW FILE: cpu --- #!/bin/sh ARCH=`uname -m` CPU_LIST=`dmesg | grep MHz | grep cpu | cut -d: -f1 | uniq ` echo "<hostinfo>" # Below, I'm trying to get the cpu speed. The only thing I've # been able to do so far is to grep that info out of dmesg, # where there is a line that says a certain cpu is "597 MHz" # or some such. I'm expecting that "597 MHz" (e.g.) to be # at the very end of the line, and so I parse that line out # for each cpu, and then grab the next to last string in the # line, which should be the speed. With any luck. -MD for cpu in $CPU_LIST do MHZ=`dmesg | grep cpu0 | grep MHz | awk '{print $(NF-1)}'` echo " <cpu speed='$MHZ' architecture='$ARCH' />" done echo "</hostinfo>" --- NEW FILE: diskspace --- #!/usr/bin/env perl my $line; my $total_k=0; my $total_g; my @chunks; my $string; open DF, "/bin/df -lk|"; while(<DF>) { $line=$_; if(not /Filesystem/ and not /shm/ and not /\/dev\/fd0/) { $line =~ s/\/dev\/[\w]*\s*(\d*).*/$1/; $total_k+=$line; } } $total_g=$total_k/(1024*1024); $string=sprintf("%.0f",$total_g); print " <basic_info>\n"; print " <diskspace>$string</diskspace>\n"; print " </basic_info>\n"; --- NEW FILE: memory --- #!/bin/sh MLINE=`dmesg | grep "real mem" | awk {'print $5'} | sed s/\(// | sed s/K\)//` echo $MLINE MEM=`dc -e "$MLINE 1024 / p"` echo "<basic_info>" echo "<ram>$MEM</ram>" echo "</basic_info>" |
|
From: Matt D. <md...@us...> - 2004-05-27 04:40:58
|
Update of /cvsroot/acd/acd-1/web/arch/OpenBSD-3.4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6133/OpenBSD-3.4 Log Message: Directory /cvsroot/acd/acd-1/web/arch/OpenBSD-3.4 added to the repository |
|
From: Matt D. <md...@us...> - 2004-05-27 04:31:29
|
Update of /cvsroot/acd/acd-1/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4481 Modified Files: xml-to-sql.pl Log Message: - commented out line 492, which was giving warnings and critical errors. I can't tell what is supposed to be happening there. I'm removing it for now because it is only in the debug section (which will be receiving attention soon anyway) and because commenting it out allows for full operability. -MD Index: xml-to-sql.pl =================================================================== RCS file: /cvsroot/acd/acd-1/scripts/xml-to-sql.pl,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** xml-to-sql.pl 14 Oct 2003 00:38:50 -0000 1.16 --- xml-to-sql.pl 27 May 2004 04:31:19 -0000 1.17 *************** *** 490,494 **** my @args=@_; my @splitted=split(/\n/, @_); ! @splitted =~ s/$/$pid/g; print DEBUGLOG @splitted; --- 490,497 ---- my @args=@_; my @splitted=split(/\n/, @_); ! # The following line generates errors, and I haven't been able to ! # figure out what it's supposed to do anyway. Needs to be ! # worked out. -MD ! # @splitted =~ s/$/$pid/g; print DEBUGLOG @splitted; |
|
From: Matt D. <md...@us...> - 2004-05-27 02:25:30
|
Update of /cvsroot/acd/acd-1/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16526 Modified Files: acd_client.pl Log Message: - removed obsolete usage line - inserted conditional to make FORCE_FQDN stuff friendlier when not in use Index: acd_client.pl =================================================================== RCS file: /cvsroot/acd/acd-1/scripts/acd_client.pl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** acd_client.pl 27 May 2004 01:17:03 -0000 1.10 --- acd_client.pl 27 May 2004 02:25:20 -0000 1.11 *************** *** 34,40 **** my %config; my $acd_proxy=''; - - my $usage=$1." [-c] [-d] [-p]"; my $help="$0 -c specify alternate config file (default $config_file --- 34,39 ---- my %config; my $acd_proxy=''; + my $FORCE_FQDN; my $help="$0 -c specify alternate config file (default $config_file *************** *** 83,88 **** # try to use the FQDN for hosts # mostly useful in an environment with multiple domains/subdomains ! my $FORCE_FQDN="$config{'FORCE_FQDN'}"; ! dprint ("Using FQDN: $FORCE_FQDN\n"); if(defined($config{'acd_proxy'})) { $acd_proxy="$config{'acd_proxy'}"; --- 82,89 ---- # try to use the FQDN for hosts # mostly useful in an environment with multiple domains/subdomains ! if(defined($config{'FORCE_FQDN'})) { ! $FORCE_FQDN="$config{'FORCE_FQDN'}"; ! dprint ("Using FQDN: $FORCE_FQDN\n"); ! } if(defined($config{'acd_proxy'})) { $acd_proxy="$config{'acd_proxy'}"; |
|
From: Matt D. <md...@us...> - 2004-05-27 02:14:54
|
Update of /cvsroot/acd/acd-1/web/arch/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14585 Modified Files: aging release Log Message: Added conditional to aging to allow for the absence of get_time. Added Debian support for release. -MD Index: aging =================================================================== RCS file: /cvsroot/acd/acd-1/web/arch/linux/aging,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aging 15 Aug 2002 11:53:35 -0000 1.1 --- aging 27 May 2004 02:14:45 -0000 1.2 *************** *** 1,5 **** #!/bin/sh ! TIME=`/usr/local/bin/get_time -m /etc/init.d` echo " <basic_info>" --- 1,8 ---- #!/bin/sh + GET_TIME=/usr/local/bin/get_time ! if [ -x $GET_TIME ]; then ! TIME=`/usr/local/bin/get_time -m /etc/init.d` ! fi echo " <basic_info>" Index: release =================================================================== RCS file: /cvsroot/acd/acd-1/web/arch/linux/release,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** release 27 May 2004 01:17:04 -0000 1.3 --- release 27 May 2004 02:14:45 -0000 1.4 *************** *** 5,8 **** --- 5,10 ---- elif [ -f /etc/SuSE-release ] ; then REL=`head -1 /etc/SuSE-release | sed 's#(.*)##' | sed 's# $##'|sed 's#Linux ##'` + elif [ -f /etc/debian_version ] ; then + REL=`cat /etc/debian_version` fi echo " <basic_info>" |
|
From: Josh L. <ru...@us...> - 2004-05-27 01:17:15
|
Update of /cvsroot/acd/acd-1/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6641/scripts Modified Files: acd_client.pl Log Message: scripts/acd_client.pl: - cleaned up URL slightly web/arch/linux/release: - handle RedHat Enterprise Linux - handle SuSE Index: acd_client.pl =================================================================== RCS file: /cvsroot/acd/acd-1/scripts/acd_client.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** acd_client.pl 16 Feb 2003 21:20:12 -0000 1.9 --- acd_client.pl 27 May 2004 01:17:03 -0000 1.10 *************** *** 92,95 **** --- 92,97 ---- my $URL="$config{'acd_http_root'}/$config{'acd_server_script'}"; + # normalize the URL + $URL =~ s#/{3,}#/#; dprint ("Using url: $URL\n"); my $BASEDIR=$config{'acd_local_dir'}; |
|
From: Josh L. <ru...@us...> - 2004-05-27 01:17:15
|
Update of /cvsroot/acd/acd-1/web/arch/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6641/web/arch/linux Modified Files: release Log Message: scripts/acd_client.pl: - cleaned up URL slightly web/arch/linux/release: - handle RedHat Enterprise Linux - handle SuSE Index: release =================================================================== RCS file: /cvsroot/acd/acd-1/web/arch/linux/release,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** release 30 Apr 2004 14:31:37 -0000 1.2 --- release 27 May 2004 01:17:04 -0000 1.3 *************** *** 1,5 **** #!/bin/sh ! REL=`cat /etc/redhat-release | sed 's/release//'|sed 's/Linux//' | sed 's/Advanced Workstation//' | sed 's/(.*)//' | sed 's/ */ /g'` echo " <basic_info>" echo " <osrel>$REL</osrel>" --- 1,9 ---- #!/bin/sh ! if [ -f /etc/redhat-release ] ; then ! REL=`cat /etc/redhat-release | sed 's/release//'|sed 's/Linux//' | sed 's/Advanced Workstation//'|sed 's/Advanced Server//' | sed 's/(.*)//' | sed 's/ */ /g'` ! elif [ -f /etc/SuSE-release ] ; then ! REL=`head -1 /etc/SuSE-release | sed 's#(.*)##' | sed 's# $##'|sed 's#Linux ##'` ! fi echo " <basic_info>" echo " <osrel>$REL</osrel>" |
|
From: Matt D. <md...@us...> - 2004-05-27 01:13:39
|
Update of /cvsroot/acd/acd-1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5950 Modified Files: README Removed Files: INSTALL install Log Message: Removed some old install files that were useless and confusing. Changed README to simply reference web/doc.html. -MD Index: README =================================================================== RCS file: /cvsroot/acd/acd-1/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 28 Feb 2002 22:36:26 -0000 1.4 --- README 27 May 2004 01:13:27 -0000 1.5 *************** *** 1,3 **** ! Nothing here yet. ! But things coming soon. --- 1,3 ---- ! See web/doc.html for more information about ACD, including installation ! instructions. --- INSTALL DELETED --- --- install DELETED --- |
|
From: Matt D. <md...@us...> - 2004-05-27 00:04:18
|
Update of /cvsroot/acd/acd-1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26227 Modified Files: cvs_install Log Message: Added some intelligence when trying to find apache and mysql. -MD Index: cvs_install =================================================================== RCS file: /cvsroot/acd/acd-1/cvs_install,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cvs_install 26 Mar 2003 01:14:41 -0000 1.3 --- cvs_install 27 May 2004 00:04:07 -0000 1.4 *************** *** 57,90 **** # predefine some standard locations my $answer ; ! my $apache="/usr/local/bin/httpd"; ! my $mysql="/usr/bin/mysql"; ! #my $apache="/opt/apache/bin/httpd"; ! #my $mysql="/opt/mysql/bin/mysql"; my $file_mode=0755; my $dbrootpw=""; my $acd_prefix="/usr/local/acd"; - print "\nPath to httpd? [$apache] : "; - $answer=<STDIN>; - if(not $answer =~ m/^\s$/) { - chomp($answer); - $apache=$answer; - } - if(-x $apache) { - print "$apache present and executable, good\n"; - } else { - print "$apache not here, do more stuff\n"; - } ! print "Path to mysql? [$mysql] :"; ! $answer=<STDIN>; ! if(not $answer =~ m/^\s$/) { ! chomp $answer; ! $mysql=$answer; } ! if(-x $mysql) { ! print "$mysql present and executable, good\n"; ! } else { ! print "$mysql does not exist, do more stuff\n"; } print "Prefix to install ACD server? [$acd_prefix] :"; --- 57,119 ---- # predefine some standard locations my $answer ; ! my $apache_default="/usr/local/bin/httpd"; ! my $mysql_default="/usr/bin/mysql"; ! #my $apache_default="/opt/apache/bin/httpd"; ! #my $mysql_default="/opt/mysql/bin/mysql"; my $file_mode=0755; my $dbrootpw=""; my $acd_prefix="/usr/local/acd"; ! ! ### Let's try to find the webserver, or use a default. ! my $apache = `which httpd`; ! unless ( $apache ) {$apache = `which apache`}; ! unless ( $apache ) {$apache = '/usr/local/httpd/bin/httpd'}; ! chomp $apache; ! ! my $apache_found = 0; ! while ( !$apache_found ) { ! print "Path to httpd? [$apache] : "; ! $answer=<STDIN>; ! if( $answer !~ m/^\s$/) { ! chomp($answer); ! } else { ! $answer = $apache; ! } ! if(-x $answer) { ! print "$answer present and executable, good\n"; ! $apache_found = 1; ! } else { ! print "$answer is not present and executable, please try again\n"; ! } } ! $apache = $answer; ! ### Ok, we should have a webserver now. ! ! ### Let's try to find the database server, or use a default. ! my $mysql = `which mysql`; ! unless ( $mysql ) {$mysql = `which mysql`}; ! unless ( $mysql ) {$mysql = $mysql_default}; ! chomp $mysql; ! ! my $mysql_found = 0; ! while ( !$mysql_found ) { ! print "Path to mysql? [$mysql] : "; ! $answer=<STDIN>; ! if( $answer !~ m/^\s$/) { ! chomp($answer); ! } else { ! $answer = $mysql; ! } ! if(-x $answer) { ! print "$answer present and executable, good\n"; ! $mysql_found = 1; ! } else { ! print "$answer is not present and executable, please try again\n"; ! } } + $mysql = $answer; + ### Ok, we should have a database server now. + print "Prefix to install ACD server? [$acd_prefix] :"; |
|
From: Josh L. <ru...@us...> - 2004-04-30 14:31:45
|
Update of /cvsroot/acd/acd-1/web/arch/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23705 Modified Files: memory release Log Message: - fixed a spurious use of cat - updated release for better parsing of RH AW and Fedora Core Index: memory =================================================================== RCS file: /cvsroot/acd/acd-1/web/arch/linux/memory,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** memory 12 Oct 2001 04:19:24 -0000 1.2 --- memory 30 Apr 2004 14:31:37 -0000 1.3 *************** *** 1,5 **** #!/bin/sh ! MLINE=`/bin/cat /proc/meminfo | grep MemTotal | awk '{ print $2 }' ` MEM=`dc -e "$MLINE 1024 / p"` echo "<basic_info>" --- 1,5 ---- #!/bin/sh ! MLINE=`grep MemTotal /proc/meminfo | awk '{ print $2 }' ` MEM=`dc -e "$MLINE 1024 / p"` echo "<basic_info>" Index: release =================================================================== RCS file: /cvsroot/acd/acd-1/web/arch/linux/release,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** release 2 Aug 2002 19:19:16 -0000 1.1 --- release 30 Apr 2004 14:31:37 -0000 1.2 *************** *** 1,5 **** #!/bin/sh ! REL=`cat /etc/redhat-release | sed 's/Linux release//' | sed 's/(.*)//' | sed 's/ / /'` echo " <basic_info>" echo " <osrel>$REL</osrel>" --- 1,5 ---- #!/bin/sh ! REL=`cat /etc/redhat-release | sed 's/release//'|sed 's/Linux//' | sed 's/Advanced Workstation//' | sed 's/(.*)//' | sed 's/ */ /g'` echo " <basic_info>" echo " <osrel>$REL</osrel>" |
|
From: Josh L. <ru...@us...> - 2004-01-17 23:57:46
|
Update of /cvsroot/acd/acd-1/windows/acd_installer
In directory sc8-pr-cvs1:/tmp/cvs-serv1425/windows/acd_installer
Added Files:
acd_client_windows.pl
Log Message:
initial rev
--- NEW FILE: acd_client_windows.pl ---
#!/usr/local/bin/perl5 -w
# copyright 2001,2002 Josh Lothian
#
# This file is part of ACD.
#
# ACD is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# ACD is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with ACD; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use LWP::UserAgent;
use Digest::MD5; # needed for checksums
use Getopt::Std;
use Data::Dumper;
use strict;
#my $DEBUG=0;
my $DEBUG=1;
my $SAVE_XML=0;
my %opts;
my $config_file;
my %config;
my $acd_proxy='';
getopts('c:dp',\%opts);
# -c takes a config file as an argument
# -d sets debug mode
if(defined($opts{'c'})) {
$config_file=$opts{'c'};
} else {
$config_file='C:\\acd\\acd.conf';
}
if(defined($opts{'d'})) {
$DEBUG=1;
}
if(defined($opts{'p'})) {
$SAVE_XML=1;
}
dprint ("Debug mode is on\n");
dprint ("Using config file: $config_file\n");
open CONFIG,$config_file or die "$config_file: $!\n";
my $line_num=0;
open CONFIG, "<".$config_file or die "$config_file: $!\n";
while (<CONFIG>) {
if(not /^\#/) {
my $var;
my $val;
($var,$val)=split(/=/);
dprint ("Read var: $var with value $val");
chomp $val;
die "$config_file: Error on line $line_num\n" if(not(defined $val));
$config{$var}=$val;
}
}
my $FORCE_FQDN="$config{'FORCE_FQDN'}";
dprint ("Using FQDN: $FORCE_FQDN\n");
if(defined($config{'acd_proxy'})) {
$acd_proxy="$config{'acd_proxy'}";
dprint ("Using proxy: $acd_proxy\n");
}
my $URL="$config{'acd_http_root'}/$config{'acd_server_script'}";
dprint ("Using url: $URL\n");
my $BASEDIR=$config{'acd_local_dir'};
dprint ("Base directory: $BASEDIR\n");
if (not -d $BASEDIR) {
dprint ("$BASEDIR does not exists, creating ...\n");
mkdir("$BASEDIR",0770);
}
my $UNAME;
my $OS;
my $OSVER;
my $OSstring;
my $hostname;
my $ua;
my $url;
my @files;
my $sum;
my $file;
my @download_list;
my $filereq;
my $fileresult;
my $exe;
$OS="windows";
my @temp=split(' ', `ver`);
$OSVER=$temp[2];
$OSstring="$OS-$OSVER";
dprint ("Detected $OSstring\n");
# this works for at least solaris and linux
# FIXME: test on HP
#$hostname=`/bin/hostname`;
$hostname=`hostname`;
chomp $hostname;
# Added by cgreer to force resolution to a full name instead of a
# short hostname. This should be a config option.
dprint ("Found hostname: $hostname\n");
if (defined($FORCE_FQDN)) {
use Net::Domain qw(hostname hostfqdn hostdomain);
$hostname=hostfqdn($hostname);
dprint (" ..becomes $hostname\n");
}
# create our UserAgent
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
if ($acd_proxy ne '') {
$ua->proxy('http',$acd_proxy);
}
# Create a request
my $req = new HTTP::Request POST => "$URL";
$req->content_type('application/x-www-form-urlencoded');
# request that the server send us a URL for the
# appropriate OS and OS version. The first line received
# should be a URL containting the path to the os-specific
# files. subsequent lines give current MD5 checksums for
# any files in that directory
if($DEBUG==1) {
$req->content("action=send_file_url&debug=yes&os=$OSstring");
} else {
$req->content("action=send_file_url&os=$OSstring");
}
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if (not $res->is_success) {
print STDERR "send_file_url failed, exiting ...\n";
dprint("Error returned was: ", $res->content);
exit;
} else {
my @content=split ("\n",$res->content);
my @filtered_content=grep(!/^$|^Content-Type/, @content);
($url, @files)=@filtered_content;
dprint ("Main file URL: $url\n");
}
# @files is a list of checksums and files. Use this to determine
# what needs to be downloaded
dprint ("Files:",join('\n',@files),"\n");
foreach (@files) {
($sum,$file)=split " ", $_;
if ( not -f "$BASEDIR\\$file" ) {
dprint ("New file: $file\n");
push @download_list,$file;
} elsif ( checksum($BASEDIR."\\".$file) ne $sum) {
push @download_list,$file;
dprint ("New checksum: $file\n");
}
}
#print "\n";
foreach (@download_list) {
$file=$_;
dprint ("Downloading: $url/$file ... ");
$filereq=new HTTP::Request GET => "$url/$file";
$fileresult=$ua->request($filereq, "$BASEDIR\\$file");
if ($fileresult->is_success) {
dprint ("File grabbed successfully!\n");
} else {
print STDERR "Error grabbing script file: $url/$file\n";
exit;
}
}
my $bigoutput;
my @output;
my $sendresult;
# now, collect the output from the client programs
dprint ("chdir'ing to $BASEDIR\n");
chdir "$BASEDIR";
foreach $exe (glob "*") {
dprint ("Running: $BASEDIR\\$exe\n");
push @output, `$BASEDIR\\$exe`;
}
#construct output
$bigoutput="<machine>
<basic_info>
<hostname>$hostname</hostname>
<os>$OS</os>
<osver>$OSVER</osver>
</basic_info>
" . join('', @output) . "\n</machine>";
#print "$bigoutput\n";
dprint ("Sending this to server: \n$bigoutput\n");
if($SAVE_XML==1) {
open XML,">$BASEDIR\\recent.xml" or die "$BASEDIR\\recent.xml: $!\n";
print XML $bigoutput;
close XML or die "$BASEDIR\\recent.xml: $!\n";
}
# send the output to the server
$req = new HTTP::Request POST => "$URL";
$req->content_type('application/x-www-form-urlencoded');
if($DEBUG==1) {
$req->content("action=accept_data&debug=yes&data=$bigoutput");
} else {
$req->content("action=accept_data&data=$bigoutput");
}
$sendresult=$ua->request($req);
if($sendresult->is_success) {
dprint ("Got back from server: ".$sendresult->content."\n");
}
sub checksum {
my $filename=shift;
open FILE, "$filename" or die "$filename: $!\n";
binmode(FILE);
return Digest::MD5->new->addfile(*FILE)->hexdigest;
}
sub dprint {
if($DEBUG==1) {
print STDERR @_;
}
}
|
|
From: Josh L. <ru...@us...> - 2003-10-14 00:38:55
|
Update of /cvsroot/acd/acd-1/windows/acd_installer In directory sc8-pr-cvs1:/tmp/cvs-serv14498/windows/acd_installer Added Files: acd.conf acd.nsi acd_client_windows_task.job Log Message: New checkin of tmd's windows stuff. --- NEW FILE: acd.conf --- acd_http_root=http://acd.cs.utk.edu/ acd_server_script=/acd/cgi-bin/acd_server.cgi acd_database=acd acd_local_dir=c:\acd_scripts FORCE_FQDN=TRUE; --- NEW FILE: acd.nsi --- ; Windows ACD installer script ; Based on NSIS Modern User Interface, Basic Example Script ; ; Trevor Dennison ; October 2, 2003 !define MUI_PRODUCT "Windows ACD" !define MUI_VERSION "1.0" !include "MUI.nsh" ;-------------------------------- ;Configuration ;General OutFile "windows_acd.exe" ;Remember install folder InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" "" ;-------------------------------- ;Modern UI Configuration !define MUI_COMPONENTSPAGE !define MUI_UNINSTALLER !define MUI_UNCONFIRMPAGE ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Language Strings ;Description LangString DESC_SecWindowsACD ${LANG_ENGLISH} "Copy the acd components to c:\acd, and set up a windows task scheduler job to run every night" LangString DESC_SecAdminMisc ${LANG_ENGLISH} "Install AdminMisc perl module" LangString DESC_SecPerl ${LANG_ENGLISH} "Install ActiveState Perl" ;-------------------------------- ;Data ; LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt" ;-------------------------------- ;Installer Sections Section "ActivePerl 5.8.0.806" SecPerl SetOutPath "C:\temp" ;Decompress the perl install program into c:\temp File "ActivePerl-5.8.0.806-MSWin32-x86.msi" ;Run the perl install program ExecWait "msiexec /i C:\temp\ActivePerl-5.8.0.806-MSWin32-x86.msi" ;Get rid of the installer afterwards Delete "C:\temp\ActivePerl-5.8.0.806-MSWin32-x86.msi" SectionEnd Section "AdminMisc" SecAdminMisc SetOutPath "C:\Perl\lib\Win32" File "AdminMisc_5008\ADMINMISC.PM" File "AdminMisc_5008\Win32-AdminMisc.ppd" SetOutPath "C:\Perl\lib" File "AdminMisc_5008\bin\AdminMisc.DLL" ;install the msvcr70 dll file required for adminmisc SetOutPath "C:\Windows\System" File "AdminMisc_5008\msvcr70.dll" SectionEnd Section "Windows ACD" SecWindowsACD SetOutPath "C:\acd" File acd_client_windows.pl File acd.conf File acd_manual_info SetOutPath "C:\windows\tasks" File acd_client_windows_task.job ;Store install folder WriteRegStr HKCU "Software\${MUI_PRODUCT}" "" $INSTDIR ;Create uninstaller WriteUninstaller "C:\acd\Uninstall.exe" SectionEnd ;Display the Finish header ;Insert this macro after the sections if you are not using a finish page !insertmacro MUI_SECTIONS_FINISHHEADER ;-------------------------------- ;Descriptions !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecWindowsACD} $(DESC_SecWindowsACD) !insertmacro MUI_DESCRIPTION_TEXT ${SecAdminMisc} $(DESC_SecAdminMisc) !insertmacro MUI_DESCRIPTION_TEXT ${SecPerl} $(DESC_SecPerl) !insertmacro MUI_FUNCTIONS_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Section "Uninstall" Delete "C:\acd\*" RMDir "C:\acd" Delete "C:\acd_scripts\*" RMDir "C:\acd_scripts" DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}" ;Display the Finish header !insertmacro MUI_UNFINISHHEADER SectionEnd --- NEW FILE: acd_client_windows_task.job --- ¯©F |
|
From: Josh L. <ru...@us...> - 2003-10-14 00:38:55
|
Update of /cvsroot/acd/acd-1/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv14498/scripts
Modified Files:
xml-to-sql.pl
Log Message:
New checkin of tmd's windows stuff.
Index: xml-to-sql.pl
===================================================================
RCS file: /cvsroot/acd/acd-1/scripts/xml-to-sql.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** xml-to-sql.pl 7 Dec 2002 02:45:29 -0000 1.15
--- xml-to-sql.pl 14 Oct 2003 00:38:50 -0000 1.16
***************
*** 487,491 ****
sub dprint {
if($DEBUG==1) {
! print DEBUGLOG @_;
}
}
--- 487,496 ----
sub dprint {
if($DEBUG==1) {
! my $pid=$$;
! my @args=@_;
! my @splitted=split(/\n/, @_);
! @splitted =~ s/$/$pid/g;
!
! print DEBUGLOG @splitted;
}
}
|
|
From: Josh L. <ru...@us...> - 2003-10-14 00:38:55
|
Update of /cvsroot/acd/acd-1/windows
In directory sc8-pr-cvs1:/tmp/cvs-serv14498/windows
Added Files:
acd_client_windows.pl
Log Message:
New checkin of tmd's windows stuff.
--- NEW FILE: acd_client_windows.pl ---
#!/usr/local/bin/perl5 -w
# copyright 2001,2002 Josh Lothian
#
# This file is part of ACD.
#
# ACD is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# ACD is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with ACD; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use LWP::UserAgent;
use Digest::MD5; # needed for checksums
use Getopt::Std;
use Data::Dumper;
use strict;
#my $DEBUG=0;
my $DEBUG=1;
my $SAVE_XML=0;
my %opts;
my $config_file;
my %config;
my $acd_proxy='';
getopts('c:dp',\%opts);
# -c takes a config file as an argument
# -d sets debug mode
if(defined($opts{'c'})) {
$config_file=$opts{'c'};
} else {
$config_file='C:\\acd.conf';
}
if(defined($opts{'d'})) {
$DEBUG=1;
}
if(defined($opts{'p'})) {
$SAVE_XML=1;
}
dprint ("Debug mode is on\n");
dprint ("Using config file: $config_file\n");
open CONFIG,$config_file or die "$config_file: $!\n";
my $line_num=0;
open CONFIG, "<".$config_file or die "$config_file: $!\n";
while (<CONFIG>) {
if(not /^\#/) {
my $var;
my $val;
($var,$val)=split(/=/);
dprint ("Read var: $var with value $val");
chomp $val;
die "$config_file: Error on line $line_num\n" if(not(defined $val));
$config{$var}=$val;
}
}
my $FORCE_FQDN="$config{'FORCE_FQDN'}";
dprint ("Using FQDN: $FORCE_FQDN\n");
if(defined($config{'acd_proxy'})) {
$acd_proxy="$config{'acd_proxy'}";
dprint ("Using proxy: $acd_proxy\n");
}
my $URL="$config{'acd_http_root'}/$config{'acd_server_script'}";
dprint ("Using url: $URL\n");
my $BASEDIR=$config{'acd_local_dir'};
dprint ("Base directory: $BASEDIR\n");
if (not -d $BASEDIR) {
dprint ("$BASEDIR does not exists, creating ...\n");
mkdir("$BASEDIR",0770);
}
my $UNAME;
my $OS;
my $OSVER;
my $OSstring;
my $hostname;
my $ua;
my $url;
my @files;
my $sum;
my $file;
my @download_list;
my $filereq;
my $fileresult;
my $exe;
$OS="windows";
my @temp=split(' ', `ver`);
$OSVER=$temp[2];
$OSstring="$OS-$OSVER";
dprint ("Detected $OSstring\n");
# this works for at least solaris and linux
# FIXME: test on HP
#$hostname=`/bin/hostname`;
$hostname=`hostname`;
chomp $hostname;
# Added by cgreer to force resolution to a full name instead of a
# short hostname. This should be a config option.
dprint ("Found hostname: $hostname\n");
if (defined($FORCE_FQDN)) {
use Net::Domain qw(hostname hostfqdn hostdomain);
$hostname=hostfqdn($hostname);
dprint (" ..becomes $hostname\n");
}
# create our UserAgent
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
if ($acd_proxy ne '') {
$ua->proxy('http',$acd_proxy);
}
# Create a request
my $req = new HTTP::Request POST => "$URL";
$req->content_type('application/x-www-form-urlencoded');
# request that the server send us a URL for the
# appropriate OS and OS version. The first line received
# should be a URL containting the path to the os-specific
# files. subsequent lines give current MD5 checksums for
# any files in that directory
if($DEBUG==1) {
$req->content("action=send_file_url&debug=yes&os=$OSstring");
} else {
$req->content("action=send_file_url&os=$OSstring");
}
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if (not $res->is_success) {
print STDERR "send_file_url failed, exiting ...\n";
dprint("Error returned was: ", $res->content);
exit;
} else {
my @content=split ("\n",$res->content);
my @filtered_content=grep(!/^$|^Content-Type/, @content);
($url, @files)=@filtered_content;
dprint ("Main file URL: $url\n");
}
# @files is a list of checksums and files. Use this to determine
# what needs to be downloaded
dprint ("Files:",join('\n',@files),"\n");
foreach (@files) {
($sum,$file)=split " ", $_;
if ( not -f "$BASEDIR\\$file" ) {
dprint ("New file: $file\n");
push @download_list,$file;
} elsif ( checksum($BASEDIR."\\".$file) ne $sum) {
push @download_list,$file;
dprint ("New checksum: $file\n");
}
}
#print "\n";
foreach (@download_list) {
$file=$_;
dprint ("Downloading: $url/$file ... ");
$filereq=new HTTP::Request GET => "$url/$file";
$fileresult=$ua->request($filereq, "$BASEDIR\\$file");
if ($fileresult->is_success) {
dprint ("File grabbed successfully!\n");
} else {
print STDERR "Error grabbing script file: $url/$file\n";
exit;
}
}
my $bigoutput;
my @output;
my $sendresult;
# now, collect the output from the client programs
dprint ("chdir'ing to $BASEDIR\n");
chdir "$BASEDIR";
foreach $exe (glob "*") {
dprint ("Running: $BASEDIR\\$exe\n");
push @output, `$BASEDIR\\$exe`;
}
#construct output
$bigoutput="<machine>
<basic_info>
<hostname>$hostname</hostname>
<os>$OS</os>
<osver>$OSVER</osver>
</basic_info>
" . join('', @output) . "\n</machine>";
#print "$bigoutput\n";
dprint ("Sending this to server: \n$bigoutput\n");
if($SAVE_XML==1) {
open XML,">$BASEDIR\\recent.xml" or die "$BASEDIR\\recent.xml: $!\n";
print XML $bigoutput;
close XML or die "$BASEDIR\\recent.xml: $!\n";
}
# send the output to the server
$req = new HTTP::Request POST => "$URL";
$req->content_type('application/x-www-form-urlencoded');
if($DEBUG==1) {
$req->content("action=accept_data&debug=yes&data=$bigoutput");
} else {
$req->content("action=accept_data&data=$bigoutput");
}
$sendresult=$ua->request($req);
if($sendresult->is_success) {
dprint ("Got back from server: ".$sendresult->content."\n");
}
sub checksum {
my $filename=shift;
open FILE, "$filename" or die "$filename: $!\n";
binmode(FILE);
return Digest::MD5->new->addfile(*FILE)->hexdigest;
}
sub dprint {
if($DEBUG==1) {
print STDERR @_;
}
}
|
|
From: Josh L. <ru...@us...> - 2003-10-14 00:38:55
|
Update of /cvsroot/acd/acd-1/web/arch/windows-2000
In directory sc8-pr-cvs1:/tmp/cvs-serv14498/web/arch/windows-2000
Added Files:
aging.pl cpu.pl diskspace.pl manual_info.pl memory.pl
network_interfaces.pl
Log Message:
New checkin of tmd's windows stuff.
--- NEW FILE: aging.pl ---
# aging.pl
#
# Author: Trevor Dennison
# October 1, 2003
#
# Gets the date Windows was installed on a machine for ACD
use Win32::TieRegistry( Delimiter=>"/" );
#set the module to return dwords as integers rather than hex strings
$Registry->DWordsToHex(0);
#get the install date (it's actually stored as a unix timestamp...)
$age = $Registry->{"LMachine/Software/Microsoft/Windows NT/CurrentVersion/InstallDate"};
#turn the integer install date into a text string
$textAge = unpack("L", $age);
print "<basic_info>\n";
print " <installed>$textAge</installed>\n";
print "</basic_info>\n";
--- NEW FILE: cpu.pl ---
# cpu.pl
#
# Author: Trevor Dennison
# October 1, 2003
#
# Gets the processor information on a Windows machine for ACD
#
# Note: Right now, the architecture is hardcoded to be i686,
# since there's not an easy way to pull this directly out
# of windows. Plus, anything we are running windows on right
# now is Pentium2 or above, so i686.
use Win32::TieRegistry( Delimiter=>"/" );
#set the module to return dwords as integers rather than hex strings
$Registry->DWordsToHex(0);
#get the processor speed
$speed = $Registry->{"LMachine/Hardware/Description/System/CentralProcessor/0/~Mhz"};
#turn the integer processor speed into a text string
$textSpeed = unpack("L", $speed);
#assume that if we are running windows, this is an i686
#(no good way to pull this out of the system directly.)
$arch="i686";
print "<hostinfo>\n";
print " <cpu speed='$textSpeed' architecture='$arch' />\n";
print "</hostinfo>\n";
--- NEW FILE: diskspace.pl ---
# diskspace.pl
#
# Author: Trevor Dennison
# September 30, 2003
#
# Gets the disk space information on a Windows machine for ACD
use Win32::AdminMisc;
@Drives = Win32::AdminMisc::GetDrives(DRIVE_FIXED);
for $drive (@Drives)
{
($DiskSpace, $Free) = Win32::AdminMisc::GetDriveSpace($drive);
$total += $DiskSpace;
}
$total = $total / (1024 * 1024 * 1024); #get total in GB
$total = int($total); #get rid of decimal portion
print " <basic_info>\n";
print " <diskspace>$total</diskspace>\n";
print " </basic_info>\n";
--- NEW FILE: manual_info.pl ---
#!/usr/local/bin/perl
#
# Collect information from the host that is manually maintained in a
# host specific file. The information file should be in a 'field=value'
# format, one per line.
#
use Win32::OLE;
$info_file="C:\\acd\\acd_manual_info";
if (-f $info_file)
{
open (INFO_FILE, $info_file) || die "Could not open $info_file: $!\n";
print " <hostinfo>\n";
print " <manual_info ";
$gotSerial = 0;
while (<INFO_FILE>)
{
@info = split (/=/);
foreach $value (@info) {chomp $value};
print " $info[0]=\"$info[1]\" ";
if($info[0] eq "serial") { $gotSerial = 1; }
}
# if the serial number was not entered in the manual info file,
# then try to get it from the bios
if($gotSerial == 0)
{
$serial = &getSerialFromBios;
if($serial ne "")
{
print " serial=\"$serial\" ";
}
}
print "/>\n";
print " </hostinfo>\n";
}
close INFO_FILE;
# ---------- getSerialFromBios ----------
# gets the serial number of a machine from the bios. This probably
# only works for dells.
#
# The original code that showed me how to do this was a vb script
# at the following webpage:
# http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/compmgmt/ScrCM41.asp
sub getSerialFromBios
{
my $strComputer = ".";
my $class = "winmgmts:{impersonationLevel=impersonate}!\\\\" . $strComputer . "\\root\\cimv2";
my $objWMIService = Win32::OLE->GetObject($class);
my $colSMBIOS = $objWMIService->ExecQuery("Select * from WIN32_SystemEnclosure");
#not sure if it could actually come back with multiple serial
#numbers, but handle it just in case
my $serialNumber = "";
foreach my $object (in $colSMBIOS)
{
if($serialNumber == "")
{
$serialNumber = $object->{SerialNumber};
}
else
{
$serialNumber = $serialNumber . "," . $object->{SerialNumber};
}
}
$serialNumber;
}
--- NEW FILE: memory.pl ---
# memory.pl
#
# Trevor Dennison
# September 30, 2003
#
# Gets the total physical memory from a Windows machine for ACD
use Win32::AdminMisc;
%Memory = Win32::AdminMisc::GetMemoryInfo();
$Total = $Memory{RAMTotal};
$Total = $Total / (1024 * 1024); #get total memory in MB
$Total = int($Total);
print "<basic_info>\n";
print "<ram>$Total</ram>\n";
print "</basic_info>\n";
--- NEW FILE: network_interfaces.pl ---
# network_interfaces.pl
#
# Trevor Dennison
# September 30, 2003
#
# Gets network interface info from a Windows machine for ACD
@ipconfig = `ipconfig /all`;
$interfaceNum = -1;
$device = "";
$ip = "";
$netmask = "";
$mac = "";
&PrintHeader;
for $line (@ipconfig)
{
$_ = $line;
s/^\s+//;
$line = $_;
if(substr($line, 0, 8) eq "Ethernet")
{
#if this is not the first header line, print the info
#(there is no info to print from before the first header)
if($interfaceNum >= 0)
{
&PrintInfo;
}
$interfaceNum += 1;
$device = "win" . $interfaceNum;
$ip = "";
$netmask = "";
$mac = "";
}
elsif(substr($line, 0, 16) eq "Physical Address")
{
@temp = split(/\s+/, $line);
$mac = $temp[-1];
}
elsif(substr($line, 0, 10) eq "IP Address")
{
@temp = split(/\s+/, $line);
$ip = $temp[-1];
}
elsif(substr($line, 0, 11) eq "Subnet Mask")
{
@temp = split(/\s+/, $line);
$netmask = $temp[-1];
}
}
&PrintInfo;
&PrintFooter;
sub PrintHeader
{
print " <hostinfo>\n";
}
sub PrintFooter
{
print " </hostinfo>\n";
}
sub PrintInfo
{
print " <network_interface interface_device='$device' ip='$ip' netmask='$netmask' hardware_address='$mac' />\n";
}
|