# [SOLVED] Net-snmp cannot execute shell script!

## qhfeiniao

my net-snmp cannot execute a shell script

here is my snmpd.conf

```

com2sec  local     127.0.0.1    public

group MyROGroup v1         local

group MyROGroup v2c        local

group MyROGroup usm        local

view all    included  .1     80

access MyROGroup ""      any       noauth    exact  all  none  none

exec .1.3.6.1.4.1.2021.51 linknumber /bin/sh /etc/snmp/script/link.sh

#syslocation MyLocation

#syscontact Me <me@somewhere.org>

```

when i try this:

```
snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.51
```

it told me:

```
UCD-SNMP-MIB::ucdavis.51 = No Such Object available on this agent at this OID
```

anyone who can help me ?Last edited by qhfeiniao on Fri Jan 25, 2008 5:27 pm; edited 2 times in total

----------

## qhfeiniao

I ues 'extend' insted of 'exec', then it worked normally. But i still didn't know why?

----------

## c23

I hit exactly the same issue.

If you look at man page of snmpd.conf : 

  extend [MIBOID] NAME PROG ARGS

              works  in  a similar manner to the exec directive, but with a number of improvements.  The MIB

              tables (nsExtendConfigTable etc) are indexed by the NAME token, so are unaffected by the order

              in  which  entries  are  read from the configuration files. 

I suppose you rooted (just like I did) your custom OID under an existing MIBOID (the default ones used by the system), so your "exec" entry was ignored. I suppose the order is to read the main MIBs, then process the custom "exec" directives (means, your "exec" directive was read "at the end")

Using "extend" will force the custom OID you used to be mounted under an existing MIDOIB, no matter the "order" OIDs were defined.

----------

