From 0f95b5db21e8a9247834befa21fe56b8d9f7e16e Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Mon, 9 Jan 2006 23:12:33 +0000 Subject: made changes to get rid of hostinfo.xml file have GenerateHostInfo update clients.xml git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1659 ce84e21b-d406-0410-9b95-82705330c041 --- reports/xsl-transforms/nodes-digest-www.xsl | 40 +++++++++++----------- reports/xsl-transforms/overview-stats-rss.xsl | 28 +++++++-------- reports/xsl-transforms/timing-summary-www.xsl | 4 +-- .../xsl-transform-includes/html-templates.xsl | 4 +-- .../xsl-transform-includes/text-templates.xsl | 2 +- src/sbin/GenerateHostInfo | 20 ++++++----- src/sbin/StatReports | 15 ++++---- 7 files changed, 57 insertions(+), 56 deletions(-) diff --git a/reports/xsl-transforms/nodes-digest-www.xsl b/reports/xsl-transforms/nodes-digest-www.xsl index 9585738c9..95026120f 100644 --- a/reports/xsl-transforms/nodes-digest-www.xsl +++ b/reports/xsl-transforms/nodes-digest-www.xsl @@ -10,8 +10,8 @@ - - + + @@ -48,10 +48,10 @@
    - +
  • Node: -
  • +
@@ -64,10 +64,10 @@
    - +
  • Node: -
  • +
@@ -79,10 +79,10 @@ nodes have extra configuration. (includes both good and bad nodes)
    - +
  • Node: -
  • +
@@ -96,10 +96,10 @@
    - +
  • Node: -
  • +
@@ -111,10 +111,10 @@ nodes did not run within the last 24 hours but were pingable.
    - - + +
  • Node: -
  • +
@@ -127,10 +127,10 @@
    - +
  • Node: -
  • +
@@ -138,16 +138,16 @@ - +
- nodes were down.
+ nodes were down.
    - - + +
  • Node: -
  • +
diff --git a/reports/xsl-transforms/overview-stats-rss.xsl b/reports/xsl-transforms/overview-stats-rss.xsl index c4c689a99..1df5e29cf 100644 --- a/reports/xsl-transforms/overview-stats-rss.xsl +++ b/reports/xsl-transforms/overview-stats-rss.xsl @@ -12,8 +12,8 @@ Report Run @ - - + + Summary: nodes are clean. @@ -30,9 +30,9 @@ Summary: CLEAN: - + - + @@ -42,9 +42,9 @@ CLEAN: DIRTY: - + - + @@ -54,9 +54,9 @@ DIRTY: MODIFIED: - + - + @@ -67,9 +67,9 @@ MODIFIED: STALE: - - - + + + @@ -80,9 +80,9 @@ STALE: UNPINGABLE: - - - + + + diff --git a/reports/xsl-transforms/timing-summary-www.xsl b/reports/xsl-transforms/timing-summary-www.xsl index 838995243..2b8b94699 100644 --- a/reports/xsl-transforms/timing-summary-www.xsl +++ b/reports/xsl-transforms/timing-summary-www.xsl @@ -36,7 +36,7 @@ Total - + @@ -54,7 +54,7 @@ - + diff --git a/reports/xsl-transforms/xsl-transform-includes/html-templates.xsl b/reports/xsl-transforms/xsl-transform-includes/html-templates.xsl index 45f85c592..7e9e08055 100644 --- a/reports/xsl-transforms/xsl-transform-includes/html-templates.xsl +++ b/reports/xsl-transforms/xsl-transform-includes/html-templates.xsl @@ -3,10 +3,10 @@ -
+
Time Ran: () -

Node:

+

Node:

