-
Notifications
You must be signed in to change notification settings - Fork 1
/
GetAllInformation.py
64 lines (38 loc) · 1.38 KB
/
GetAllInformation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import psutil
# the Process Information data ...
def getProcessHeader():
process_header = ['Process Name', 'User', '% CPU', 'ID', 'Status']
return process_header
# getting Information about the Process
def getProcessInfo():
process_info = []
for proc in psutil.process_iter(attrs=['pid', 'name', 'username']):
list_info = list()
p = psutil.Process(int(proc.info['pid']))
list_info.append(proc.info['name'])
list_info.append(proc.info['username'])
list_info.append(p.cpu_percent())
list_info.append(proc.info['pid'])
list_info.append(p.status())
process_info.append(tuple(list_info))
return process_info
def getFSHeader():
FS_Header = ['Device', 'Directory', 'Type', 'Total', 'Available', 'Used', '%']
return FS_Header
# getting Information about the Process
def getFSInfo():
FS_info = []
check = psutil.disk_partitions(all=True)
for item in check:
list_info = list()
list_info.append(item.device)
list_info.append(item.mountpoint)
list_info.append(item.fstype)
percent = psutil.disk_usage(item.mountpoint)
list_info.append(percent.total)
list_info.append(percent.free)
list_info.append(percent.used)
list_info.append(percent.percent)
FS_info.append(tuple(list_info))
print(FS_info)
return FS_info