Compare commits

..

7 Commits

1
.gitignore vendored

@ -0,0 +1 @@
pylsa_sfx.py

@ -0,0 +1,9 @@
cd installer
echo "Copying needed files for SFX..."
mkdir src/
cp ../script/daemon.py src/
echo "Creating SFX..."
tar -czf - * | pysfx -as "python install.py" - ../pylsa_sfx.py
echo "Removing copied files..."
rm -rf src
cd ..

@ -86,7 +86,7 @@ def add_user(uname):
grp.seek(0, 2) grp.seek(0, 2)
setuplib.create_directory("/home/%s" % uname, True, new_uid, new_gid, "u+rwx g+rx") setuplib.create_directory("/home/%s" % uname, True, new_uid, new_gid, "u+rwx g+rx")
passwd.write("%s::%d:%d::/home/cvm:/bin/false\n" % (uname, new_uid, new_gid)) passwd.write("%s::%d:%d::/home/pylsa:/bin/false\n" % (uname, new_uid, new_gid))
grp.write("%s::%d:\n" % (uname, new_gid)) grp.write("%s::%d:\n" % (uname, new_gid))
# We're done with /etc/passwd and /etc/group # We're done with /etc/passwd and /etc/group

@ -15,7 +15,7 @@ bind_ip = ""
port = 8081 port = 8081
def generate_stats(get_processes): def generate_stats(get_processes):
listed_filesystems = ["ext2", "ext3", "ext4", "reiserfs", "removable", "fixed", "simfs"] listed_filesystems = ["ext2", "ext3", "ext4", "reiserfs", "removable", "fixed", "simfs", "xfs"]
mem = psutil.virtual_memory() mem = psutil.virtual_memory()
swap = psutil.swap_memory() swap = psutil.swap_memory()
@ -33,8 +33,10 @@ def generate_stats(get_processes):
"free": usage.free "free": usage.free
} }
uptime = (datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME))
return_data = { return_data = {
"uptime": (datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME)).total_seconds(), "uptime": (uptime.microseconds + (uptime.seconds + uptime.days * 24 * 3600) * 10**6) / 10**6,
"memory": { "memory": {
"total": mem.total, "total": mem.total,
"available": mem.available, "available": mem.available,
@ -49,7 +51,8 @@ def generate_stats(get_processes):
"out": swap.sout "out": swap.sout
}, },
"disk": disks, "disk": disks,
"cpu": psutil.cpu_percent(percpu=True) "cpu": psutil.cpu_percent(percpu=True),
"load": list(os.getloadavg())
} }
if get_processes: if get_processes:

Loading…
Cancel
Save