def assets_perform(): params = request.args if request.method == 'GET' else request.form id = params.get('id', '') _asset = Assets.get_by_id(id) datetime_list, cpu_list, ram_list = Performs.get_list(_asset.get('ip')) return render_template('assets_perform.html', datetime_list=json.dumps(datetime_list), cpu_list=json.dumps(cpu_list), ram_list=json.dumps(ram_list))
def assets_perform_monitor(): params = request.args if request.method == 'GET' else request.form id = params.get('id') _asset = Assets.get_by_id(id) datetime_list, cpu_list, ram_list = Performs.get_list(_asset.get('ip')) datetime_end = {} cpu_end = {} ram_end = {} datetime_end['y'] = datetime_list[-1] cpu_end['y'] = cpu_list[-1] ram_end['y'] = ram_list[-1] return jsonify(datetime_end, cpu_end, ram_end)
def performs_cpu(): params = request.args if request.method == 'GET' else request.form type_name = params.get('name') id = params.get('id') _asset = Assets.get_by_id(id) datetime_list, cpu_list, ram_list = Performs.get_list(_asset.get('ip')) if datetime_list: if type_name == 'cpu': end_cpu = cpu_list[-1] return jsonify({'y': end_cpu}) elif type_name == 'ram': end_ram = ram_list[-1] return jsonify({'y': end_ram}) return jsonify({'y': 0})
def assets__conssh(): params = request.args if request.method == 'GET' else request.form id = params.get('id') result = Assets.get_by_id(id) return render_template('assets_conssh.html', result=result)
def assets_modify(): params = request.args if request.method == 'GET' else request.form id = params.get('id') result = Assets.get_by_id(id) _idcs = Assets.get_idc_name() return render_template('assets_modify.html', result=result, idcs=_idcs)