On 9 Aug 2007, at 20:52, Dave Shield wrote:

Hey guys,

> Your pass script should check how it is being invoked - whether  
> this is
> part of a GET request ("mysql-jbpm-test.sh -g OID"), or as part of a
> GETNEXT request ("mysql-jbpm-test.sh -n OID").
>    Similarly, it should check the OID that it is given as part of this
> command, and how this compares to the OID(s) that it implements.
>
> Assuming the script only supports a single MIB value (e.g. a scalar
> object), then for a GETNEXT request for any OIDs *before* the sole
> valid OID, it should return the OID/type/value triplet (as you do).
>    But a GETNEXT request for the OID .1.3.6.1.4.1.4914.1.1 or
> later, then your script should exit without printing anything at all.
> The agent can then move on to the next module in the tree.

That all makes absolute sense, thanks for that. I believe I've  
implemented this correctly, however snmpwalk still misses it.. My  
script now looks as follows:

=====================
#!/bin/sh

THING=`/usr/bin/mysql --batch --password=notarealpassword -u root  
coreJbpm --execute='s
elect count(*) from JBPM_LOG;'|grep -v count`

if [ $1 == -g ]; then
   echo ".1.3.6.1.4.1.4914.1.1"
   echo "integer"
   echo $THING
   exit
fi

if [ $1 == -n ]; then

   ENTOID1=`echo $2 | awk -F"." '{print $8}'`
   ENTOID2=`echo $2 | awk -F"." '{print $9}'`
   ENTOID3=`echo $2 | awk -F"." '{print $10}'`

   if [ "$ENTOID1" -gt "4914" ]; then
      exit
   fi

   if [ "$ENTOID1" -lt "4914" ]; then
     echo ".1.3.6.1.4.1.4914.1.1"
     echo "integer"
     echo $THING
   elif [ "$ENTOID2" -eq "0" ] ; then
     echo ".1.3.6.1.4.1.4914.1.1"
     echo "integer"
     echo $THING
   elif [ "$ENTOID2" -eq "1" ] && [ "$ENTOID3" -eq "0" ]; then
     echo ".1.3.6.1.4.1.4914.1.1"
     echo "integer"
     echo $THING
   fi

fi

===================

And it is called from the snmpd.conf as follows:

pass .1.3.6.1.4.1.4914.1.1 /etc/snmp/mysql-jbpm-test.sh

My MIB file is written as follows (and compiles ok)

===================
HOLE-IN-THE-NET-MIB DEFINITIONS ::= BEGIN

-- HOLE-IN-THE-NET.mib - Mib for custom monitoring developed by Joe  
Warren-Meeks

IMPORTS
    MODULE-IDENTITY, enterprises, mib-2
          FROM SNMPv2-SMI,
    DisplayString
         FROM RFC1213-MIB
    MODULE-COMPLIANCE, OBJECT-GROUP
         FROM SNMPv2-CONF,
    OBJECT-TYPE
         FROM RFC-1212;

hole-in-the-net MODULE-IDENTITY
     LAST-UPDATED "2007080901Z"
     ORGANIZATION "hole-in-the-net"
     CONTACT-INFO
          "email:   [EMAIL PROTECTED]"
     DESCRIPTION
         "MIB tree for tailored application monitoring
          Written by Joe Warren-Meeks"
     REVISION     "2007080901Z"
     DESCRIPTION
         "First draft"
     ::= { enterprises 4914 }

mysqlJbpm OBJECT IDENTIFIER ::= { hole-in-the-net 1 }

rowCount OBJECT-TYPE
         SYNTAX INTEGER
         ACCESS  read-only
         STATUS  current
         DESCRIPTION
                 "Number of rows in the Jbpm-log table."

         ::= { mysqlJbpm 1 }

END


==================


And snmpget works as follows:

joe-warren-meeks-computer:~ joe$ snmpget -mALL -v2c -c  
acommunitystring 192.168.1.1 enterprises.hole-in-the- 
net.mysqlJbpm.rowCount
HOLE-IN-THE-NET-MIB::rowCount = INTEGER: 50917


But snmpwalk still fails as follows:

joe-warren-meeks-computer:~ joe$ snmpwalk -mALL -v2c -c  
acommunitystring 192.168.1.1 enterprises.hole-in-the-net
HOLE-IN-THE-NET-MIB::hole-in-the-net = No Such Object available on  
this agent at this OID

Any clues? Have I messed up my MIB?

Sorry chaps, once I get past this bit I should be away and not bother  
you :-)

  -- joe.




-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.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