Skip to content
Browse files

fixing system status

  • Loading branch information...
1 parent caa7142 commit bd4d567f57b603485a1594c65a47786c97b73d4d @linked committed Jan 21, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 system-status.py
View
10 system-status.py
@@ -1,22 +1,22 @@
import json, time, sys, psutil, urllib
interval = 1
-hw_host = 'localhost:9999'
-health_cat = 'system_status'
+hw_host = 'localhost:8085'
+pk = 'system_status'
def post_health_info():
dimensions = { 'platforms': sys.platform }
metrics = {
'CPU percent': psutil.cpu_percent(),
'RAM (GB)': psutil.phymem_usage().percent,
'HD percent': psutil.disk_usage('/').percent,
}
- url = 'http://%s/update-health?categories=%s&dimensions=%s&metrics=%s'%(
- hw_host, health_cat, json.dumps(dimensions), json.dumps(metrics))
+ url = 'http://%s/count_now?pk=%s&dimensions=%s&metrics=%s'%(
+ hw_host, pk, json.dumps(dimensions), json.dumps(metrics))
print 'GET:',url
data = urllib.urlopen(url).read()
print data
try:
- json.parse(data)
+ json.loads(data)
if 'cmds' in data and data['cmds']:
os.system(data['cmds'])
except Exception,e: print e

0 comments on commit bd4d567

Please sign in to comment.
Something went wrong with that request. Please try again.