I'm attempting to add a script to be called from SNMPd, but I'm looking for some additional information. I've written a script that currently outputs data as follows:

[EMAIL PROTECTED] ~/bin $ ./var-snmp.sh agetty
app1:agetty
pid: 7182
cpu: 0.0
mem: 0.0
totalmem: 16314328
app2:agetty
pid: 7184
cpu: 0.0
mem: 0.0
totalmem: 16314328
app3:agetty
pid: 7185
cpu: 0.0
mem: 0.0
<--- truncated --->

I can modify the script as needed, but thats what I've got thus far. I run the script, and pass an argument on which process name I want information back for. The argument can be hard-coded, but for this example I'll leave it in place.

I've modified snmpd.conf to show the following:

extend .1.3.6.1.4.1.2021.55 showstat /bin/sh /tmp/var-snmp.sh agetty

and when I walk it, I get the following output:

UCD-SNMP-MIB::ucdavis.55.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1.2.8.115.104.111.119.115.116.97.116 = STRING: "/bin/sh" UCD-SNMP-MIB::ucdavis.55.2.1.3.8.115.104.111.119.115.116.97.116 = STRING: "/tmp/var-cmd.sh agetty"
UCD-SNMP-MIB::ucdavis.55.2.1.4.8.115.104.111.119.115.116.97.116 = ""
UCD-SNMP-MIB::ucdavis.55.2.1.5.8.115.104.111.119.115.116.97.116 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.55.2.1.6.8.115.104.111.119.115.116.97.116 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1.7.8.115.104.111.119.115.116.97.116 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.55.2.1.20.8.115.104.111.119.115.116.97.116 = INTEGER: 4 UCD-SNMP-MIB::ucdavis.55.2.1.21.8.115.104.111.119.115.116.97.116 = INTEGER: 1 UCD-SNMP-MIB::ucdavis.55.3.1.1.8.115.104.111.119.115.116.97.116 = STRING: "app1:agetty" UCD-SNMP-MIB::ucdavis.55.3.1.2.8.115.104.111.119.115.116.97.116 = STRING: "app1:agetty
pid: 7182
cpu: 0.0
mem: 0.0
totalmem: 16314328
app2:agetty
pid: 7184
cpu: 0.0
mem: 0.0
totalmem: 16314328
UCD-SNMP-MIB::ucdavis.55.3.1.3.8.115.104.111.119.115.116.97.116 = INTEGER: 30
UCD-SNMP-MIB::ucdavis.55.3.1.4.8.115.104.111.119.115.116.97.116 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.1 = STRING: "app1:agetty" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.2 = STRING: "pid: 7182" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.3 = STRING: "cpu: 0.0" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.4 = STRING: "mem: 0.0" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.5 = STRING: "totalmem: 16314328" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.6 = STRING: "app2:agetty" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.7 = STRING: "pid: 7184" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.8 = STRING: "cpu: 0.0" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.9 = STRING: "mem: 0.0" UCD-SNMP-MIB::ucdavis.55.4.1.2.8.115.104.111.119.115.116.97.116.10 = STRING: "totalmem: 16314328"
<---truncated--->

A couple of things.

  1. I know I need to if this is the best way to provide output, and
     whether or not I should include the individual field name within
     the result (ie cpu: 0.0 or just 0.0 ).
  2. UCD-SNMP-MIB::ucdavis.55.3.1.3.8.115.104.111.119.115.116.97.116 =
     INTEGER: 30  -- I assume this means I have 30 lines to output.  Is
     there a way to provide either an index, or ??? , to tell an end
     user that the 5 lines should be grouped to give one full data set.
         * Kinda like eth0.In and eth0.Out
  3. Once I get this part completed, what is the best way to build an
     MIB for release so that others could use this.  This is sample
     data, but the end script would be more useful to more people than
     myself.

some info:
vm3 tmp # snmpwalk --version
NET-SNMP version: 5.4.1

Thanks,
joey


--
Joey Officer
Systems Administrator   
iStream Imaging
262-432-1536

CONFIDENTIALITY NOTICE
This electronic mail and the information contained herein are intended for the 
named recipient only.  It may contain confidential, proprietary and/or 
privileged information.  If you have received this electronic mail in error, 
please do not read any text other than the text of this notice and do not open 
any attachments. Also, please immediately notify the sender by replying to this 
electronic mail or by collect call to (262) 796-0925. After notifying the 
sender as described above, please delete this electronic mail message 
immediately and purge the item from the deleted items folder (or the 
equivalent) of your electronic mail system. Thank you.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to