Example #1
0
    def exe(self):
        obj = PluginManager()
        server_dict = obj.exec_plugin()
        new_hostname = server_dict['basic']['data']['hostname']
        cert_path = os.path.join(settings.BASEDIR, 'conf', 'cert.txt')

        f = open(cert_path, mode='r')
        old_hostname = f.read()
        f.close()

        if not old_hostname:
            """第一次运行"""
            with open(cert_path, mode='w') as ff:
                ff.write(new_hostname)
        else:
            server_dict['basic']['data']['hostname'] = old_hostname
        print('[%s]POST [client info] to server' %
              datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
        # 将client端信息发送给server
        rep = self.post_server_info(server_dict)
        # 查询server端返回结果是否有ssd任务要执行
        task_list = rep.get('task', None)
        # 查询server端返回结果是否有任务要执行
        server_task_list = rep.get('stask', None)
        if task_list:
            self.post_task_res(task_list)
        if server_task_list:
            self.post_stask_res(server_task_list)
Example #2
0
 def exe(self):
     '''
     执行上报client硬件信息
     :return:
     '''
     obj = PluginManager()
     server_dict = obj.exec_plugin()
     server_dict['cert_id'] = self.cert_id
     # 将client端信息发送给server
     rep = self.post_info(server_dict, self.api, 'Client_Info')
Example #3
0
    def exec(self):
        obj = PluginManager()
        server_dict = obj.exec_plugin()
        new_hostname = server_dict['basic']['data']['hostname']
        cert_path = os.path.join(settings.BASEDIR, 'conf', 'cert')

        f = open(cert_path, mode='r')
        old_hostname = f.read()
        f.close()

        if not old_hostname:
            """第一次运行"""
            with open(cert_path, mode='w') as ff:
                ff.write(new_hostname)
        else:
            server_dict['basic']['data']['hostname'] = old_hostname
        print('采集到的服务器信息:', server_dict)
        self.post_server_info(server_dict)
Example #4
0
 def tesk(self, host):
     obj = PluginManager(host)
     server_dic = obj.exec_plugin()
     self.post_server_info(server_dic)
Example #5
0
 def exec(self):
     obj = PluginManager()
     server_dic = obj.exec_plugin()
     self.post_server_info(server_dic)