-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventar_OO_1_Initial.py
More file actions
52 lines (44 loc) · 1.09 KB
/
Inventar_OO_1_Initial.py
File metadata and controls
52 lines (44 loc) · 1.09 KB
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
#!/usr/local/bin/python3
##############################################
#
# Name: Inventar_1_Initial.py
#
# Author: Peter Christen
#
# Version: 1.0
#
# Date: 10.06.2017
#
# Purpose: Server Inventar Script
# Basis Script
#
##############################################
import platform,os,time
####Klassen
class Server:
#Klassenvariable
timestamp=time.time()
#Konstruktor Methode
def __init__(self,name):
#Attribute
self.name=name
self.nrcpu=os.cpu_count()
self.system=platform.system()
self.release=platform.release()
self.machine=platform.machine()
#Weitere Methode
def showdata(self):
print ("\nServer Angaben\n##############")
print ("Name:", self.name)
print ("Nr.CPU:", self.nrcpu)
print ("System:", self.system)
print ("Release:", self.release)
print ("Machine:", self.machine)
print ("Timestamp:", int(self.timestamp))
#Destruktor Methode
def __del__(self):
print ("\nLösche", self.name, "wieder")
####Objekt erfassen
server=Server(platform.node())
####Daten ausgeben
server.showdata()