diff --git a/reports/xsl-transforms/xsl-transform-includes/text-templates.xsl b/reports/xsl-transforms/xsl-transform-includes/text-templates.xsl index c346b8bec..8b820415b 100644 --- a/reports/xsl-transforms/xsl-transform-includes/text-templates.xsl +++ b/reports/xsl-transforms/xsl-transform-includes/text-templates.xsl @@ -5,7 +5,7 @@ - Node: + Node: Time Ran: . () diff --git a/src/sbin/GenerateHostInfo b/src/sbin/GenerateHostInfo index 04d257e8a..e6d166877 100644 --- a/src/sbin/GenerateHostInfo +++ b/src/sbin/GenerateHostInfo @@ -31,14 +31,14 @@ if __name__ == '__main__': c = ConfigParser() c.read(['/etc/bcfg2.conf']) configpath = "%s/etc/report-configuration.xml" % c.get('server', 'repository') - hostinfopath = "%s/etc/hostinfo.xml" % c.get('server', 'repository') - metadatapath = "%s/etc/metadata.xml" % c.get('server', 'repository') + #hostinfopath = "%s/etc/hostinfo.xml" % c.get('server', 'repository') + clientdatapath = "%s/Metadata/clients.xml" % c.get('server', 'repository') sendmailpath = c.get('statistics','sendmailpath') - metaElement = parse(metadatapath) - hostlist = [client.get('name') for client in metaElement.findall("Client")] + clientElement = parse(clientdatapath) + hostlist = [client.get('name') for client in clientElement.findall("Client")] - HostInfo = Element("HostInformation") + #HostInfo = Element("HostInformation") pids = {} fullnames = {} null = open('/dev/null', 'w+') @@ -60,17 +60,19 @@ if __name__ == '__main__': chost = pids[cpid] del pids[cpid] if status == 0: - SubElement(HostInfo, "HostInfo", name=chost, fqdn=chost, pingable='Y') + #SubElement(HostInfo, "HostInfo", name=chost, fqdn=chost, pingable='Y') + clientElement.xpath("/Clients/Client[@name=%s]"%chost).set("pingable",'Y') else: if chost.count('.') > 0: fullnames[chost.split('.')[0]] = chost hostlist.append(chost.split('.')[0]) else: - SubElement(HostInfo, "HostInfo", name=fullnames[chost], fqdn=fullnames[chost], pingable='N') + #SubElement(HostInfo, "HostInfo", name=fullnames[chost], fqdn=fullnames[chost], pingable='N') + clientElement.xpath("/Clients/Client[@name=%s]"%chost).set("pingable",'N') except: pass - fout = open(hostinfopath, 'w') - fout.write(pretty_print(HostInfo)) + fout = open(clientdatapath, 'w') + fout.write(pretty_print(clientElement)) fout.close() diff --git a/src/sbin/StatReports b/src/sbin/StatReports index 439998718..d08d38a57 100644 --- a/src/sbin/StatReports +++ b/src/sbin/StatReports @@ -30,8 +30,7 @@ def generatereport(rspec, nrpt): pattern = re.compile( '|'.join([item.get("name") for item in reportspec.findall('Machine')])) for node in nodereprt.findall('Node'): - if not (node.findall("HostInfo") and node.findall("Statistics") and - node.find("HostInfo").get("fqdn") and pattern.match(node.get('name'))): + if not (node.findall("Statistics") and pattern.match(node.get('name'))): # don't know enough about node nodereprt.remove(node) continue @@ -173,12 +172,12 @@ if __name__ == '__main__': #See if hostinfo.xml exists, and is less than 23.5 hours old - try: - hostinstat = os.stat(hostinfopath) - if (time() - hostinstat[9])/(60*60) > 23.5: - os.system('GenerateHostInfo')#Generate HostInfo needs to be in path - except OSError: - os.system('GenerateHostInfo')#Generate HostInfo needs to be in path + #try: + #hostinstat = os.stat(hostinfopath) + #if (time() - hostinstat[9])/(60*60) > 23.5: + os.system('GenerateHostInfo')#Generate HostInfo needs to be in path + #except OSError: + # os.system('GenerateHostInfo')#Generate HostInfo needs to be in path '''Reads Data & Config files''' -- cgit v1.2.3-1-g7c22