Linux 监控网络脚本.docx
- 文档编号:2839117
- 上传时间:2022-11-15
- 格式:DOCX
- 页数:28
- 大小:22.48KB
Linux 监控网络脚本.docx
《Linux 监控网络脚本.docx》由会员分享,可在线阅读,更多相关《Linux 监控网络脚本.docx(28页珍藏版)》请在冰豆网上搜索。
Linux监控网络脚本
#!
/bin/sh
#########################################################################
#
#File:
check_traffic.sh
#Description:
Nagioscheckpluginstochecknetworkinterfacetrafficin*nix.
#Language:
GNUBourne-AgainSHell
#Version:
1.1.6
#Date:
2009-02-20
#Corp.:
Chenlei
#Author:
chnl@(Ucanmsnmewiththis.)
#WWW:
#PerlVersion:
UCanfindtheperl/Net:
:
SNMPVersioninthesamesite.
#########################################################################
#Bugs:
#TheLatestVersionwillbereleasedin.
#Youcansendbugsto,
#oremailtomedirectly:
chnl@
#########################################################################
#Todo:
#Donotuseunitatperformancedata,forpnp/rrdgraphingbetter.
#AddtheHistoryperformancedatafilesupport.(maybe)
#Alsosupportthe-nargs,withinterfacenametocheckthetraffic.
#########################################################################
#ChangeLog:
#
#Version1.2.0
#2010-04-26
#ChangedefaultScalevaluefrom4to2,formorefriendlyoutput.Ifyouwantmoreexcatvalue,Ucanchangeitforyouself.
#FixtheMinIntervalcheckbugs,movethecheckbeforewritethecurrentdatatodatahistfile.
#AddtheMaxIntervalvar,defaultvalueis1800,ifthehistdatafileistooold,droptheresult.
#Fixtheforoutput"Maybe32bitcounteroverflow,becausewegotanegativevaluehere."whenchecktoofrequent.AndsetMin_Intervalto30asdefault.
#Addthe-Foptionforsimpleormoresimple(s/S)outputformat.
#Addthe-ioptionfortheindividualsuffixwiththeCF/STAT_HIST_DATAifnecessary.
#Usethe64bitcounterasdefault,whensnmpversionisv2c.Ifthesystemnotsupportit,use32bitcounterinstead.
#Gettheinterface'sIF-MIB:
:
ifSpeed,ifthetrafficvalueisbiggerthanit,dropitandoutputwithOOPSandexitwithUnkown.
#ModifytheCF_HIST_DATAfilenamefrom"/var/tmp/check_traffic_${Host}_${Interface}.hist_dat"to
#"/var/tmp/check_traffic_${Host}_${Interface}.hist_dat_${USER}_64|32"forresolving1)userand2)64/32bittransferproblemwhichmake1)thehistdatafileread/write
#errorand2)withhugeerrortrafficvalue.
#AddthefunctionfortestingTrafficJitter(Theorginalideacomefrommsnchatwihtwjks@).
#Addaoption-pN,N(from1to12)isanumberthatwecomarethistimevaluewiththeaveragevalueofpreviosNtimeswehadbeenchecked.
#Ifthevaluewecheckedthistimeisnotinourdefinedscope(a%value)with-w/-coptionspecified(suchas-w20,20-c30,30),
#wethinkthatitisatrafficjitter.
#Forthisoption,addafileforstoringthehistdatatostat:
/var/tmp/check_traffic_${Host}_${Interface}.hist_dat_${USER}_64|32_ctj_$Num"
#
#Version1.1.6
#2009-02-20
#FixsomemistakeatperfdataoutputformatwithWarningandCriticalValue.(thanksforJiangShan)
#Removetheredundantcode,mergecodefor--rangeoption.
#Writedatabeforetheexit(forthereasonofIsFirst),forthenexttimeuse.
#Whenwriteorreadfileerror,useUnknowinsteadofWarningseverity.
#Ifgetanegativenetflowortimeintervalvaluehere,exitwithunknow.
#
#Version1.1.5
#2008-09-28
#Fixbugonperfdataoutputformat;
#Fixsomespellingmistake;
#AddtheDefaultValueforUseRangeas"False";
#Version1.1.4
#2008-09-18
#Add-roptions,UseRangeinsteadofsinglevalueinwarningandcriticalThreshold;
#Thisoptionsuggestionbyzhgypg@at
#
#Version1.1.3
#2008-09-17
#SetthedefaultIntervalas12seconds;
#
#Version1.1.2
#2008-08-19
#Checkthesnmpagentsupportthe64bitcounterornot;
#Checktheinterfacestatus,ifnotOK,exitwithCriticalstatus;
#GettheinterfacenamewithInterfaceIndexValue;
#
#Version1.1.1
#2008-08-06
#Fixsomebugsinversioncompare.
#Use-6option,use64bitcounter.
#
#Version1.1.0
#2008-06-11
#Insnmpv2c,usecountersifHC*insteadofif*;
#
#Version1.0.9
#2008-04-22
#Morefriendlyoutputwhengettingsnmpinfoerror.
#
#Version1.0.8
#2008-03-31
#Correctsomespellingmistake
#
#Version1.0.7
#2008-03-28
#Ifit'sthefirsttimetotouchhist_dat,echoOKandTipsout;
#Testthehist_datcanbereadandwrite;
#UsetheVarsfor$OutPutand$PerfData
#Fixsomeoutputformat.
#
#Version1.0.6
#2008-03-25
#CorrectPerformancedataoutputwithWarningandCriticalValueofTotalandIntervalforpnpgraphing.
#
#Version1.0.5
#2008-03-24
#CorrectPerformancedataoutputforpnpgraphing.
#
#Version1.0.4
#2008-03-21
#CorrectPerformancedataoutputto"Nagiosplug-indevelopmentguidelines",
#forGraphingtheperformancedatainthewebwithPNP.
#Thestandardis:
'label'=value[UOM];[warn];[crit];[min];[max]
#
#
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Linux 监控网络脚本 监控 网络 脚本
![提示](https://static.bdocx.com/images/bang_tan.gif)