濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > 批處理實(shí)現(xiàn)的網(wǎng)絡(luò)巡檢腳本(PING與端口掃描)

批處理實(shí)現(xiàn)的網(wǎng)絡(luò)巡檢腳本(PING與端口掃描)

熱門標(biāo)簽:地圖標(biāo)注顯示小區(qū) 江蘇辦理400電話是免費(fèi)的嗎 江蘇手機(jī)外呼系統(tǒng)供應(yīng)商 南京機(jī)器人外呼系統(tǒng)多少錢 沙依巴克工廠地圖標(biāo)注 滄州外呼增值業(yè)務(wù)線路解決方案 紹興400電話怎么辦理 征服者博物館地圖標(biāo)注點(diǎn) 福建防封電銷卡辦理套餐

check.bat 內(nèi)容(腳本內(nèi)容可能會(huì)應(yīng)為排版問(wèn)題不能直接復(fù)制粘帖運(yùn)行,可自行修改):

復(fù)制代碼 代碼如下:

@echo off
rem checklist.csv字段為: IP,名稱,描述,TCP應(yīng)用端口,UDP應(yīng)用端口
rem checklist.csv中請(qǐng)使用,@,替換,, 并不要使用()進(jìn)行內(nèi)容描述
set e_file=error.log
set e_count=0
for /f "skip=1 tokens=1,2,3,4,5* delims=," %%i in (checklist.csv) do call :docheck %%i @%%j @%%k @%%l @%%m
call :report
goto :eof
:docheck
set ip=%1
set name=%2
set name=%name:@=%
set comment=%3
set comment=%comment:@=%
set tcp=%4
set tcp=%tcp:@=%
set udp=%5
set udp=%udp:@=%
ping %ip% -n 3 -w 300 >nul 2>1
if NOT %ERRORLEVEL%==0 (echo %time% %ip%[%name%,%comment%] ping error >>%e_file% set /a e_count=%e_count%+1) else call :portcheck
call :report
goto :eof
:portcheck
if not -%tcp%==- for /f "tokens=1,2,3,4,5,6,7,8,9,10* delims=-" %%i in ("%tcp%") do call :tcpcheck %%i %%j %%k %%l %%m %%n %%o %%p %%q
if not -%udp%==- for /f "tokens=1,2,3,4,5,6,7,8,9,10* delims=-" %%i in ("%udp%") do call :udpcheck %%i %%j %%k %%l %%m %%n %%o %%p %%q
goto :eof
:tcpcheck
if not -%1==- call :tcpquery %1
if not -%2==- call :tcpquery %2
if not -%3==- call :tcpquery %3
if not -%4==- call :tcpquery %4
if not -%5==- call :tcpquery %5
if not -%6==- call :tcpquery %6
if not -%7==- call :tcpquery %7
if not -%8==- call :tcpquery %8
if not -%9==- call :tcpquery %9
goto :eof
:udpcheck
if not -%1==- call :udpquery %1
if not -%2==- call :udpquery %2
if not -%3==- call :udpquery %3
if not -%4==- call :udpquery %4
if not -%5==- call :udpquery %5
if not -%6==- call :udpquery %6
if not -%7==- call :udpquery %7
if not -%8==- call :udpquery %8
if not -%9==- call :udpquery %9
goto :eof
:tcpquery
portqry -n %ip% -e %1 -p tcp || (echo %time% %ip%[%name%,%comment%] tcp port %1 query error >>%e_file% set /a e_count=%e_count%+1)
goto :eof
:udpquery
portqry -n %ip% -e %1 -p udp || (echo %time% %ip%[%name%,%comment%] udp port %1 query error >>%e_file% set /a e_count=%e_count%+1)
goto :eof
:report
echo %e_count%
rem do whatever you want. such as send error.log by mail
goto :eof

checklist.csv樣例:
IP,名稱,描述,TCP應(yīng)用端口,UDP應(yīng)用端口 '兩個(gè)逗號(hào)之間要加入@,描述不能加入括號(hào)(),請(qǐng)用[]替代
192.168.0.1,@,@,@,
192.168.0.3,@,@,@,
192.168.0.9,FTPSERVER,FTP服務(wù)器,135-445-21,
192.168.0.10,TESTSERVER,TESTSERVER,135-445-21,53

標(biāo)簽:巴中 湘西 吳忠 宜賓 烏魯木齊 陽(yáng)泉 香港 小程序

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《批處理實(shí)現(xiàn)的網(wǎng)絡(luò)巡檢腳本(PING與端口掃描)》,本文關(guān)鍵詞  批處理,實(shí)現(xiàn),的,網(wǎng)絡(luò),巡檢,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《批處理實(shí)現(xiàn)的網(wǎng)絡(luò)巡檢腳本(PING與端口掃描)》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于批處理實(shí)現(xiàn)的網(wǎng)絡(luò)巡檢腳本(PING與端口掃描)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    深泽县| 灵武市| 定日县| 波密县| 志丹县| 柳江县| 云阳县| 凤庆县| 德化县| 承德市| 阳朔县| 和林格尔县| 皮山县| 洛阳市| 加查县| 大安市| 韶山市| 互助| 霸州市| 莒南县| 襄城县| 青岛市| 温宿县| 曲阳县| 唐海县| 武山县| 肃北| 都江堰市| 都兰县| 雷州市| 日照市| 伊金霍洛旗| 鄂尔多斯市| 和平区| 徐闻县| 治县。| 秀山| 桐梓县| 巍山| 宁陵县| 丹棱县|