1*4882a593Smuzhiyun############################################################################### 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# EXAMPLE.conf: 4*4882a593Smuzhiyun# An example configuration file for configuring the ucd-snmp snmpd agent. 5*4882a593Smuzhiyun# 6*4882a593Smuzhiyun############################################################################### 7*4882a593Smuzhiyun# 8*4882a593Smuzhiyun# This file is intended to only be an example. If, however, you want 9*4882a593Smuzhiyun# to use it, it should be placed in /etc/snmp/snmpd.conf. 10*4882a593Smuzhiyun# When the snmpd agent starts up, this is where it will look for it. 11*4882a593Smuzhiyun# 12*4882a593Smuzhiyun# You might be interested in generating your own snmpd.conf file using 13*4882a593Smuzhiyun# the "snmpconf" program (perl script) instead. It's a nice menu 14*4882a593Smuzhiyun# based interface to writing well commented configuration files. Try it! 15*4882a593Smuzhiyun# 16*4882a593Smuzhiyun# Note: This file is automatically generated from EXAMPLE.conf.def. 17*4882a593Smuzhiyun# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run 18*4882a593Smuzhiyun# configure & make, and then make sure you read the EXAMPLE.conf file 19*4882a593Smuzhiyun# instead, as it will tailor itself to your configuration. 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun# All lines beginning with a '#' are comments and are intended for you 22*4882a593Smuzhiyun# to read. All other lines are configuration commands for the agent. 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun# 25*4882a593Smuzhiyun# PLEASE: read the snmpd.conf(5) manual page as well! 26*4882a593Smuzhiyun# 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun############################################################################### 30*4882a593Smuzhiyun# Access Control 31*4882a593Smuzhiyun############################################################################### 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY 34*4882a593Smuzhiyun# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO 35*4882a593Smuzhiyun# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun# By far, the most common question I get about the agent is "why won't 38*4882a593Smuzhiyun# it work?", when really it should be "how do I configure the agent to 39*4882a593Smuzhiyun# allow me to access it?" 40*4882a593Smuzhiyun# 41*4882a593Smuzhiyun# By default, the agent responds to the "public" community for read 42*4882a593Smuzhiyun# only access, if run out of the box without any configuration file in 43*4882a593Smuzhiyun# place. The following examples show you other ways of configuring 44*4882a593Smuzhiyun# the agent so that you can change the community names, and give 45*4882a593Smuzhiyun# yourself write access as well. 46*4882a593Smuzhiyun# 47*4882a593Smuzhiyun# The following lines change the access permissions of the agent so 48*4882a593Smuzhiyun# that the COMMUNITY string provides read-only access to your entire 49*4882a593Smuzhiyun# NETWORK (EG: 10.10.10.0/24), and read/write access to only the 50*4882a593Smuzhiyun# localhost (127.0.0.1, not its real ipaddress). 51*4882a593Smuzhiyun# 52*4882a593Smuzhiyun# For more information, read the FAQ as well as the snmpd.conf(5) 53*4882a593Smuzhiyun# manual page. 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun#### 56*4882a593Smuzhiyun# First, map the community name (COMMUNITY) into a security name 57*4882a593Smuzhiyun# (local and mynetwork, depending on where the request is coming 58*4882a593Smuzhiyun# from): 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun# sec.name source community 61*4882a593Smuzhiyuncom2sec paranoid default public 62*4882a593Smuzhiyun#com2sec readonly default public 63*4882a593Smuzhiyun#com2sec readwrite default private 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun#### 66*4882a593Smuzhiyun# Second, map the security names into group names: 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun# sec.model sec.name 69*4882a593Smuzhiyungroup MyROSystem v1 paranoid 70*4882a593Smuzhiyungroup MyROSystem v2c paranoid 71*4882a593Smuzhiyungroup MyROSystem usm paranoid 72*4882a593Smuzhiyungroup MyROGroup v1 readonly 73*4882a593Smuzhiyungroup MyROGroup v2c readonly 74*4882a593Smuzhiyungroup MyROGroup usm readonly 75*4882a593Smuzhiyungroup MyRWGroup v1 readwrite 76*4882a593Smuzhiyungroup MyRWGroup v2c readwrite 77*4882a593Smuzhiyungroup MyRWGroup usm readwrite 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun#### 80*4882a593Smuzhiyun# Third, create a view for us to let the groups have rights to: 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun# incl/excl subtree mask 83*4882a593Smuzhiyunview all included .1 80 84*4882a593Smuzhiyunview system included .iso.org.dod.internet.mgmt.mib-2.system 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun#### 87*4882a593Smuzhiyun# Finally, grant the 2 groups access to the 1 view with different 88*4882a593Smuzhiyun# write permissions: 89*4882a593Smuzhiyun 90*4882a593Smuzhiyun# context sec.model sec.level match read write notif 91*4882a593Smuzhiyunaccess MyROSystem "" any noauth exact system none none 92*4882a593Smuzhiyunaccess MyROGroup "" any noauth exact all none none 93*4882a593Smuzhiyunaccess MyRWGroup "" any noauth exact all all none 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun############################################################################### 99*4882a593Smuzhiyun# System contact information 100*4882a593Smuzhiyun# 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun# It is also possible to set the sysContact and sysLocation system 103*4882a593Smuzhiyun# variables through the snmpd.conf file. **PLEASE NOTE** that setting 104*4882a593Smuzhiyun# the value of these objects here makes these objects READ-ONLY 105*4882a593Smuzhiyun# (regardless of any access control settings). Any attempt to set the 106*4882a593Smuzhiyun# value of an object whose value is given here will fail with an error 107*4882a593Smuzhiyun# status of notWritable. 108*4882a593Smuzhiyun 109*4882a593Smuzhiyunsyslocation Unknown (configure /etc/snmp/snmpd.local.conf) 110*4882a593Smuzhiyunsyscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf) 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun# Example output of snmpwalk: 113*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost system 114*4882a593Smuzhiyun# system.sysDescr.0 = "SunOS name sun4c" 115*4882a593Smuzhiyun# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 116*4882a593Smuzhiyun# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 117*4882a593Smuzhiyun# system.sysContact.0 = "Me <me@somewhere.org>" 118*4882a593Smuzhiyun# system.sysName.0 = "name" 119*4882a593Smuzhiyun# system.sysLocation.0 = "Right here, right now." 120*4882a593Smuzhiyun# system.sysServices.0 = 72 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun############################################################################### 127*4882a593Smuzhiyun# Process checks. 128*4882a593Smuzhiyun# 129*4882a593Smuzhiyun# The following are examples of how to use the agent to check for 130*4882a593Smuzhiyun# processes running on the host. The syntax looks something like: 131*4882a593Smuzhiyun# 132*4882a593Smuzhiyun# proc NAME [MAX=0] [MIN=0] 133*4882a593Smuzhiyun# 134*4882a593Smuzhiyun# NAME: the name of the process to check for. It must match 135*4882a593Smuzhiyun# exactly (ie, http will not find httpd processes). 136*4882a593Smuzhiyun# MAX: the maximum number allowed to be running. Defaults to 0. 137*4882a593Smuzhiyun# MIN: the minimum number to be running. Defaults to 0. 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun# 140*4882a593Smuzhiyun# Examples: 141*4882a593Smuzhiyun# 142*4882a593Smuzhiyun 143*4882a593Smuzhiyun# Make sure mountd is running 144*4882a593Smuzhiyun#proc mountd 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun# Make sure there are no more than 4 ntalkds running, but 0 is ok too. 147*4882a593Smuzhiyun#proc ntalkd 4 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun# Make sure at least one sendmail, but less than or equal to 10 are running. 150*4882a593Smuzhiyun#proc sendmail 10 1 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun# A snmpwalk of the prTable would look something like this: 153*4882a593Smuzhiyun# 154*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.2 155*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 156*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 157*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 158*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" 159*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" 160*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" 161*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 162*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 163*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 164*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 165*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 166*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 167*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 168*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 169*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 170*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 171*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 172*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 173*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." 174*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" 175*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" 176*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 177*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 178*4882a593Smuzhiyun# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 179*4882a593Smuzhiyun# 180*4882a593Smuzhiyun# Note that the errorFlag for mountd is set to 1 because one is not 181*4882a593Smuzhiyun# running (in this case an rpc.mountd is, but thats not good enough), 182*4882a593Smuzhiyun# and the ErrMessage tells you what's wrong. The configuration 183*4882a593Smuzhiyun# imposed in the snmpd.conf file is also shown. 184*4882a593Smuzhiyun# 185*4882a593Smuzhiyun# Special Case: When the min and max numbers are both 0, it assumes 186*4882a593Smuzhiyun# you want a max of infinity and a min of 1. 187*4882a593Smuzhiyun# 188*4882a593Smuzhiyun 189*4882a593Smuzhiyun 190*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 191*4882a593Smuzhiyun 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun############################################################################### 194*4882a593Smuzhiyun# Executables/scripts 195*4882a593Smuzhiyun# 196*4882a593Smuzhiyun 197*4882a593Smuzhiyun# 198*4882a593Smuzhiyun# You can also have programs run by the agent that return a single 199*4882a593Smuzhiyun# line of output and an exit code. Here are two examples. 200*4882a593Smuzhiyun# 201*4882a593Smuzhiyun# exec NAME PROGRAM [ARGS ...] 202*4882a593Smuzhiyun# 203*4882a593Smuzhiyun# NAME: A generic name. 204*4882a593Smuzhiyun# PROGRAM: The program to run. Include the path! 205*4882a593Smuzhiyun# ARGS: optional arguments to be passed to the program 206*4882a593Smuzhiyun 207*4882a593Smuzhiyun# a simple hello world 208*4882a593Smuzhiyun#exec echotest /bin/echo hello world 209*4882a593Smuzhiyun 210*4882a593Smuzhiyun# Run a shell script containing: 211*4882a593Smuzhiyun# 212*4882a593Smuzhiyun# #!/bin/sh 213*4882a593Smuzhiyun# echo hello world 214*4882a593Smuzhiyun# echo hi there 215*4882a593Smuzhiyun# exit 35 216*4882a593Smuzhiyun# 217*4882a593Smuzhiyun# Note: this has been specifically commented out to prevent 218*4882a593Smuzhiyun# accidental security holes due to someone else on your system writing 219*4882a593Smuzhiyun# a /tmp/shtest before you do. Uncomment to use it. 220*4882a593Smuzhiyun# 221*4882a593Smuzhiyun#exec shelltest /bin/sh /tmp/shtest 222*4882a593Smuzhiyun 223*4882a593Smuzhiyun# Then, 224*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8 225*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 226*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 227*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" 228*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" 229*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" 230*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" 231*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 232*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 233*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." 234*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." 235*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 236*4882a593Smuzhiyun# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 237*4882a593Smuzhiyun 238*4882a593Smuzhiyun# Note that the second line of the /tmp/shtest shell script is cut 239*4882a593Smuzhiyun# off. Also note that the exit status of 35 was returned. 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun############################################################################### 245*4882a593Smuzhiyun# disk checks 246*4882a593Smuzhiyun# 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun# The agent can check the amount of available disk space, and make 249*4882a593Smuzhiyun# sure it is above a set limit. 250*4882a593Smuzhiyun 251*4882a593Smuzhiyun# disk PATH [MIN=DEFDISKMINIMUMSPACE] 252*4882a593Smuzhiyun# 253*4882a593Smuzhiyun# PATH: mount path to the disk in question. 254*4882a593Smuzhiyun# MIN: Disks with space below this value will have the Mib's errorFlag set. 255*4882a593Smuzhiyun# Default value = DEFDISKMINIMUMSPACE. 256*4882a593Smuzhiyun 257*4882a593Smuzhiyun# Check the / partition and make sure it contains at least 10 megs. 258*4882a593Smuzhiyun 259*4882a593Smuzhiyun#disk / 10000 260*4882a593Smuzhiyun 261*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9 262*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 263*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F 264*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" 265*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 266*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 267*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 268*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 269*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 270*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 271*4882a593Smuzhiyun# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" 272*4882a593Smuzhiyun 273*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 274*4882a593Smuzhiyun 275*4882a593Smuzhiyun 276*4882a593Smuzhiyun############################################################################### 277*4882a593Smuzhiyun# load average checks 278*4882a593Smuzhiyun# 279*4882a593Smuzhiyun 280*4882a593Smuzhiyun# load [1MAX=DEFMAXLOADAVE] [5MAX=DEFMAXLOADAVE] [15MAX=DEFMAXLOADAVE] 281*4882a593Smuzhiyun# 282*4882a593Smuzhiyun# 1MAX: If the 1 minute load average is above this limit at query 283*4882a593Smuzhiyun# time, the errorFlag will be set. 284*4882a593Smuzhiyun# 5MAX: Similar, but for 5 min average. 285*4882a593Smuzhiyun# 15MAX: Similar, but for 15 min average. 286*4882a593Smuzhiyun 287*4882a593Smuzhiyun# Check for loads: 288*4882a593Smuzhiyun#load 12 14 14 289*4882a593Smuzhiyun 290*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.10 291*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 292*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 293*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 294*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" 295*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" 296*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" 297*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 298*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 299*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 300*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" 301*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" 302*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" 303*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 304*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 305*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 306*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" 307*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" 308*4882a593Smuzhiyun# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" 309*4882a593Smuzhiyun 310*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 311*4882a593Smuzhiyun 312*4882a593Smuzhiyun 313*4882a593Smuzhiyun############################################################################### 314*4882a593Smuzhiyun# Extensible sections. 315*4882a593Smuzhiyun# 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun# This alleviates the multiple line output problem found in the 318*4882a593Smuzhiyun# previous executable mib by placing each mib in its own mib table: 319*4882a593Smuzhiyun 320*4882a593Smuzhiyun# Run a shell script containing: 321*4882a593Smuzhiyun# 322*4882a593Smuzhiyun# #!/bin/sh 323*4882a593Smuzhiyun# echo hello world 324*4882a593Smuzhiyun# echo hi there 325*4882a593Smuzhiyun# exit 35 326*4882a593Smuzhiyun# 327*4882a593Smuzhiyun# Note: this has been specifically commented out to prevent 328*4882a593Smuzhiyun# accidental security holes due to someone else on your system writing 329*4882a593Smuzhiyun# a /tmp/shtest before you do. Uncomment to use it. 330*4882a593Smuzhiyun# 331*4882a593Smuzhiyun# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest 332*4882a593Smuzhiyun 333*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50 334*4882a593Smuzhiyun# enterprises.ucdavis.50.1.1 = 1 335*4882a593Smuzhiyun# enterprises.ucdavis.50.2.1 = "shelltest" 336*4882a593Smuzhiyun# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" 337*4882a593Smuzhiyun# enterprises.ucdavis.50.100.1 = 35 338*4882a593Smuzhiyun# enterprises.ucdavis.50.101.1 = "hello world." 339*4882a593Smuzhiyun# enterprises.ucdavis.50.101.2 = "hi there." 340*4882a593Smuzhiyun# enterprises.ucdavis.50.102.1 = 0 341*4882a593Smuzhiyun 342*4882a593Smuzhiyun# Now the Output has grown to two lines, and we can see the 'hi 343*4882a593Smuzhiyun# there.' output as the second line from our shell script. 344*4882a593Smuzhiyun# 345*4882a593Smuzhiyun# Note that you must alter the mib.txt file to be correct if you want 346*4882a593Smuzhiyun# the .50.* outputs above to change to reasonable text descriptions. 347*4882a593Smuzhiyun 348*4882a593Smuzhiyun# Other ideas: 349*4882a593Smuzhiyun# 350*4882a593Smuzhiyun# exec .1.3.6.1.4.1.2021.51 ps /bin/ps 351*4882a593Smuzhiyun# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top 352*4882a593Smuzhiyun# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq 353*4882a593Smuzhiyun 354*4882a593Smuzhiyun# ----------------------------------------------------------------------------- 355*4882a593Smuzhiyun 356*4882a593Smuzhiyun 357*4882a593Smuzhiyun############################################################################### 358*4882a593Smuzhiyun# Pass through control. 359*4882a593Smuzhiyun# 360*4882a593Smuzhiyun 361*4882a593Smuzhiyun# Usage: 362*4882a593Smuzhiyun# pass MIBOID EXEC-COMMAND 363*4882a593Smuzhiyun# 364*4882a593Smuzhiyun# This will pass total control of the mib underneath the MIBOID 365*4882a593Smuzhiyun# portion of the mib to the EXEC-COMMAND. 366*4882a593Smuzhiyun# 367*4882a593Smuzhiyun# Note: You'll have to change the path of the passtest script to your 368*4882a593Smuzhiyun# source directory or install it in the given location. 369*4882a593Smuzhiyun# 370*4882a593Smuzhiyun# Example: (see the script for details) 371*4882a593Smuzhiyun# (commented out here since it requires that you place the 372*4882a593Smuzhiyun# script in the right location. (its not installed by default)) 373*4882a593Smuzhiyun 374*4882a593Smuzhiyun# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/passtest 375*4882a593Smuzhiyun 376*4882a593Smuzhiyun# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255 377*4882a593Smuzhiyun# enterprises.ucdavis.255.1 = "life the universe and everything" 378*4882a593Smuzhiyun# enterprises.ucdavis.255.2.1 = 42 379*4882a593Smuzhiyun# enterprises.ucdavis.255.2.2 = OID: 42.42.42 380*4882a593Smuzhiyun# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 381*4882a593Smuzhiyun# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 382*4882a593Smuzhiyun# enterprises.ucdavis.255.5 = 42 383*4882a593Smuzhiyun# enterprises.ucdavis.255.6 = Gauge: 42 384*4882a593Smuzhiyun# 385*4882a593Smuzhiyun# % snmpget -v 1 -c public localhost .1.3.6.1.4.1.2021.255.5 386*4882a593Smuzhiyun# enterprises.ucdavis.255.5 = 42 387*4882a593Smuzhiyun# 388*4882a593Smuzhiyun# % snmpset -v 1 -c public localhost .1.3.6.1.4.1.2021.255.1 s "New string" 389*4882a593Smuzhiyun# enterprises.ucdavis.255.1 = "New string" 390*4882a593Smuzhiyun# 391*4882a593Smuzhiyun 392*4882a593Smuzhiyun# For specific usage information, see the man/snmpd.conf.5 manual page 393*4882a593Smuzhiyun# as well as the local/passtest script used in the above example. 394*4882a593Smuzhiyun 395*4882a593Smuzhiyun############################################################################### 396*4882a593Smuzhiyun# Subagent control 397*4882a593Smuzhiyun# 398*4882a593Smuzhiyun 399*4882a593Smuzhiyun# The agent can support subagents using a number of extension mechanisms. 400*4882a593Smuzhiyun# From the 4.2.1 release, AgentX support is being compiled in by default. 401*4882a593Smuzhiyun# However, this is still experimental code, so should not be used on 402*4882a593Smuzhiyun# critical production systems. 403*4882a593Smuzhiyun# Please see the file README.agentx for more details. 404*4882a593Smuzhiyun# 405*4882a593Smuzhiyun# If having read, marked, learnt and inwardly digested this information, 406*4882a593Smuzhiyun# you decide that you do wish to make use of this mechanism, simply 407*4882a593Smuzhiyun# uncomment the following directive. 408*4882a593Smuzhiyun# 409*4882a593Smuzhiyun# master agentx 410*4882a593Smuzhiyun# 411*4882a593Smuzhiyun# I repeat - this is *NOT* regarded as suitable for front-line production 412*4882a593Smuzhiyun# systems, though it is probably stable enough for day-to-day use. 413*4882a593Smuzhiyun# Probably. 414*4882a593Smuzhiyun# 415*4882a593Smuzhiyun# No refunds will be given. 416*4882a593Smuzhiyun 417*4882a593Smuzhiyun############################################################################### 418*4882a593Smuzhiyun# Further Information 419*4882a593Smuzhiyun# 420*4882a593Smuzhiyun# See the snmpd.conf manual page, and the output of "snmpd -H". 421*4882a593Smuzhiyun# MUCH more can be done with the snmpd.conf than is shown as an 422*4882a593Smuzhiyun# example here. 423