Linux 监控网络脚本.docx

上传人:b****5 文档编号:2839117 上传时间:2022-11-15 格式:DOCX 页数:28 大小:22.48KB
下载 相关 举报
Linux 监控网络脚本.docx_第1页
第1页 / 共28页
Linux 监控网络脚本.docx_第2页
第2页 / 共28页
Linux 监控网络脚本.docx_第3页
第3页 / 共28页
Linux 监控网络脚本.docx_第4页
第4页 / 共28页
Linux 监控网络脚本.docx_第5页
第5页 / 共28页
点击查看更多>>
下载资源
资源描述

Linux 监控网络脚本.docx

《Linux 监控网络脚本.docx》由会员分享,可在线阅读,更多相关《Linux 监控网络脚本.docx(28页珍藏版)》请在冰豆网上搜索。

Linux 监控网络脚本.docx

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]

#

#

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1