91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 12KB
    文件類型: .py
    金幣: 1
    下載: 1 次
    發(fā)布日期: 2022-10-06
  • 語言: Python
  • 標簽: snmp??

資源簡介

GUI實現(xiàn)Net-SNMP監(jiān)控主機CPU等信息代碼,網(wǎng)絡(luò)安全管理課程代碼。開發(fā) GUI 界面程序,使用戶可通過控制臺程序觀察主機 CPU、內(nèi)存、硬盤空間、流量值;開發(fā)閾值告警功能,用戶通過界面可設(shè)置性能閾值(如 CPU),當超過閾值時自動報警。在控制臺動態(tài)顯示主機 CPU、內(nèi)存利用曲線。

資源截圖

代碼片段和文件信息

#!/usr/bin/env?python
#-*-?coding:utf-8?-*-

import?os?sys
from?tkinter?import?*
from?tkinter.font?import?Font
from?tkinter.ttk?import?*
from?tkinter.messagebox?import?*
import?tkinter.messagebox
import?numpy?as?np??
import?matplotlib.pyplot?as?plt??
import?time??
import?matplotlib??
from?matplotlib.backends.backend_tkagg?import?FigureCanvasTkAgg??
from?matplotlib.figure?import?Figure??
????#import?tkinter.filedialog?as?tkFileDialog
????#import?tkinter.simpledialog?as?tkSimpleDialog????#askstring()

class?Application_ui(frame):
????#這個類僅實現(xiàn)界面生成功能,具體事件處理代碼在子類Application中。
????def?__init__(selfhost?master=None):
????????
????????frame.__init__(self?master)
????????self.master.title(‘Form1‘)
????????self.master.geometry(‘800x800‘)
????????self.createWidgets(host)
????????self.boolcurve=True

????def?createWidgets(selfhost):
????????self.CPU_threshhold=100.0
????????self.top?=?self.winfo_toplevel()

????????self.style?=?style()

????????self.drawPicf?=?Figure(figsize=(13.54)?dpi=50)??
????????self.drawPiccanvas?=?FigureCanvasTkAgg(self.drawPicf?master=self.top)???
????????self.drawPiccanvas.draw()???
????????self.drawPiccanvas.get_tk_widget().pack(anchor?=‘se‘side=BOTTOM)

????????self.drawPicfC?=?Figure(figsize=(13.54)?dpi=50)??
????????self.drawPiccanvasC?=?FigureCanvasTkAgg(self.drawPicfC?master=self.top)???
????????self.drawPiccanvasC.draw()???
????????self.drawPiccanvasC.get_tk_widget().pack(anchor?=‘se‘side=BOTTOM)

????????self.Text1Var?=?StringVar(value=‘例如:1.3.6.1.2.1.1.1.0‘)
????????self.Text1?=?Entry(self.top?text=‘Text1‘?textvariable=self.Text1Var?font=(‘宋體‘9))
????????self.Text1.place(relx=0.117?rely=0.029?relwidth=0.226?relheight=0.074)

????????self.TextCPUVar?=?StringVar(value=‘CPU閾值(%)‘)
????????self.TextCPU?=?Entry(self.top?text=‘TextCPU‘?textvariable=self.TextCPUVar?font=(‘宋體‘9))
????????self.TextCPU.place(relx=0.117?rely=0.429?width=180?height=30)

????????self.style.configure(‘Command1.TButton‘font=(‘宋體‘9))
????????self.Command1?=?Button(self.top?text=‘結(jié)果‘?command=lambda:self.Command1_Cmd(host)?style=‘Command1.TButton‘)????????
????????self.Command1.place(relx=0.01?rely=0.08?width=80?height=30)

????????self.style.configure(‘Command3.TButton‘font=(‘宋體‘9))
????????self.Command3?=?Button(self.top?text=‘CPU閾值設(shè)定‘?command=self.info_warn_err?style=‘Command3.TButton‘)?????
????????self.Command3.place(relx=0.01?rely=0.429?width=80?height=30)

????????self.style.configure(‘Command4.TButton‘font=(‘宋體‘9))
????????self.Command4?=?Button(self.top?text=‘曲線開始/停止‘?command=lambda:self.stopcurve()?style=‘Command4.TButton‘)?????
????????self.Command4.place(relx=0.01?rely=0.63?width=90?height=30)

????????#?self.style.configure(‘Command4.TButton‘font=(‘宋體‘9))
????????#?self.Command7?=?Button(self.top?text=‘曲線‘?command=lambda:self.refresh()?style=‘Command7.TButton‘)?????
????????#?self.Command7.place(relx=0.01?rely=0.73?width=80

評論

共有 條評論

相關(guān)資源