예제 #1
0
 def send_statistics():
     req = mq.Request('speedd')
     while not self._exit:
         msg = {'cmd': 'statistics', 'params':{'time': 'last'}}
         try:
             stat = req.request(msg, 1000)
             self.emit('statistics', stat['sample'])
         except:
             pass
         gevent.sleep(config.statd.interval)
예제 #2
0
def query_zero_progress():
    req = mq.Request('zerod')
    try:
        rsp = req.request({'cmd': 'query_zero_progress'}, 10000)
        if 'success' in rsp['status']:
            return rsp['detail']
        else:
            raise Exception()
    finally:
        req.close()
예제 #3
0
 def temp_alert(self):
     try:
         req = mq.Request('speedd')
         msg = {'cmd': 'statistics', 'params':{'time': 'last'}}
         stat = req.request(msg, 1000)
         temp = stat['sample']['temp']
         if temp >= config.alert.temp_threshold:
             return 'warning', temp
         else:
             return 'normal', temp
     except:
         return 'warning', 'NA'
예제 #4
0
def query_sync_progress(name):
    req = mq.Request('syncd')
    try:
        #import pdb
        #pdb.set_trace()
        rsp = req.request({'cmd': 'query_sync_progress', 'name': name}, 10000)
        if rsp and rsp['status'] == 'success':
            if rsp.has_key('detail'):
                return rsp['detail']
            else:
                return None
        else:
            raise Exception()
    finally:
        req.close()
예제 #5
0
def stop_beep(mod):
    req = mq.Request('beepd')
    try:
        req.request({'cmd': 'stop_beep', 'mod': mod}, 10000)
    finally:
        req.close()
예제 #6
0
def delete_sync_volume_task(name):
    req = mq.Request('syncd')
    try:
        req.request({'cmd': 'delete_sync_volume_task', 'name': name}, 10000)
    finally:
        req.close()
예제 #7
0
def stop_sync_volume(name):
    req = mq.Request('syncd')
    try:
        req.request({'cmd': 'stop_sync_volume', 'name': name}, 10000)
    finally:
        req.close()
예제 #8
0
def zero_disks():
    req = mq.Request('zerod')
    try:
        req.request({'cmd': 'zero_disks'}, 10000)
    finally:
        req.close()