ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/learning/lgflcntrold.py
Revision: 591
Committed: Tue Nov 3 22:45:12 2015 UTC (10 years, 4 months ago) by nino.borges
Content type: text/x-python
File size: 1768 byte(s)
Log Message:
Moved dir out of main dir.

File Contents

# Content
1 # This program will take a particular log file from all of the app shares, count
2 # the entries in them and make a table with the results of each server and the total.
3 # It was initially created for the IE problems and comparing
4 # the wuurl.log file we made from the today.bat file but could be modified to
5 # ask what file you would like it to count.
6 # Eborges
7 # 10.12.01
8
9 import sys, os
10
11 outeroffices =("atl","bal","cha","chi","clt","jac","nor","nyc","pit","tys","was")
12 richmond =("ric3","ric4","ric5","ric6","ric7","ric8","anxfnb","mwcllc")
13 selection =0
14 os.system('cls')
15 while selection <1 or selection >3:
16 selection = input("Select the scope.\n 1 for Richmond only \n 2 for wan only \n 3 for all \n")
17 if selection == 1:
18 appservers = richmond
19 if selection == 2:
20 appservers = outeroffices
21 if selection == 3:
22 appservers = richmond + outeroffices
23 if selection >3 or selection <1:
24 print "Select either 1,2 or 3 dumbass \n Try again \n \n"
25
26
27 print "Office/Floor \t | Number of people with problem"
28 print "-----------------------------------------------"
29
30 total = 0
31 for x in appservers:
32 directory = "/app/tmp/wuurl.log"
33 place = "//" + x + directory
34 f=open(place, 'r')
35 contents = f.readlines()
36 f.close()
37 amount = len(contents)
38 total = total + amount
39 print x, "\t \t | \t", amount
40 #for n in contents:
41 #seconddir = "/admin$"
42 #secondplace = "//" + n + sconddir
43 #secondfile=open (secondplace, 'r')
44 #secondcontents = secondfile.readlines()
45 #os.system("find -i
46 #report printing
47 #print servers /n
48 print '-----------------------------------------------'
49 print '\nTotal\t\t | \t', total
50 print '\n done!'