mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-14 07:22:18 +03:00
registration parameters were extended
This commit is contained in:
parent
daa078c90d
commit
80579a1875
1 changed files with 24 additions and 1 deletions
|
@ -7,6 +7,8 @@ import json
|
||||||
import socket
|
import socket
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
import psutil
|
||||||
from uuid import getnode as get_mac
|
from uuid import getnode as get_mac
|
||||||
|
|
||||||
from base.Scope import Scope
|
from base.Scope import Scope
|
||||||
|
@ -97,11 +99,32 @@ class Registration():
|
||||||
params = {
|
params = {
|
||||||
'ipAddresses': str(self.get_ip_address()),
|
'ipAddresses': str(self.get_ip_address()),
|
||||||
'macAddresses': str(':'.join(("%012X" % get_mac())[i:i + 2] for i in range(0, 12, 2))),
|
'macAddresses': str(':'.join(("%012X" % get_mac())[i:i + 2] for i in range(0, 12, 2))),
|
||||||
'hostname': str(socket.gethostname())
|
'hostname': str(socket.gethostname()),
|
||||||
|
'system':str(platform.system()),
|
||||||
|
'node':str(platform.node()),
|
||||||
|
'release':str(platform.release()),
|
||||||
|
'version':str(platform.version()),
|
||||||
|
'machine':str(platform.machine()),
|
||||||
|
'processor':str(platform.processor()),
|
||||||
|
'architecture':str(platform.architecture()),
|
||||||
|
'cpuCount':str(psutil.cpu_count()),
|
||||||
|
'diskInfo':self.get_disks()
|
||||||
}
|
}
|
||||||
|
|
||||||
return json.dumps(params)
|
return json.dumps(params)
|
||||||
|
|
||||||
|
def get_disks(self):
|
||||||
|
disk_info = []
|
||||||
|
for _disk in psutil.disk_partitions():
|
||||||
|
disk = {}
|
||||||
|
disk['device'] = str(_disk[0])
|
||||||
|
disk['mountPoint'] = str(_disk[1])
|
||||||
|
disk['fsType'] = str(_disk[2])
|
||||||
|
disk['opts'] = str(_disk[3])
|
||||||
|
json_data = json.dumps(disk)
|
||||||
|
disk_info.append(json_data)
|
||||||
|
return disk_info
|
||||||
|
|
||||||
def unregister(self):
|
def unregister(self):
|
||||||
self.logger.debug('[Registration] Ahenk is unregistering...')
|
self.logger.debug('[Registration] Ahenk is unregistering...')
|
||||||
self.db_service.delete('registration', ' 1==1 ')
|
self.db_service.delete('registration', ' 1==1 ')
|
||||||
|
|
Loading…
Reference in a new issue