Windows zabbix監控遠程進程實現機制

來源:互聯網
上載者:User

標籤:tor   虛擬   hid   strrev   amp   trre   ade   命令   mon   

  最近負責zabbix監控部署方面的工作,需要完成本地服務端監控遠程虛擬機器的運行狀態(CPU、開啟的進程等),與大家分享下我的實現方法。

  (1) 首先,需要實現記錄zabbix用戶端的進程的批處理:zabbix_task.bat;

  zabbix_task.bat內容如下:

  @echo off

  chcp 65001

  tasklist /v |findstr "%username%" > c:/zabbix_temp.txt  #進程路徑根據個人習慣設定

  pause

  (2) 其次,實現即時監控遠端進程的批處理,使用VBS指令碼呼叫指令碼1實現定時重新整理進程,指令碼命名為:zabbix_monitor.vbs

  本地電腦遠程建立遠程電腦的計劃任務程式(當每次登陸時自動運行指令碼zabbix_monitor.vbs),進行即時監控電腦進程

  zabbix_monitor.vbs內容如下:

  Set ws = CreateObject("Wscript.shell")

  do
  ws.run left(Wscritp.Scritpfullname,instrrev(wscript.Scriptfullname,"\")-1)&"\zabbix_task.bat",vbhide

  Wscript.sleep 5000 

  loop

  (3) 最後,實現過濾篩選zabbix服務端需要監控的進程指令碼:zabbix_tasklist.bat

  @echo off

  setlocal enabledelayedexpansion
  chcp 65001
  echo {
  echo "data" :[
  for /f "tokens = 9*" %%i in (c:\zabbix_temp.txt)
  do(
  set "str=%%j"
  set "str=!str:\=\\!"
  if"!str!"=="!str:暫缺=!" if"!str!"=="!str:Wnd=!" if"!str!"=="!str:N/A=!" if"!str!"=="!str:MCI=!" if"!str!"=="!str:dwn=!" if"!str!"=="!str:taskeng=!"   if"!str!"=="!str:KSafeTray=!" if"!str!"=="!str:6EBF21D6BA1F=!" if"!str!"=="!str:jusched=!" if"!str!"=="!str:HwUvPUpgrade=!"                   if"!str!"=="!str:SPES=!" if"!str!"=="!str:Windows Update=!" if"!str!"=="!str:cmd.exe=!" if"!str!"=="!str:SysFader=!"
  echo {"{#TASK_NAME}":"!str!"},
  )
  echo {"{#TASK_NAME}":"NULL"}
  echo]
  echo
  }

 PS:本地電腦訪問遠程電腦建立計劃任務程式,可以使用批處理schtask命令完成訪問遠程電腦 

 

  

  

Windows zabbix監控遠程進程實現機制

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.