Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
e5d62e9c
authored
Mar 09, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
random win fixes
parent
1b60107c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
agent.py
+6
-3
No files found.
agent.py
View file @
e5d62e9c
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
twisted.internet
import
reactor
,
defer
from
twisted.internet.task
import
LoopingCall
from
twisted.internet.serialport
import
SerialPort
import
psutil
import
uptime
import
subprocess
import
fileinput
#import netifaces
import
platform
from
datetime
import
datetime
...
...
@@ -25,7 +24,8 @@ distros = {'Scientific Linux': 'rhel',
'CentOS'
:
'rhel'
,
'Debian'
:
'debian'
,
'Ubuntu'
:
'debian'
}
distro
=
distros
[
platform
.
linux_distribution
()[
0
]]
if
system
==
'Linux'
:
distro
=
distros
[
platform
.
linux_distribution
()[
0
]]
# http://stackoverflow.com/questions/12081310/
...
...
@@ -167,6 +167,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
self
.
lc
.
start
(
5
,
now
=
False
)
def
send_status
(
self
):
import
psutil
# TODO ez azért kell itt van importálva, mert
# windows alatt kilépéskor kressel tőle a python
# így a service azt hiszi, hogy nem indult el rendesen
disk_usage
=
{(
disk
.
device
.
replace
(
'/'
,
'_'
)):
psutil
.
disk_usage
(
disk
.
mountpoint
)
.
percent
for
disk
in
psutil
.
disk_partitions
()}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment