linux snmp 脚本,linux 上的 snmp服务客户端开启需要的设置脚本

## sec.name source community 这里需要指定snmp服务器

com2sec http 59.34.XX.XX(#snmp-ip) public

## group.name sec.model sec.name

group MyROGroup any http

# incl/excl

subtree mask

view all included .1 80

## context sec.model sec.level prefix

read write notif

access

MyROGroup "" any noauth 0 all none none

syslocation Unknown (edit /etc/snmp/snmpd.conf)

syscontact Root

(configure /etc/snmp/snmp.local.conf)

# Example output of snmpwalk:

% snmpwalk -v 1 localhost -c

public system

system.sysDescr.0 = "SunOS

name sun4c"

system.sysObjectID.0 = OID:

enterprises.ucdavis.ucdSnmpAgent.sunos4

system.sysUpTime.0 =

Timeticks: (595637548) 68 days, 22:32:55

system.sysContact.0 =

"xxle71@ovi.com"

system.sysName.0 =

"name"

system.sysLocation.0 = "Right

here, right now."

system.sysServices.0 = 72

# load average checks

#

load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]

#

# 1MAX: If the 1 minute load

average is above this limit at query

# time, the errorFlag will be set.

# 5MAX: Similar, but for 5 min

average.

# 15MAX: Similar, but for 15 min average.

# Check for loads:

load 12 14 14

% snmpwalk -v 1 localhost -c public

.1.3.6.1.4.1.2021.10

enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1

= 1

enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2

= 2

enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3

= 3

enterprises.ucdavis.loadTable.laEntry.loadaveNames.1

= "Load-1"

enterprises.ucdavis.loadTable.laEntry.loadaveNames.2

= "Load-5"

enterprises.ucdavis.loadTable.laEntry.loadaveNames.3

= "Load-15"

enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1

= "0.49" Hex: 30 2E 34 39

enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2

= "0.31" Hex: 30 2E 33 31

enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3

= "0.26" Hex: 30 2E 32 36

enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1

= "12.00"

enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2

= "14.00"

enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3

= "14.00"

enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1

= 0

enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2

= 0

enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3

= 0

enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1

= ""

enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2

= ""

enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3

= ""

###############################################################################

# disk checks

#

# The agent can check the amount of available disk space, and

make

# sure it is above a set limit.

# disk PATH [MIN=100000]

#

# PATH: mount path to the disk in question.

# MIN: Disks with space below

this value will have the Mib's errorFlag set.

# Default value = 100000.

# Check the / partition and make sure it contains at least 10

megs.

disk / 10000

% snmpwalk -v 1 localhost -c public

.1.3.6.1.4.1.2021.9

enterprises.ucdavis.diskTable.dskEntry.diskIndex.1

= 0

enterprises.ucdavis.diskTable.dskEntry.diskPath.1

= "/" Hex: 2F

enterprises.ucdavis.diskTable.dskEntry.diskDevice.1

= "/dev/dsk/c201d6s0"

enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1

= 10000

enterprises.ucdavis.diskTable.dskEntry.diskTotal.1

= 837130

enterprises.ucdavis.diskTable.dskEntry.diskAvail.1

= 316325

enterprises.ucdavis.diskTable.dskEntry.diskUsed.1

= 437092

enterprises.ucdavis.diskTable.dskEntry.diskPercent.1

= 58

enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1

= 0

enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1

= ""

#

-----------------------------------------------------------------------------

###############################################################################

# Process checks.

#

# The following are examples of how to use the

agent to check for

# processes running on the

host. The syntax looks something like:

#

# proc NAME [MAX=0] [MIN=0]

#

# NAME: the name of the process

to check for. It must match

# exactly (ie, http will not find httpd processes).

# MAX: the

maximum number allowed to be running. Defaults to

0.

# MIN: the

minimum number to be running. Defaults to 0.

#

# Examples (commented out by default):

#

# Make sure mountd is running

proc mountd

# Make sure there are no more than 4 ntalkds

running, but 0 is ok too.

proc ntalkd 4

# Make sure at least one sendmail, but less

than or equal to 10 are running.

proc sendmail 10 1

# A snmpwalk of the process mib tree would

look something like this:

#

% snmpwalk -v 1 localhost -c public

.1.3.6.1.4.1.2021.2

enterprises.ucdavis.procTable.prEntry.prIndex.1 =

1

enterprises.ucdavis.procTable.prEntry.prIndex.2 =

2

enterprises.ucdavis.procTable.prEntry.prIndex.3 =

3

enterprises.ucdavis.procTable.prEntry.prNames.1 =

"mountd"

enterprises.ucdavis.procTable.prEntry.prNames.2 =

"ntalkd"

enterprises.ucdavis.procTable.prEntry.prNames.3 =

"sendmail"

enterprises.ucdavis.procTable.prEntry.prMin.1 =

0

enterprises.ucdavis.procTable.prEntry.prMin.2 =

0

enterprises.ucdavis.procTable.prEntry.prMin.3 =

1

enterprises.ucdavis.procTable.prEntry.prMax.1 =

0

enterprises.ucdavis.procTable.prEntry.prMax.2 =

4

enterprises.ucdavis.procTable.prEntry.prMax.3 =

10

enterprises.ucdavis.procTable.prEntry.prCount.1 =

0

enterprises.ucdavis.procTable.prEntry.prCount.2 =

0

enterprises.ucdavis.procTable.prEntry.prCount.3 =

1

enterprises.ucdavis.procTable.prEntry.prErrorFlag.1

= 1

enterprises.ucdavis.procTable.prEntry.prErrorFlag.2

= 0

enterprises.ucdavis.procTable.prEntry.prErrorFlag.3

= 0

enterprises.ucdavis.procTable.prEntry.prErrMessage.1

= "No mountd process running."

enterprises.ucdavis.procTable.prEntry.prErrMessage.2

= ""

enterprises.ucdavis.procTable.prEntry.prErrMessage.3

= ""

enterprises.ucdavis.procTable.prEntry.prErrFix.1

= 0

enterprises.ucdavis.procTable.prEntry.prErrFix.2

= 0

enterprises.ucdavis.procTable.prEntry.prErrFix.3

= 0

#

# Note that the errorFlag for mountd is set to 1

because one is not

# running (in this case an rpc.mountd is, but

thats not good enough),

# and the ErrMessage tells you what's

wrong. The configuration

# imposed in the snmpd.conf file is also

shown. #

# Special Case: When the min

and max numbers are both 0, it assumes

# you want a max of infinity and a min of

1.

#

#

-----------------------------------------------------------------------------

linux环境下的snmp测试脚本, Installing SNMPv2C Agent Conformance Test Package 2008/04/08 IPv6 Promotion Council Terminology =========== Tester Node (TN) A tester node for the conformance tests. Node Under Test (NUT) A testee node for the conformance tests. Network Under Test The network where the conformance tests are executed. Tester Interface The network interface of TN hooked up to the Network Under Test. Interface Under Test The network interface of NUT hooked up to the Network Under Test. Prerequisites ============= Prerequisites for TN: - The package supports FreeBSD 6.0-RELEASE or higher version. - The package can also coexist with FreeBSD version of KAME. Installing the package onto TN ============================== 0. Before Starting (A) You need to install following softwares. - Perl (Required version : 5.8.7 or higher) - Net-SNMP (Required version : 5.3.1 or higher) *** You can download it from the following URL: http://net-snmp.sourceforge.net/ - v6eval (Required version : 3.0.11 or higher) Please refer to 00README.v6eval in "v6eval" for more information. *** You can download it from the following URL: http://www.tahi.org/release/ - koi (Required version : 1.1.1 or higher) Please refer to README file in "koi" package for more information. *** You can download it from the following URL: http://www.tahi.org/release/ 1. Extracting ct package % tar zxvf ct-snmpv2c-ag-X.X.tar.gz 2. Copying ct package Copy ct directory to any directory you like. % cp -pR $ORGDIR/ct-snmpv2c-ag-X.X $SOMEWHERE/ct-snmpv2c-ag-X.X % chmod -R +w $SOMEWHERE/ct-snmpv2c-ag-X.X 4. Setup ct environment % (enable TN's ipv6 capibility) % cd $SOMEWHERE/ct-snmpv2c-ag-X.X % edit config.txt % make test [End of INSTALL]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值