Hi,

I've been trying to use the pass command to implement a script for
creating my own MIB blocks.  To begin with I'm just trying to get the
supplied passtest script from 5.1.1 to work, and it doesn't.

Here is a log of my session

escher:~# /etc/init.d/snmpd restart
Restarting network management services: snmpd.
escher:~# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.53
UCD-SNMP-MIB::ucdavis.53.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.2.1 = STRING: "mailq"
UCD-SNMP-MIB::ucdavis.53.3.1 = STRING: "/usr/bin/mailq"
UCD-SNMP-MIB::ucdavis.53.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.53.101.1 = STRING: "Mail queue is empty"
UCD-SNMP-MIB::ucdavis.53.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.53.103.1 = ""
escher:~# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
escher:~# /etc/init.d/snmpd stop
Stopping network management services: snmpd snmptrapd.

The /var/log/snmpd.log created by using -D can be found at
http://shiva.missioncriticalit.com/~petdr/snmpd.log

Here are my snmpd.conf and the passtest script that I use.

I really don't know what the problem could possibly be.

---- snmpd.conf -----
rocommunity  public  
exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq
pass  .1.3.6.1.4.1.2021.255 /usr/local/passtest
---------------------

---- passtest  ------
#!/bin/sh -f

PATH=$PATH:/bin:/usr/bin:/usr/ucb

PLACE=".1.3.6.1.4.1.2021.255"
REQ="$2"

if [ "$1" = "-s" ]; then
  echo $* >> /tmp/passtest.log
  exit 0
fi

if [ "$1" = "-n" ]; then
  case "$REQ" in
    $PLACE)      RET=$PLACE.1 ;;
    $PLACE.1)    RET=$PLACE.2.1 ;;
    $PLACE.2.1)  RET=$PLACE.2.2 ;;
    $PLACE.2.2)  RET=$PLACE.3 ;;
    $PLACE.3)    RET=$PLACE.4 ;;
    $PLACE.4)    RET=$PLACE.5 ;;
    $PLACE.5)    RET=$PLACE.6 ;;
    *)           exit 0 ;;
  esac
else
  case "$REQ" in
    $PLACE)    exit 0 ;;
    *)         RET=$REQ ;;
  esac
fi

echo "$RET"
case "$RET" in
  $PLACE.1) echo "string"; echo "life the universe and everything"; exit 0 ;;
  $PLACE.2.1) echo "integer"; echo "42"; exit 0 ;;
  $PLACE.2.2) echo "objectid"; echo ".1.3.6.1.4.42.42.42"; exit 0 ;;
  $PLACE.3) echo "timeticks"; echo "363136200"; exit 0 ;;
  $PLACE.4) echo "ipaddress"; echo "127.0.0.1" ;;
  $PLACE.5) echo "counter"; echo "42"; exit 0 ;;
  $PLACE.6) echo "gauge"; echo "42"; exit 0 ;;
  *) echo "string"; echo "ack... $RET $REQ"; exit 0 ;;
esac
---------------------


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to